diff --git a/asm/non_matchings/ovl1/ovl1/func_800A09AC.s b/asm/non_matchings/ovl1/ovl1/func_800A09AC.s index 89e778e4..a5623a21 100644 --- a/asm/non_matchings/ovl1/ovl1/func_800A09AC.s +++ b/asm/non_matchings/ovl1/ovl1/func_800A09AC.s @@ -1,3 +1,10 @@ +.late_rodata +glabel D_800D5A10 +.float 6.28318530717958623200 +glabel D_800D5A14 +.float 1.57079632679489655800 + +.text glabel func_800A09AC /* 048BFC 800A09AC 27BDFEB8 */ addiu $sp, $sp, -0x148 /* 048C00 800A09B0 AFB00074 */ sw $s0, 0x74($sp) diff --git a/asm/non_matchings/ovl1/ovl1/func_800A19EC.s b/asm/non_matchings/ovl1/ovl1/func_800A19EC.s index 90762528..35eb7986 100644 --- a/asm/non_matchings/ovl1/ovl1/func_800A19EC.s +++ b/asm/non_matchings/ovl1/ovl1/func_800A19EC.s @@ -1,7 +1,21 @@ .late_rodata +glabel jtbl_800D5A18 +.word .L800A1C2C_ovl1 +.word .L800A1C94_ovl1 +.word .L800A1CD4_ovl1 +.word .L800A1C2C_ovl1 +.word .L800A1C2C_ovl1 +.word .L800A1D58_ovl1 +.word .L800A1CDC_ovl1 +.word .L800A1CDC_ovl1 +.word .L800A1E34_ovl1 + +glabel D_800D5A3C +.float 6.28318530717958623200 glabel D_800D5A40 .float 6.28318530717958623200 + .text glabel func_800A19EC /* 049C3C 800A19EC 30820007 */ andi $v0, $a0, 7 @@ -146,11 +160,12 @@ glabel func_800A19EC /* 049E5C 800A1C0C 2DA10009 */ sltiu $at, $t5, 9 /* 049E60 800A1C10 102000B1 */ beqz $at, .L800A1ED8_ovl1 /* 049E64 800A1C14 000D6880 */ sll $t5, $t5, 2 -/* 049E68 800A1C18 3C01800D */ lui $at, %hi(D_800D5A18) +/* 049E68 800A1C18 3C01800D */ lui $at, %hi(jtbl_800D5A18) /* 049E6C 800A1C1C 002D0821 */ addu $at, $at, $t5 -/* 049E70 800A1C20 8C2D5A18 */ lw $t5, %lo(D_800D5A18)($at) +/* 049E70 800A1C20 8C2D5A18 */ lw $t5, %lo(jtbl_800D5A18)($at) /* 049E74 800A1C24 01A00008 */ jr $t5 /* 049E78 800A1C28 00000000 */ nop +.L800A1C2C_ovl1: /* 049E7C 800A1C2C 8C8E0000 */ lw $t6, ($a0) /* 049E80 800A1C30 01C37821 */ addu $t7, $t6, $v1 /* 049E84 800A1C34 8DE50000 */ lw $a1, ($t7) @@ -170,6 +185,7 @@ glabel func_800A19EC /* 049EBC 800A1C6C C4325A3C */ lwc1 $f18, %lo(D_800D5A3C)($at) /* 049EC0 800A1C70 1000009F */ b .L800A1EF0_ovl1 /* 049EC4 800A1C74 E4520054 */ swc1 $f18, 0x54($v0) +.L800A1C78_ovl1: /* 049EC8 800A1C78 E4420050 */ swc1 $f2, 0x50($v0) .L800A1C7C_ovl1: /* 049ECC 800A1C7C 8C8B0000 */ lw $t3, ($a0) @@ -178,6 +194,7 @@ glabel func_800A19EC /* 049ED8 800A1C88 C7240034 */ lwc1 $f4, 0x34($t9) /* 049EDC 800A1C8C 10000098 */ b .L800A1EF0_ovl1 /* 049EE0 800A1C90 E4440054 */ swc1 $f4, 0x54($v0) +.L800A1C94_ovl1: /* 049EE4 800A1C94 8C880000 */ lw $t0, ($a0) /* 049EE8 800A1C98 01034821 */ addu $t1, $t0, $v1 /* 049EEC 800A1C9C 8D2A0000 */ lw $t2, ($t1) @@ -194,8 +211,10 @@ glabel func_800A19EC /* 049F18 800A1CC8 C70A0038 */ lwc1 $f10, 0x38($t8) /* 049F1C 800A1CCC 10000088 */ b .L800A1EF0_ovl1 /* 049F20 800A1CD0 E44A0058 */ swc1 $f10, 0x58($v0) +.L800A1CD4_ovl1: /* 049F24 800A1CD4 10000086 */ b .L800A1EF0_ovl1 /* 049F28 800A1CD8 A4400054 */ sh $zero, 0x54($v0) +.L800A1CDC_ovl1: /* 049F2C 800A1CDC 8C990000 */ lw $t9, ($a0) /* 049F30 800A1CE0 03234021 */ addu $t0, $t9, $v1 /* 049F34 800A1CE4 8D050000 */ lw $a1, ($t0) @@ -229,6 +248,7 @@ glabel func_800A19EC /* 049F9C 800A1D4C C5E80038 */ lwc1 $f8, 0x38($t7) /* 049FA0 800A1D50 10000067 */ b .L800A1EF0_ovl1 /* 049FA4 800A1D54 E4480058 */ swc1 $f8, 0x58($v0) +.L800A1D58_ovl1: /* 049FA8 800A1D58 8C8B0000 */ lw $t3, ($a0) /* 049FAC 800A1D5C 0163C021 */ addu $t8, $t3, $v1 /* 049FB0 800A1D60 8F190000 */ lw $t9, ($t8) @@ -286,6 +306,7 @@ glabel func_800A19EC /* 04A078 800A1E28 35EB0004 */ ori $t3, $t7, 4 /* 04A07C 800A1E2C 10000030 */ b .L800A1EF0_ovl1 /* 04A080 800A1E30 A44B0074 */ sh $t3, 0x74($v0) +.L800A1E34_ovl1: /* 04A084 800A1E34 C6000020 */ lwc1 $f0, 0x20($s0) /* 04A088 800A1E38 C6020024 */ lwc1 $f2, 0x24($s0) /* 04A08C 800A1E3C C60E0028 */ lwc1 $f14, 0x28($s0) diff --git a/data/ovl1/ovl1_1_rodata.c b/data/ovl1/ovl1_1_rodata.c index cb0179dd..a7375492 100644 --- a/data/ovl1/ovl1_1_rodata.c +++ b/data/ovl1/ovl1_1_rodata.c @@ -475,28 +475,28 @@ f32 D_800D5A08 = 2 * M_PI; f32 D_800D5A0C = 2 * M_PI; -f32 D_800D5A10 = 2 * M_PI; +// f32 D_800D5A10 = 2 * M_PI; -f32 D_800D5A14 = M_PI / 2.0f; +// f32 D_800D5A14 = M_PI / 2.0f; -u32 D_800D5A18 = 0x800A1C2C; +// u32 D_800D5A18 = 0x800A1C2C; -u32 D_800D5A1C = 0x800A1C94; +// u32 D_800D5A1C = 0x800A1C94; -u32 D_800D5A20 = 0x800A1CD4; +// u32 D_800D5A20 = 0x800A1CD4; -u32 D_800D5A24 = 0x800A1C2C; +// u32 D_800D5A24 = 0x800A1C2C; -u32 D_800D5A28 = 0x800A1C2C; +// u32 D_800D5A28 = 0x800A1C2C; -u32 D_800D5A2C = 0x800A1D58; +// u32 D_800D5A2C = 0x800A1D58; -u32 D_800D5A30 = 0x800A1CDC; +// u32 D_800D5A30 = 0x800A1CDC; -u32 D_800D5A34 = 0x800A1CDC; +// u32 D_800D5A34 = 0x800A1CDC; -u32 D_800D5A38 = 0x800A1E34; +// u32 D_800D5A38 = 0x800A1E34; -f32 D_800D5A3C = 2 * M_PI; +// f32 D_800D5A3C = 2 * M_PI; diff --git a/include/unk_structs/D_800D6A08.h b/include/unk_structs/D_800D6A08.h new file mode 100644 index 00000000..db3f53fc --- /dev/null +++ b/include/unk_structs/D_800D6A08.h @@ -0,0 +1,38 @@ +#ifndef _D_800D6A08_H +#define _D_800D6A08_H + +struct UnkStruct800D6A08 { + struct UnkStruct800D6A08 *next; + u16 unk4; + u16 unk6; + u32 unk8; + u32 unkC; + + u32 unk10; + u32 unk14; + u32 unk18; + u32 unk1C; + + u32 unk20; + u32 unk24; + u32 unk28; + u32 unk2C; + + u32 unk30; + u32 unk34; + u32 unk38; + u32 unk3C; + + u32 unk40; + u32 unk44; + u32 unk48; + u32 unk4C; +}; + + +extern struct UnkStruct800D6A08 *D_800D6A08; +extern struct UnkStruct800D6A08 *D_800D6A0C; +extern struct UnkStruct800D6A08 *D_800D6AF0; + + +#endif diff --git a/src/ovl1/ovl1.c b/src/ovl1/ovl1.c index 2711eec9..c9bcca1b 100644 --- a/src/ovl1/ovl1.c +++ b/src/ovl1/ovl1.c @@ -1,6 +1,7 @@ #include #include +#include "unk_structs/D_800D6A08.h" extern s32 D_800D6AE4; extern s16 D_800D6AEA; @@ -1087,35 +1088,26 @@ the instruction, which has a name starting with "jtbl". GLOBAL_ASM("asm/non_matchings/ovl1/ovl1/func_800A09AC.s") #endif +extern u16 D_800D6AE2; +extern u16 D_800BE3E8, D_800D6AE8; #ifdef MIPS_TO_C -//generated by mips_to_c commit e0e006e8858ba357d1dcb4dc64f038b7df278aa6 -void *func_800A194C(void) { - s32 temp_v0; - u16 temp_t4; - u16 temp_t7; - void *temp_v1; - - temp_v1 = D_800D6A08; - if (temp_v1 == 0) { +struct UnkStruct800D6A08 *func_800A194C(void) { + if (D_800D6A08 == 0) { return NULL; } - temp_t7 = D_800D6AE2 + 1; - temp_v0 = temp_t7 & 0xFFFF; - D_800D6AE2 = temp_t7; - if (D_800D6AE8 < temp_v0) { - D_800D6AE8 = temp_v0; + + if (D_800D6AE8 < ++D_800D6AE2) { + D_800D6AE8 = D_800D6AE2; } - D_800D6A08 = temp_v1->unk0; - temp_v1->unk0 = D_800D6A0C; - D_800D6A0C = temp_v1; + D_800D6A08 = D_800D6A08->next; + D_800D6A08->next = D_800D6A0C; + D_800D6A0C = D_800D6A08; if (D_800D6AF0 == 0) { - D_800D6AF0 = temp_v1; + D_800D6AF0 = D_800D6A08; } - temp_t4 = D_800BE3E8 + 1; - D_800BE3E8 = temp_t4; - temp_v1->unk4 = temp_t4; - temp_v1->unk4C = 0; - return temp_v1; + D_800D6A08->unk4 = ++D_800BE3E8; + D_800D6A08->unk4C = 0; + return D_800D6A08; } #else GLOBAL_ASM("asm/non_matchings/ovl1/ovl1/func_800A194C.s") @@ -1501,6 +1493,7 @@ loop_5: GLOBAL_ASM("asm/non_matchings/ovl1/ovl1/func_800A2440.s") #endif + #ifdef MIPS_TO_C //generated by mips_to_c commit e0e006e8858ba357d1dcb4dc64f038b7df278aa6 void *func_800A24C4(s32 arg0, s32 arg1) { @@ -1549,6 +1542,94 @@ GLOBAL_ASM("asm/non_matchings/ovl1/ovl1/func_800A24C4.s") #endif #ifdef MIPS_TO_C +void func_800A2550(void *arg0) { + f32 spA4; + f32 sp64; + f32 temp_f0; + f32 temp_f0_2; + f32 temp_f0_3; + f32 temp_f12; + f32 temp_f12_2; + f32 temp_f12_3; + f32 temp_f2; + f32 temp_f2_2; + f32 temp_f2_3; + s32 temp_v0; + u8 temp_t8; + void *temp_s0; + void *temp_s1; + void *temp_v0_2; + void *phi_s1; + void *phi_s1_2; + void *phi_s1_3; + + phi_s1 = arg0; + phi_s1_2 = arg0; + if (arg0->unk0 != 0x12) { + do { + temp_s1 = phi_s1 + 0x2C; + phi_s1 = temp_s1; + phi_s1_2 = temp_s1; + } while (phi_s1->unk2C != 0x12); + } + phi_s1_3 = phi_s1_2 + 0x2C; + if (phi_s1_2->unk4 != 0) { + func_8001C2E4_ovl1(&spA4, arg0->unk8, arg0->unkC, arg0->unk10, arg0->unk14, arg0->unk18, arg0->unk1C, arg0->unk20, arg0->unk24, arg0->unk28); + do { + temp_v0 = phi_s1_3->unk0; + temp_v0_2 = func_800A19EC((temp_v0 >> 0x10) & 0xF, temp_v0 & 0xFFFF); + temp_s0 = temp_v0_2; + if (temp_v0_2 != 0) { + func_8001C2E4_ovl1(&sp64, phi_s1_3->unk8, phi_s1_3->unkC, phi_s1_3->unk10, phi_s1_3->unk14, phi_s1_3->unk18, phi_s1_3->unk1C, phi_s1_3->unk20, phi_s1_3->unk24, phi_s1_3->unk28); + guMtxCatF(&sp64, &spA4, &sp64); + temp_f0 = temp_s0->unk20; + temp_f2 = temp_s0->unk24; + temp_s0->unk14 = sp94; + temp_f12 = temp_s0->unk28; + temp_t8 = temp_s0->unk9; + temp_s0->unk18 = sp98; + temp_s0->unk1C = sp9C; + temp_s0->unk20 = (sp84 * temp_f12) + ((sp64 * temp_f0) + (sp74 * temp_f2)); + temp_s0->unk24 = (sp88 * temp_f12) + ((sp68 * temp_f0) + (sp78 * temp_f2)); + temp_s0->unk28 = (sp8C * temp_f12) + ((sp6C * temp_f0) + (sp7C * temp_f2)); + switch (temp_t8) { + case 0: + case 2: + case 3: + case 4: + case 6: + case 7: + case 8: + temp_s0->unk38 = temp_s0->unk38 * sqrtf((sp84 * sp84) + ((sp64 * sp64) + (sp74 * sp74))); + break; + case 1: + temp_f0_2 = temp_s0->unk50; + temp_f2_2 = temp_s0->unk54; + temp_f12_2 = temp_s0->unk58; + temp_s0->unk50 = sp94 + ((sp64 * temp_f0_2) + (sp74 * temp_f2_2) + (sp84 * temp_f12_2)); + temp_s0->unk54 = sp98 + ((sp68 * temp_f0_2) + (sp78 * temp_f2_2) + (sp88 * temp_f12_2)); + temp_s0->unk58 = sp9C + ((sp6C * temp_f0_2) + (sp7C * temp_f2_2) + (sp8C * temp_f12_2)); + break; + case 5: + temp_f0_3 = temp_s0->unk50; + temp_f2_3 = temp_s0->unk60; + temp_f12_3 = temp_s0->unk70; + temp_s0->unk50 = sp64 * temp_f0_3; + temp_s0->unk54 = sp74 * temp_f2_3; + temp_s0->unk58 = sp84 * temp_f12_3; + temp_s0->unk5C = sp68 * temp_f0_3; + temp_s0->unk60 = sp78 * temp_f2_3; + temp_s0->unk64 = sp88 * temp_f12_3; + temp_s0->unk68 = sp6C * temp_f0_3; + temp_s0->unk6C = sp7C * temp_f2_3; + temp_s0->unk70 = sp8C * temp_f12_3; + break; + } + } + phi_s1_3 += 0x2C; + } while ((phi_s1_3->unk0 & 0x80000000) == 0); + } +} #else GLOBAL_ASM("asm/non_matchings/ovl1/ovl1/func_800A2550.s") diff --git a/undefined_syms.txt b/undefined_syms.txt index 09d4ca70..a9d32010 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -676,12 +676,6 @@ func_800A043C = 0x800A043C; D_800A09AC = 0x800A09AC; func_8001B4AC_ovl1 = 0x8001B4AC; func_8001B6E4_ovl1 = 0x8001B6E4; -func_800A0558 = 0x800A0558; -func_800A194C = 0x800A194C; -func_800A1F30 = 0x800A1F30; -func_800A2080 = 0x800A2080; -func_8000BE90 = 0x8000BE90; -func_800A28C0 = 0x800A28C0; func_80002B88_ovl1 = 0x80002B88; func_800208A0_ovl1 = 0x800208A0; func_80022A38_ovl1 = 0x80022A38;