core1/done/gu/mtxutil.c done

This commit is contained in:
Banjo Kazooie
2022-10-14 14:03:43 -05:00
parent 03904ccd4a
commit 59f32adc6b
8 changed files with 56 additions and 57 deletions

View File

@@ -2,6 +2,8 @@
#include "functions.h"
#include "variables.h"
ALGlobals *alGlobals = NULL;
void alInit(ALGlobals *g, ALSynConfig *c){
if (!alGlobals) { /* already initialized? */
alGlobals = g;
@@ -31,8 +33,3 @@ void alUnlink(ALLink *ln){
if (ln->prev)
ln->prev->next = ln->next;
}

View File

@@ -2,6 +2,46 @@
#include "functions.h"
#include "variables.h"
void guMtxL2F(float mf[4][4], Mtx *m)
{
int i, j;
unsigned int e1,e2;
unsigned int *ai,*af;
int q1,q2;
ai=(unsigned int *) &m->m[0][0];
af=(unsigned int *) &m->m[2][0];
for (i=0; i<4; i++)
for (j=0; j<2; j++) {
e1 = (*ai & 0xffff0000) | ((*af >> 16) & 0xffff);
e2 = ((*(ai++) << 16) & 0xffff0000) | ((u16)(*(af++) >> 0));
q1 = *((int *)&e1);
q2 = *((int *)&e2);
mf[i][j*2] = (f32)q1/65536.0f;
mf[i][j*2+1] = (f32)q2/65536.0f;
}
}
void guMtxIdent(Mtx *m){
float mf[4][4];
guMtxIdentF(mf);
guMtxF2L(mf, m);
}
void guMtxIdentF(float mf[4][4])
{
int i, j;
for (i=0; i<4; i++)
for (j=0; j<4; j++)
if (i == j) mf[i][j] = 1.0;
else mf[i][j] = 0.0;
}
void guMtxF2L(float mf[4][4], Mtx *m)
{
int i, j;
@@ -20,43 +60,3 @@ void guMtxF2L(float mf[4][4], Mtx *m)
*(af++) = ((e1 << 16) & 0xffff0000) | (e2 & 0xffff);
}
}
void guMtxIdentF(float mf[4][4])
{
int i, j;
for (i=0; i<4; i++)
for (j=0; j<4; j++)
if (i == j) mf[i][j] = 1.0;
else mf[i][j] = 0.0;
}
void guMtxIdent(Mtx *m){
float mf[4][4];
guMtxIdentF(mf);
guMtxF2L(mf, m);
}
#pragma GLOBAL_ASM("asm/nonmatchings/core1/gu/mtxutil/guMtxL2F.s")
// void guMtxL2F(float mf[4][4], Mtx *m)
// {
// int i, j;
// unsigned int e1,e2;
// unsigned int *ai,*af;
// int q1,q2;
// ai=(unsigned int *) &m->m[0][0];
// af=(unsigned int *) &m->m[2][0];
// for (i=0; i<4; i++)
// for (j=0; j<2; j++) {
// e1 = (*ai & 0xffff0000) | ((*af >> 16) & 0xffff);
// e2 = ((*(ai++) << 16) & 0xffff0000) | (*(af++) & 0xffff);
// q1 = *((int *)&e1);
// q2 = *((int *)&e2);
// mf[i][j*2] = FIX32TOF(q1);
// mf[i][j*2+1] = FIX32TOF(q2);
// }
// }

View File

@@ -8,7 +8,7 @@ f32 sinf(f32);
f32 cosf(f32);
#pragma GLOBAL_ASM("asm/nonmatchings/core1/gu/rotate/guRotateF.s")
// MATCHING but need to resolve core1 data section for static D_80285900
// 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;
@@ -45,7 +45,7 @@ f32 cosf(f32);
// }
#pragma GLOBAL_ASM("asm/nonmatchings/core1/gu/rotate/guRotate.s")
// MATCHING with -O3, need to resolve data section
// MATCHING with -O3, need to resolve bss section
// void guRotate(Mtx *m, float a, float x, float y, float z)
// {
// float mf[4][4];