Match func_8007C4A4 & func_80095AE0 (#618)

* Match funcs

* Add ub fix
This commit is contained in:
MegaMech
2024-04-20 21:56:02 -06:00
committed by GitHub
parent d08be66c38
commit cda6a508fd
5 changed files with 58 additions and 167 deletions
+49 -35
View File
@@ -2814,45 +2814,59 @@ Gfx *func_800959F8(Gfx *displayListHead, Vtx *arg1) {
return displayListHead;
}
#ifdef MIPS_TO_C
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Sep-01-2023
void func_80095AE0(Mtx *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4) {
s32 sp14;
s32 sp10;
s32 spC;
s32 sp8;
Mtx *var_v1;
s32 var_v0;
typedef struct {
u16 i[4][4];
u16 f[4][4];
} Mtx_u;
var_v0 = 0;
var_v1 = arg0;
do {
var_v0 += 4;
var_v1->m[0][0] = 0;
var_v1->m[0][1] = 0;
var_v1->m[0][2] = 0;
var_v1->m[0][3] = 0;
var_v1 += 0x10;
} while (var_v0 != 0x10);
sp14 = (s32) (arg3 * 65536.0f);
sp10 = (s32) (arg4 * 65536.0f);
spC = (s32) (arg1 * 65536.0f);
sp8 = (s32) (arg2 * 65536.0f);
arg0->unk0 = (s16) sp14.unk0;
arg0->unk14 = 1;
arg0->unkA = (s16) sp10.unk0;
arg0->unk18 = (s16) spC.unk0;
arg0->unk1E = 1;
arg0->unk1A = (s16) sp8.unk0;
arg0->unk20 = (s16) sp14.unk2;
arg0->unk2A = (s16) sp10.unk2;
arg0->unk38 = (s16) spC.unk2;
arg0->unk3A = (s16) sp8.unk2;
}
typedef union {
Mtx_u u;
Mtx_t m;
long long int force_structure_alignment;
} Mtx2;
typedef union {
s16 s[2];
s32 w;
} TheWhyUnion;
// Why... Why... Why... This function is so bad it's not going in the header.
void func_80095AE0(Mtx2 *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4) {
TheWhyUnion sp14;
TheWhyUnion sp10;
TheWhyUnion spC;
TheWhyUnion sp8;
s32 i;
#ifdef AVOID_UB
for (int row = 0; row < 4; row++) {
for (int col = 0; col < 4; col++) {
arg0->m[row][col] = 0;
}
}
#else
GLOBAL_ASM("asm/non_matchings/code_80091750/func_80095AE0.s")
for(i = 0; i < 16; i++) {\
arg0->m[0][i] = 0;
}
#endif
sp14.w = arg3 * 65536.0f;
sp10.w = arg4 * 65536.0f;
spC.w = arg1 * 65536.0f;
sp8.w = arg2 * 65536.0f;
arg0->u.i[0][0] = sp14.s[0];
arg0->u.i[1][1] = sp10.s[0];
arg0->u.i[2][2] = 1;
arg0->u.i[3][0] = spC.s[0];
arg0->u.i[3][1] = sp8.s[0];
arg0->u.i[3][3] = 1;
arg0->u.f[0][0] = sp14.s[1];
arg0->u.f[1][1] = sp10.s[1];
arg0->u.f[3][0] = spC.s[1];
arg0->u.f[3][1] = sp8.s[1];
}
Gfx *func_80095BD0(Gfx *displayListHead, u8 *arg1, f32 arg2, f32 arg3, u32 arg4, u32 arg5, f32 arg6, f32 arg7) {
Vtx *var_a1;
Mtx *sp28;