core1/gu/rotate.c done

This commit is contained in:
Banjo Kazooie
2022-10-26 15:00:50 -05:00
parent a6934f7205
commit 7ee1bdf312
25 changed files with 253 additions and 157 deletions

View File

@@ -4,13 +4,18 @@
#include "ml/mtx.h"
extern Mtx *D_80282FD0;
extern Mtx_t D_80282810;
f32 func_80263FF0(f32);
f32 cosf(f32);
extern f64 D_80278220;
/*.bss*/
Mtx_t D_80282810;
u8 pad_D_80282850[0x780];
Mtx * D_80282FD0;
/*.code*/
#ifndef NONMATCHING
#pragma GLOBAL_ASM("asm/nonmatchings/core1/code_13990/func_802513B0.s")
#else

View File

@@ -2,7 +2,7 @@
#include "functions.h"
#include "variables.h"
extern struct {
struct {
u16 *unk0;
int unk4;
} D_80282FE0;

View File

@@ -11,23 +11,27 @@ typedef struct {
s32 unk14;
}Struct_Core1_15B30;
extern Gfx *D_80276580[2];
extern Mtx *D_80282FF0[2];
extern Vtx *D_80282FF8[2];
extern s32 D_80283000;
extern s32 D_80283004;
extern Struct_Core1_15B30 D_80283008[];
extern s32 D_802831E8;
extern OSMesgQueue D_802831F0;
extern OSMesg D_80283208;
extern u16 D_8028320C;
extern u16 D_8028320E;
extern u16 D_80283210;
extern u16 D_80283212;
extern Gfx *D_80283214;
extern u8 D_803A5D00[2][0x1ecc0];
/* .data */
extern Gfx *D_80276580[2];
/* .bss */
Mtx *D_80282FF0[2];
Vtx *D_80282FF8[2];
s32 D_80283000;
s32 D_80283004;
Struct_Core1_15B30 D_80283008[20];
s32 D_802831E8;
OSMesgQueue D_802831F0;
OSMesg D_80283208;
u16 D_8028320C;
u16 D_8028320E;
u16 D_80283210;
u16 D_80283212;
Gfx *D_80283214;
/* .h */
void func_80254348(void);
void func_80254464(void);

View File

@@ -2,11 +2,11 @@
#include "functions.h"
#include "variables.h"
extern u64 D_80283280[];
extern s32 D_80283380;
extern s32 D_80283384;
extern s32 D_80283388;
/* .bss */
u8 D_80283280[0x100];
s32 D_80283380;
s32 D_80283384;
s32 D_80283388;
void func_80255C30(void) {
D_80283384 = *(s32 *)0xA4000000 ^ -1;

View File

@@ -4,7 +4,13 @@
#include "SnS.h"
#include "save.h"
/* .bss */
StopNSwop_Data snsParsedKeys;
struct GlobalSave gSaveData;
s32 snsMinKeyToParse;
s32 snsMaxKeyToParse;
s32 snsParsedCurrPos;
u32 snsBackedUpItems;
void sns_init_parsing_params(s32 min, s32 max)
{

View File

@@ -3,18 +3,20 @@
#include "variables.h"
#include "SnS.h"
/**
* An index used to track the position in the incoming payload
* we should read the next key from.
*/
extern s32 snsPayloadInCurrPos;
/* .data*/
/**
* An index used to track the position in the outgoing payload
* it should write the next key to.
*/
extern s32 snsPayloadOutCurrPos;
/*.bss*/
/**
* An index used to track the position in the incoming payload
* we should read the next key from.
*/
s32 snsPayloadInCurrPos;
struct SnsPayload *snspayload_init_new_payload(struct SnsPayload *payload)
{

View File

@@ -0,0 +1,53 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
// extern f32 D_80285900;
f32 sinf(f32);
f32 cosf(f32);
// MATCHING but need to resolve core1 bss section for static D_80285900
void guRotateF(float mf[4][4], float a, float x, float y, float z)
{
static f32 D_80285900 = 3.1415926 / 180.0;
float sine;
float cosine;
float ab, bc, ca, t;
guNormalize(&x, &y, &z);
a *= D_80285900;
sine = sinf(a);
cosine = cosf(a);
t = (1-cosine);
ab = x*y*t;
bc = y*z*t;
ca = z*x*t;
guMtxIdentF(mf);
t = x*x;
mf[0][0] = t+cosine*(1-t);
mf[2][1] = bc-x*sine;
mf[1][2] = bc+x*sine;
t = y*y;
mf[1][1] = t+cosine*(1-t);
mf[2][0] = ca+y*sine;
mf[0][2] = ca-y*sine;
t = z*z;
mf[2][2] = t+cosine*(1-t);
mf[1][0] = ab-z*sine;
mf[0][1] = ab+z*sine;
}
// MATCHING with -O3, need to resolve bss section
void guRotate(Mtx *m, float a, float x, float y, float z)
{
float mf[4][4];
guRotateF(mf, a, x, y, z);
guMtxF2L(mf, m);
}

View File

@@ -7,10 +7,12 @@ extern u32 __osPiAccessQueueEnabled;
OSDevMgr __osPiDevMgr = {0};
OSPiHandle *__osPiTable = NULL;
OSPiHandle *__osCurrentHandle[2] = {&CartRomHandle, &LeoDiskHandle};
extern OSThread piThread;
extern char piThreadStack[OS_PIM_STACKSIZE];
extern OSMesgQueue piEventQueue;
extern OSMesg piEventBuf;
/* .bss */
OSThread piThread;
char piThreadStack[OS_PIM_STACKSIZE];
OSMesgQueue piEventQueue;
OSMesg piEventBuf;
void osCreatePiManager(OSPri pri, OSMesgQueue *cmdQ, OSMesg *cmdBuf, s32 cmdMsgCnt)
{

View File

@@ -5,7 +5,9 @@
{ \
ptr = (void *)osVirtualToPhysical(ptr); \
}
extern OSTask tmp_task; // TODO bss (static)
OSTask tmp_task; // TODO bss (static)
static OSTask *_VirtualToPhysicalTask(OSTask *intp)
{
OSTask *tp;

View File

@@ -4,6 +4,8 @@
#include "osint.h"
OSDevMgr __osViDevMgr = {0};
/* .bss */
/*static*/ OSThread viThread;
/*static*/ unsigned char viThreadStack[OS_VIM_STACKSIZE];
/*static*/ OSMesgQueue viEventQueue;
@@ -54,7 +56,7 @@ void osCreateViManager(OSPri pri)
}
}
}
extern u16 retrace;
u16 retrace;
static void viMgrMain(void *arg)
{
__OSViContext *vc;

View File

@@ -1,5 +1,6 @@
#include <os_internal.h>
#include "osint.h"
__OSEventState __osEventStateTab[OS_NUM_EVENTS];
void osSetEventMesg(OSEvent event, OSMesgQueue *mq, OSMesg msg)
{

View File

@@ -1,55 +0,0 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
extern f32 D_80285900;
f32 sinf(f32);
f32 cosf(f32);
#pragma GLOBAL_ASM("asm/nonmatchings/core1/gu/rotate/guRotateF.s")
// MATCHING but need to resolve core1 bss section for static D_80285900
// void guRotateF(float mf[4][4], float a, float x, float y, float z)
// {
// static f32 D_80285900 = 3.1415926 / 180.0;
// float sine;
// float cosine;
// float ab, bc, ca, t;
// guNormalize(&x, &y, &z);
// a *= D_80285900;
// sine = sinf(a);
// cosine = cosf(a);
// t = (1-cosine);
// ab = x*y*t;
// bc = y*z*t;
// ca = z*x*t;
// guMtxIdentF(mf);
// t = x*x;
// mf[0][0] = t+cosine*(1-t);
// mf[2][1] = bc-x*sine;
// mf[1][2] = bc+x*sine;
// t = y*y;
// mf[1][1] = t+cosine*(1-t);
// mf[2][0] = ca+y*sine;
// mf[0][2] = ca-y*sine;
// t = z*z;
// mf[2][2] = t+cosine*(1-t);
// mf[1][0] = ab-z*sine;
// mf[0][1] = ab+z*sine;
// }
#pragma GLOBAL_ASM("asm/nonmatchings/core1/gu/rotate/guRotate.s")
// MATCHING with -O3, need to resolve bss section
// void guRotate(Mtx *m, float a, float x, float y, float z)
// {
// float mf[4][4];
// guRotateF(mf, a, x, y, z);
// guMtxF2L(mf, m);
// }

View File

@@ -19,7 +19,7 @@ extern void func_80253010(void *dest, void *src, s32 size);
#define HEAP_SIZE 0x210520
#define LAST_HEAP_BLOCK HEAP_SIZE/sizeof(EmptyHeapBlock) - 1
enum {
extern enum {
HEAP_BLOCK_EMPTY = 0,
HEAP_BLOCK_USED = 1,
HEAP_BLOCK_PERM = 2
@@ -46,11 +46,7 @@ extern EmptyHeapBlock D_8023DA00;
extern struct{
bool unk0;
}D_802765B0;
extern void *D_80283224;
extern void *D_80283228;
extern s32 D_8028322C;
extern u32 heap_requested_size;
extern HeapHeader * D_80283234;
extern u32 heap_occupiedBytes; //occupied heap size
extern u8 D_80276594;
extern u8 D_80276598;
@@ -61,8 +57,13 @@ extern void *D_802765A8;
extern s32 D_802765AC;
extern UNK_TYPE(void *) D_802765B4;
extern s32 D_80283220;
extern struct {
s32 D_80283220;
void *D_80283224;
void *D_80283228;
s32 D_8028322C;
u32 heap_requested_size;
HeapHeader * D_80283234;
struct {
void *unk0[0x10];
void **unk40;
}D_80283238;

View File

@@ -20,6 +20,7 @@ OSTime osClockRate = OS_CLOCK_RATE;
s32 osViClock = VI_NTSC_CLOCK;
u32 __osShutdown = 0;
u32 __OSGlobalIntMask = OS_IM_ALL;
/* .bss */
u32 __osFinalrom;
void __osInitialize_common()