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

@@ -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)
{