From ee0c57f5b8b970b226384630c2a32eba57eedfa4 Mon Sep 17 00:00:00 2001 From: David Benepe Date: Wed, 9 Jun 2021 01:14:31 -0500 Subject: [PATCH] Added bss for unknown_066AA0 & part of unknown_06B2B0 --- .../unknown_066AA0/func_80065EA0.s | 4 +- .../unknown_066AA0/func_80067D3C.s | 4 +- .../unknown_066AA0/func_80068514.s | 8 +- .../unknown_066AA0/func_80068BF4.s | 4 +- .../unknown_066AA0/func_80069484.s | 4 +- .../unknown_066AA0/func_80069A40.s | 4 +- .../unknown_066AA0/func_8006A10C.s | 4 +- .../unknown_066AA0/func_8006A1C4.s | 12 +- .../unknown_066AA0/func_8006A434.s | 8 +- .../unknown_066AA0/func_8006A6B0.s | 60 +- bss.txt | 58 +- src/unknown_0667D0.c | 2 +- src/unknown_066AA0.c | 1925 +++++++++-------- src/unknown_06B2B0.c | 51 +- undefined_syms.txt | 61 - 15 files changed, 1053 insertions(+), 1156 deletions(-) diff --git a/asm/non_matchings/unknown_066AA0/func_80065EA0.s b/asm/non_matchings/unknown_066AA0/func_80065EA0.s index bbd88892..802fbf6c 100644 --- a/asm/non_matchings/unknown_066AA0/func_80065EA0.s +++ b/asm/non_matchings/unknown_066AA0/func_80065EA0.s @@ -96,10 +96,10 @@ glabel func_80065EA0 /* 066BF4 80065FF4 C426709C */ lwc1 $f6, %lo(D_800E709C)($at) /* 066BF8 80065FF8 3C013F80 */ li $at, 0x3F800000 # 1.000000 /* 066BFC 80065FFC 44814000 */ mtc1 $at, $f8 -/* 066C00 80066000 3C058012 */ lui $a1, %hi(D_80120D6C) # $a1, 0x8012 +/* 066C00 80066000 3C058012 */ lui $a1, %hi(D_80120D58+20) # $a1, 0x8012 /* 066C04 80066004 3C073FAA */ lui $a3, (0x3FAAAAAB >> 16) # lui $a3, 0x3faa /* 066C08 80066008 34E7AAAB */ ori $a3, (0x3FAAAAAB & 0xFFFF) # ori $a3, $a3, 0xaaab -/* 066C0C 8006600C 24A50D6C */ addiu $a1, %lo(D_80120D6C) # addiu $a1, $a1, 0xd6c +/* 066C0C 8006600C 24A50D6C */ addiu $a1, %lo(D_80120D58+20) # addiu $a1, $a1, 0xd6c /* 066C10 80066010 02002025 */ move $a0, $s0 /* 066C14 80066014 3C064270 */ lui $a2, 0x4270 /* 066C18 80066018 E7A40010 */ swc1 $f4, 0x10($sp) diff --git a/asm/non_matchings/unknown_066AA0/func_80067D3C.s b/asm/non_matchings/unknown_066AA0/func_80067D3C.s index 07431a5c..8166b733 100644 --- a/asm/non_matchings/unknown_066AA0/func_80067D3C.s +++ b/asm/non_matchings/unknown_066AA0/func_80067D3C.s @@ -6,9 +6,9 @@ glabel func_80067D3C /* 06894C 80067D4C 3C0FB400 */ lui $t7, 0xb400 /* 068950 80067D50 246E0008 */ addiu $t6, $v1, 8 /* 068954 80067D54 AC8E0000 */ sw $t6, ($a0) -/* 068958 80067D58 3C188012 */ lui $t8, %hi(D_80120D6C) # $t8, 0x8012 +/* 068958 80067D58 3C188012 */ lui $t8, %hi(D_80120D58+20) # $t8, 0x8012 /* 06895C 80067D5C AC6F0000 */ sw $t7, ($v1) -/* 068960 80067D60 97180D6C */ lhu $t8, %lo(D_80120D6C)($t8) +/* 068960 80067D60 97180D6C */ lhu $t8, %lo(D_80120D58+20)($t8) /* 068964 80067D64 3C068012 */ lui $a2, %hi(D_80120CE4) # $a2, 0x8012 /* 068968 80067D68 AC780004 */ sw $t8, 4($v1) /* 06896C 80067D6C 24C60CE4 */ addiu $a2, %lo(D_80120CE4) # addiu $a2, $a2, 0xce4 diff --git a/asm/non_matchings/unknown_066AA0/func_80068514.s b/asm/non_matchings/unknown_066AA0/func_80068514.s index d35cf94e..9607f8ad 100644 --- a/asm/non_matchings/unknown_066AA0/func_80068514.s +++ b/asm/non_matchings/unknown_066AA0/func_80068514.s @@ -290,12 +290,12 @@ glabel func_80068514 /* 069584 80068984 15E0000D */ bnez $t7, .L800689BC /* 069588 80068988 3C198012 */ lui $t9, %hi(D_80120CE4) # $t9, 0x8012 /* 06958C 8006898C 8F390CE4 */ lw $t9, %lo(D_80120CE4)($t9) -/* 069590 80068990 3C0B8012 */ lui $t3, %hi(D_80120AC4) # $t3, 0x8012 +/* 069590 80068990 3C0B8012 */ lui $t3, %hi(D_80120AC0+4) # $t3, 0x8012 /* 069594 80068994 00195100 */ sll $t2, $t9, 4 /* 069598 80068998 01595021 */ addu $t2, $t2, $t9 /* 06959C 8006899C 000A5080 */ sll $t2, $t2, 2 /* 0695A0 800689A0 016A5821 */ addu $t3, $t3, $t2 -/* 0695A4 800689A4 856B0AC4 */ lh $t3, %lo(D_80120AC4)($t3) +/* 0695A4 800689A4 856B0AC4 */ lh $t3, %lo(D_80120AC0+4)($t3) /* 0695A8 800689A8 860C0004 */ lh $t4, 4($s0) /* 0695AC 800689AC 00000000 */ nop /* 0695B0 800689B0 016C6821 */ addu $t5, $t3, $t4 @@ -304,12 +304,12 @@ glabel func_80068514 .L800689BC: /* 0695BC 800689BC 3C0E8012 */ lui $t6, %hi(D_80120CE4) # $t6, 0x8012 /* 0695C0 800689C0 8DCE0CE4 */ lw $t6, %lo(D_80120CE4)($t6) -/* 0695C4 800689C4 3C0F8012 */ lui $t7, %hi(D_80120BD4) # $t7, 0x8012 +/* 0695C4 800689C4 3C0F8012 */ lui $t7, %hi(D_80120AC0+276) # $t7, 0x8012 /* 0695C8 800689C8 000EC100 */ sll $t8, $t6, 4 /* 0695CC 800689CC 030EC021 */ addu $t8, $t8, $t6 /* 0695D0 800689D0 0018C080 */ sll $t8, $t8, 2 /* 0695D4 800689D4 01F87821 */ addu $t7, $t7, $t8 -/* 0695D8 800689D8 85EF0BD4 */ lh $t7, %lo(D_80120BD4)($t7) +/* 0695D8 800689D8 85EF0BD4 */ lh $t7, %lo(D_80120AC0+276)($t7) /* 0695DC 800689DC 86190004 */ lh $t9, 4($s0) /* 0695E0 800689E0 00000000 */ nop /* 0695E4 800689E4 01F95021 */ addu $t2, $t7, $t9 diff --git a/asm/non_matchings/unknown_066AA0/func_80068BF4.s b/asm/non_matchings/unknown_066AA0/func_80068BF4.s index 1d16b73f..6ce0708b 100644 --- a/asm/non_matchings/unknown_066AA0/func_80068BF4.s +++ b/asm/non_matchings/unknown_066AA0/func_80068BF4.s @@ -72,7 +72,7 @@ glabel func_80068BF4 /* 06990C 80068D0C 25F80001 */ addiu $t8, $t7, 1 /* 069910 80068D10 AE980000 */ sw $t8, ($s4) /* 069914 80068D14 84F90000 */ lh $t9, ($a3) -/* 069918 80068D18 3C0E8012 */ lui $t6, %hi(D_80120AC4) # $t6, 0x8012 +/* 069918 80068D18 3C0E8012 */ lui $t6, %hi(D_80120AC0+4) # $t6, 0x8012 /* 06991C 80068D1C 00194823 */ negu $t1, $t9 /* 069920 80068D20 A6490000 */ sh $t1, ($s2) /* 069924 80068D24 84EA0002 */ lh $t2, 2($a3) @@ -85,7 +85,7 @@ glabel func_80068BF4 /* 069940 80068D40 01AC6821 */ addu $t5, $t5, $t4 /* 069944 80068D44 000D6880 */ sll $t5, $t5, 2 /* 069948 80068D48 01CD7021 */ addu $t6, $t6, $t5 -/* 06994C 80068D4C 85CE0AC4 */ lh $t6, %lo(D_80120AC4)($t6) +/* 06994C 80068D4C 85CE0AC4 */ lh $t6, %lo(D_80120AC0+4)($t6) /* 069950 80068D50 3C198012 */ lui $t9, %hi(D_80120D15) # $t9, 0x8012 /* 069954 80068D54 01CFC021 */ addu $t8, $t6, $t7 /* 069958 80068D58 A6580004 */ sh $t8, 4($s2) diff --git a/asm/non_matchings/unknown_066AA0/func_80069484.s b/asm/non_matchings/unknown_066AA0/func_80069484.s index 1cbe6152..e421c4ac 100644 --- a/asm/non_matchings/unknown_066AA0/func_80069484.s +++ b/asm/non_matchings/unknown_066AA0/func_80069484.s @@ -48,10 +48,10 @@ glabel func_80069484 /* 06A134 80069534 3C088012 */ lui $t0, %hi(D_80120D1C) # $t0, 0x8012 /* 06A138 80069538 25080D1C */ addiu $t0, %lo(D_80120D1C) # addiu $t0, $t0, 0xd1c /* 06A13C 8006953C 8D190000 */ lw $t9, ($t0) -/* 06A140 80069540 3C048012 */ lui $a0, %hi(D_80120D74) # $a0, 0x8012 +/* 06A140 80069540 3C048012 */ lui $a0, %hi(D_80120D70+4) # $a0, 0x8012 /* 06A144 80069544 00195880 */ sll $t3, $t9, 2 /* 06A148 80069548 008B2021 */ addu $a0, $a0, $t3 -/* 06A14C 8006954C 8C840D74 */ lw $a0, %lo(D_80120D74)($a0) +/* 06A14C 8006954C 8C840D74 */ lw $a0, %lo(D_80120D70+4)($a0) /* 06A150 80069550 3C058012 */ lui $a1, %hi(D_80120F20) # $a1, 0x8012 /* 06A154 80069554 3C068012 */ lui $a2, %hi(D_801210A0) # $a2, 0x8012 /* 06A158 80069558 24C610A0 */ addiu $a2, %lo(D_801210A0) # addiu $a2, $a2, 0x10a0 diff --git a/asm/non_matchings/unknown_066AA0/func_80069A40.s b/asm/non_matchings/unknown_066AA0/func_80069A40.s index ca04bd71..8b94d8fa 100644 --- a/asm/non_matchings/unknown_066AA0/func_80069A40.s +++ b/asm/non_matchings/unknown_066AA0/func_80069A40.s @@ -73,9 +73,9 @@ glabel func_80069A40 /* 06A750 80069B50 00194100 */ sll $t0, $t9, 4 /* 06A754 80069B54 01194021 */ addu $t0, $t0, $t9 /* 06A758 80069B58 00084080 */ sll $t0, $t0, 2 -/* 06A75C 80069B5C 3C018012 */ lui $at, %hi(D_80120AF4) # $at, 0x8012 +/* 06A75C 80069B5C 3C018012 */ lui $at, %hi(D_80120AC0+52) # $at, 0x8012 /* 06A760 80069B60 00280821 */ addu $at, $at, $t0 -/* 06A764 80069B64 A4220AF4 */ sh $v0, %lo(D_80120AF4)($at) +/* 06A764 80069B64 A4220AF4 */ sh $v0, %lo(D_80120AC0+52)($at) /* 06A768 80069B68 03E00008 */ jr $ra /* 06A76C 80069B6C 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/asm/non_matchings/unknown_066AA0/func_8006A10C.s b/asm/non_matchings/unknown_066AA0/func_8006A10C.s index 64615811..0f018759 100644 --- a/asm/non_matchings/unknown_066AA0/func_8006A10C.s +++ b/asm/non_matchings/unknown_066AA0/func_8006A10C.s @@ -30,8 +30,8 @@ glabel func_8006A10C /* 06AD7C 8006A17C 304E0001 */ andi $t6, $v0, 1 /* 06AD80 8006A180 11C00009 */ beqz $t6, .L8006A1A8 /* 06AD84 8006A184 AC600000 */ sw $zero, ($v1) -/* 06AD88 8006A188 3C0F8012 */ lui $t7, %hi(D_80121103) # $t7, 0x8012 -/* 06AD8C 8006A18C 91EF1103 */ lbu $t7, %lo(D_80121103)($t7) +/* 06AD88 8006A188 3C0F8012 */ lui $t7, %hi(D_80121100+3) # $t7, 0x8012 +/* 06AD8C 8006A18C 91EF1103 */ lbu $t7, %lo(D_80121100+3)($t7) /* 06AD90 8006A190 00000000 */ nop /* 06AD94 8006A194 31F80008 */ andi $t8, $t7, 8 /* 06AD98 8006A198 17000004 */ bnez $t8, .L8006A1AC diff --git a/asm/non_matchings/unknown_066AA0/func_8006A1C4.s b/asm/non_matchings/unknown_066AA0/func_8006A1C4.s index 1f9b2ed8..41925316 100644 --- a/asm/non_matchings/unknown_066AA0/func_8006A1C4.s +++ b/asm/non_matchings/unknown_066AA0/func_8006A1C4.s @@ -12,12 +12,12 @@ glabel func_8006A1C4 /* 06ADEC 8006A1EC 0C0322EC */ jal osRecvMesg /* 06ADF0 8006A1F0 00003025 */ move $a2, $zero /* 06ADF4 8006A1F4 1440005D */ bnez $v0, .L8006A36C -/* 06ADF8 8006A1F8 3C068012 */ lui $a2, %hi(D_80121128) # $a2, 0x8012 +/* 06ADF8 8006A1F8 3C068012 */ lui $a2, %hi(D_80121110+24) # $a2, 0x8012 /* 06ADFC 8006A1FC 3C028012 */ lui $v0, %hi(D_80121110) # $v0, 0x8012 -/* 06AE00 8006A200 3C038012 */ lui $v1, %hi(D_80121128) # $v1, 0x8012 -/* 06AE04 8006A204 24631128 */ addiu $v1, %lo(D_80121128) # addiu $v1, $v1, 0x1128 +/* 06AE00 8006A200 3C038012 */ lui $v1, %hi(D_80121110+24) # $v1, 0x8012 +/* 06AE04 8006A204 24631128 */ addiu $v1, %lo(D_80121110+24) # addiu $v1, $v1, 0x1128 /* 06AE08 8006A208 24421110 */ addiu $v0, %lo(D_80121110) # addiu $v0, $v0, 0x1110 -/* 06AE0C 8006A20C 24C61128 */ addiu $a2, %lo(D_80121128) # addiu $a2, $a2, 0x1128 +/* 06AE0C 8006A20C 24C61128 */ addiu $a2, %lo(D_80121110+24) # addiu $a2, $a2, 0x1128 .L8006A210: /* 06AE10 8006A210 88410000 */ lwl $at, ($v0) /* 06AE14 8006A214 98410003 */ lwr $at, 3($v0) @@ -119,7 +119,7 @@ glabel func_8006A1C4 .L8006A36C: /* 06AF6C 8006A36C 3C0A800E */ lui $t2, %hi(D_800DD300) # $t2, 0x800e /* 06AF70 8006A370 3C09800E */ lui $t1, %hi(D_800DD304) # $t1, 0x800e -/* 06AF74 8006A374 3C068012 */ lui $a2, %hi(D_80121128) # $a2, 0x8012 +/* 06AF74 8006A374 3C068012 */ lui $a2, %hi(D_80121110+24) # $a2, 0x8012 /* 06AF78 8006A378 3C028012 */ lui $v0, %hi(D_80121110) # $v0, 0x8012 /* 06AF7C 8006A37C 3C088012 */ lui $t0, %hi(D_80121140) # $t0, 0x8012 /* 06AF80 8006A380 3C078012 */ lui $a3, %hi(D_80121148) # $a3, 0x8012 @@ -130,7 +130,7 @@ glabel func_8006A1C4 /* 06AF94 8006A394 24E71148 */ addiu $a3, %lo(D_80121148) # addiu $a3, $a3, 0x1148 /* 06AF98 8006A398 25081140 */ addiu $t0, %lo(D_80121140) # addiu $t0, $t0, 0x1140 /* 06AF9C 8006A39C 24421110 */ addiu $v0, %lo(D_80121110) # addiu $v0, $v0, 0x1110 -/* 06AFA0 8006A3A0 24C61128 */ addiu $a2, %lo(D_80121128) # addiu $a2, $a2, 0x1128 +/* 06AFA0 8006A3A0 24C61128 */ addiu $a2, %lo(D_80121110+24) # addiu $a2, $a2, 0x1128 .L8006A3A4: /* 06AFA4 8006A3A4 11400002 */ beqz $t2, .L8006A3B0 /* 06AFA8 8006A3A8 00000000 */ nop diff --git a/asm/non_matchings/unknown_066AA0/func_8006A434.s b/asm/non_matchings/unknown_066AA0/func_8006A434.s index 89e03eee..ba2fef6a 100644 --- a/asm/non_matchings/unknown_066AA0/func_8006A434.s +++ b/asm/non_matchings/unknown_066AA0/func_8006A434.s @@ -1,11 +1,11 @@ glabel func_8006A434 -/* 06B034 8006A434 3C018012 */ lui $at, %hi(D_80121151) # $at, 0x8012 +/* 06B034 8006A434 3C018012 */ lui $at, %hi(D_80121150+1) # $at, 0x8012 /* 06B038 8006A438 240E0001 */ li $t6, 1 /* 06B03C 8006A43C 240F0002 */ li $t7, 2 /* 06B040 8006A440 24180003 */ li $t8, 3 -/* 06B044 8006A444 A0381153 */ sb $t8, %lo(D_80121153)($at) -/* 06B048 8006A448 A02F1152 */ sb $t7, %lo(D_80121152)($at) -/* 06B04C 8006A44C A02E1151 */ sb $t6, %lo(D_80121151)($at) +/* 06B044 8006A444 A0381153 */ sb $t8, %lo(D_80121150+3)($at) +/* 06B048 8006A448 A02F1152 */ sb $t7, %lo(D_80121150+2)($at) +/* 06B04C 8006A44C A02E1151 */ sb $t6, %lo(D_80121150+1)($at) /* 06B050 8006A450 03E00008 */ jr $ra /* 06B054 8006A454 A0201150 */ sb $zero, 0x1150($at) diff --git a/asm/non_matchings/unknown_066AA0/func_8006A6B0.s b/asm/non_matchings/unknown_066AA0/func_8006A6B0.s index a2e42e4b..fa2e8561 100644 --- a/asm/non_matchings/unknown_066AA0/func_8006A6B0.s +++ b/asm/non_matchings/unknown_066AA0/func_8006A6B0.s @@ -58,12 +58,12 @@ glabel func_8006A6B0 /* 06B384 8006A784 254A1170 */ addiu $t2, %lo(D_80121170) # addiu $t2, $t2, 0x1170 /* 06B388 8006A788 8FB90044 */ lw $t9, 0x44($sp) /* 06B38C 8006A78C 8D4C0000 */ lw $t4, ($t2) -/* 06B390 8006A790 3C088012 */ lui $t0, %hi(D_8012117C) # $t0, 0x8012 +/* 06B390 8006A790 3C088012 */ lui $t0, %hi(D_80121178+4) # $t0, 0x8012 /* 06B394 8006A794 3C098012 */ lui $t1, %hi(D_80121174) # $t1, 0x8012 /* 06B398 8006A798 3C108012 */ lui $s0, %hi(D_80121168) # $s0, 0x8012 /* 06B39C 8006A79C 26101168 */ addiu $s0, %lo(D_80121168) # addiu $s0, $s0, 0x1168 /* 06B3A0 8006A7A0 25291174 */ addiu $t1, %lo(D_80121174) # addiu $t1, $t1, 0x1174 -/* 06B3A4 8006A7A4 2508117C */ addiu $t0, %lo(D_8012117C) # addiu $t0, $t0, 0x117c +/* 06B3A4 8006A7A4 2508117C */ addiu $t0, %lo(D_80121178+4) # addiu $t0, $t0, 0x117c /* 06B3A8 8006A7A8 240BFFFF */ li $t3, -1 /* 06B3AC 8006A7AC AD020000 */ sw $v0, ($t0) /* 06B3B0 8006A7B0 AD2B0000 */ sw $t3, ($t1) @@ -87,12 +87,12 @@ glabel func_8006A6B0 /* 06B3F4 8006A7F4 8D2F0000 */ lw $t7, ($t1) /* 06B3F8 8006A7F8 80A40000 */ lb $a0, ($a1) /* 06B3FC 8006A7FC 8FA3002C */ lw $v1, 0x2c($sp) -/* 06B400 8006A800 3C088012 */ lui $t0, %hi(D_8012117C) # $t0, 0x8012 +/* 06B400 8006A800 3C088012 */ lui $t0, %hi(D_80121178+4) # $t0, 0x8012 /* 06B404 8006A804 3C0A8012 */ lui $t2, %hi(D_80121170) # $t2, 0x8012 /* 06B408 8006A808 01E4082A */ slt $at, $t7, $a0 /* 06B40C 8006A80C 254A1170 */ addiu $t2, %lo(D_80121170) # addiu $t2, $t2, 0x1170 /* 06B410 8006A810 10200002 */ beqz $at, .L8006A81C -/* 06B414 8006A814 2508117C */ addiu $t0, %lo(D_8012117C) # addiu $t0, $t0, 0x117c +/* 06B414 8006A814 2508117C */ addiu $t0, %lo(D_80121178+4) # addiu $t0, $t0, 0x117c /* 06B418 8006A818 AD240000 */ sw $a0, ($t1) .L8006A81C: /* 06B41C 8006A81C 80A4004C */ lb $a0, 0x4c($a1) @@ -159,10 +159,10 @@ glabel func_8006A6B0 /* 06B508 8006A908 8D2F0000 */ lw $t7, ($t1) /* 06B50C 8006A90C 3C048012 */ lui $a0, %hi(D_80121178) # $a0, 0x8012 /* 06B510 8006A910 24841178 */ addiu $a0, %lo(D_80121178) # addiu $a0, $a0, 0x1178 -/* 06B514 8006A914 3C088012 */ lui $t0, %hi(D_8012117C) # $t0, 0x8012 +/* 06B514 8006A914 3C088012 */ lui $t0, %hi(D_80121178+4) # $t0, 0x8012 /* 06B518 8006A918 3C0A8012 */ lui $t2, %hi(D_80121170) # $t2, 0x8012 /* 06B51C 8006A91C 254A1170 */ addiu $t2, %lo(D_80121170) # addiu $t2, $t2, 0x1170 -/* 06B520 8006A920 2508117C */ addiu $t0, %lo(D_8012117C) # addiu $t0, $t0, 0x117c +/* 06B520 8006A920 2508117C */ addiu $t0, %lo(D_80121178+4) # addiu $t0, $t0, 0x117c /* 06B524 8006A924 AC820000 */ sw $v0, ($a0) /* 06B528 8006A928 19E0000B */ blez $t7, .L8006A958 /* 06B52C 8006A92C 240BFFFF */ li $t3, -1 @@ -349,7 +349,7 @@ glabel func_8006A6B0 .L8006ABC4: /* 06B7C4 8006ABC4 8DCE1170 */ lw $t6, %lo(D_80121170)($t6) -/* 06B7C8 8006ABC8 3C0F8012 */ lui $t7, %hi(D_8012117C) # $t7, 0x8012 +/* 06B7C8 8006ABC8 3C0F8012 */ lui $t7, %hi(D_80121178+4) # $t7, 0x8012 /* 06B7CC 8006ABCC 008E082A */ slt $at, $a0, $t6 /* 06B7D0 8006ABD0 14200003 */ bnez $at, .L8006ABE0 /* 06B7D4 8006ABD4 0004C080 */ sll $t8, $a0, 2 @@ -357,7 +357,7 @@ glabel func_8006A6B0 /* 06B7DC 8006ABDC 24020E10 */ li $v0, 3600 .L8006ABE0: -/* 06B7E0 8006ABE0 8DEF117C */ lw $t7, %lo(D_8012117C)($t7) +/* 06B7E0 8006ABE0 8DEF117C */ lw $t7, %lo(D_80121178+4)($t7) /* 06B7E4 8006ABE4 0304C023 */ subu $t8, $t8, $a0 /* 06B7E8 8006ABE8 0018C040 */ sll $t8, $t8, 1 /* 06B7EC 8006ABEC 01F8C821 */ addu $t9, $t7, $t8 @@ -386,11 +386,11 @@ glabel func_8006A6B0 /* 06B83C 8006AC3C 00000000 */ nop /* 06B840 8006AC40 3C028012 */ lui $v0, %hi(D_80121170) # $v0, 0x8012 /* 06B844 8006AC44 8C421170 */ lw $v0, %lo(D_80121170)($v0) -/* 06B848 8006AC48 3C088012 */ lui $t0, %hi(D_8012117C) # $t0, 0x8012 +/* 06B848 8006AC48 3C088012 */ lui $t0, %hi(D_80121178+4) # $t0, 0x8012 /* 06B84C 8006AC4C 0082082A */ slt $at, $a0, $v0 /* 06B850 8006AC50 10200073 */ beqz $at, .L8006AE20 /* 06B854 8006AC54 00044880 */ sll $t1, $a0, 2 -/* 06B858 8006AC58 8D08117C */ lw $t0, %lo(D_8012117C)($t0) +/* 06B858 8006AC58 8D08117C */ lw $t0, %lo(D_80121178+4)($t0) /* 06B85C 8006AC5C 01244823 */ subu $t1, $t1, $a0 /* 06B860 8006AC60 00094840 */ sll $t1, $t1, 1 /* 06B864 8006AC64 01091821 */ addu $v1, $t0, $t1 @@ -413,11 +413,11 @@ glabel func_8006A6B0 /* 06B898 8006AC98 14A20016 */ bne $a1, $v0, .L8006ACF4 /* 06B89C 8006AC9C 3C028012 */ lui $v0, %hi(D_80121170) # $v0, 0x8012 /* 06B8A0 8006ACA0 8C421170 */ lw $v0, %lo(D_80121170)($v0) -/* 06B8A4 8006ACA4 3C0B8012 */ lui $t3, %hi(D_8012117C) # $t3, 0x8012 +/* 06B8A4 8006ACA4 3C0B8012 */ lui $t3, %hi(D_80121178+4) # $t3, 0x8012 /* 06B8A8 8006ACA8 0082082A */ slt $at, $a0, $v0 /* 06B8AC 8006ACAC 1020005C */ beqz $at, .L8006AE20 /* 06B8B0 8006ACB0 00046080 */ sll $t4, $a0, 2 -/* 06B8B4 8006ACB4 8D6B117C */ lw $t3, %lo(D_8012117C)($t3) +/* 06B8B4 8006ACB4 8D6B117C */ lw $t3, %lo(D_80121178+4)($t3) /* 06B8B8 8006ACB8 01846023 */ subu $t4, $t4, $a0 /* 06B8BC 8006ACBC 000C6040 */ sll $t4, $t4, 1 /* 06B8C0 8006ACC0 016C1821 */ addu $v1, $t3, $t4 @@ -439,11 +439,11 @@ glabel func_8006A6B0 .L8006ACF4: /* 06B8F4 8006ACF4 3C028012 */ lui $v0, %hi(D_80121170) # $v0, 0x8012 /* 06B8F8 8006ACF8 8C421170 */ lw $v0, %lo(D_80121170)($v0) -/* 06B8FC 8006ACFC 3C0E8012 */ lui $t6, %hi(D_8012117C) # $t6, 0x8012 +/* 06B8FC 8006ACFC 3C0E8012 */ lui $t6, %hi(D_80121178+4) # $t6, 0x8012 /* 06B900 8006AD00 0082082A */ slt $at, $a0, $v0 /* 06B904 8006AD04 10200046 */ beqz $at, .L8006AE20 /* 06B908 8006AD08 00047880 */ sll $t7, $a0, 2 -/* 06B90C 8006AD0C 8DCE117C */ lw $t6, %lo(D_8012117C)($t6) +/* 06B90C 8006AD0C 8DCE117C */ lw $t6, %lo(D_80121178+4)($t6) /* 06B910 8006AD10 01E47823 */ subu $t7, $t7, $a0 /* 06B914 8006AD14 000F7840 */ sll $t7, $t7, 1 /* 06B918 8006AD18 01CF1821 */ addu $v1, $t6, $t7 @@ -470,11 +470,11 @@ glabel func_8006A6B0 /* 06B95C 8006AD5C 14C20017 */ bne $a2, $v0, .L8006ADBC /* 06B960 8006AD60 3C028012 */ lui $v0, %hi(D_80121170) # $v0, 0x8012 /* 06B964 8006AD64 8C421170 */ lw $v0, %lo(D_80121170)($v0) -/* 06B968 8006AD68 3C088012 */ lui $t0, %hi(D_8012117C) # $t0, 0x8012 +/* 06B968 8006AD68 3C088012 */ lui $t0, %hi(D_80121178+4) # $t0, 0x8012 /* 06B96C 8006AD6C 0082082A */ slt $at, $a0, $v0 /* 06B970 8006AD70 1020002B */ beqz $at, .L8006AE20 /* 06B974 8006AD74 00044880 */ sll $t1, $a0, 2 -/* 06B978 8006AD78 8D08117C */ lw $t0, %lo(D_8012117C)($t0) +/* 06B978 8006AD78 8D08117C */ lw $t0, %lo(D_80121178+4)($t0) /* 06B97C 8006AD7C 01244823 */ subu $t1, $t1, $a0 /* 06B980 8006AD80 00094840 */ sll $t1, $t1, 1 /* 06B984 8006AD84 01091821 */ addu $v1, $t0, $t1 @@ -497,11 +497,11 @@ glabel func_8006A6B0 .L8006ADBC: /* 06B9BC 8006ADBC 3C028012 */ lui $v0, %hi(D_80121170) # $v0, 0x8012 /* 06B9C0 8006ADC0 8C421170 */ lw $v0, %lo(D_80121170)($v0) -/* 06B9C4 8006ADC4 3C0C8012 */ lui $t4, %hi(D_8012117C) # $t4, 0x8012 +/* 06B9C4 8006ADC4 3C0C8012 */ lui $t4, %hi(D_80121178+4) # $t4, 0x8012 /* 06B9C8 8006ADC8 0082082A */ slt $at, $a0, $v0 /* 06B9CC 8006ADCC 10200014 */ beqz $at, .L8006AE20 /* 06B9D0 8006ADD0 00046880 */ sll $t5, $a0, 2 -/* 06B9D4 8006ADD4 8D8C117C */ lw $t4, %lo(D_8012117C)($t4) +/* 06B9D4 8006ADD4 8D8C117C */ lw $t4, %lo(D_80121178+4)($t4) /* 06B9D8 8006ADD8 01A46823 */ subu $t5, $t5, $a0 /* 06B9DC 8006ADDC 000D6840 */ sll $t5, $t5, 1 /* 06B9E0 8006ADE0 018D1821 */ addu $v1, $t4, $t5 @@ -548,9 +548,9 @@ glabel func_8006A6B0 /* 06BA68 8006AE68 14C20013 */ bne $a2, $v0, .L8006AEB8 /* 06BA6C 8006AE6C 00000000 */ nop /* 06BA70 8006AE70 04800066 */ bltz $a0, .L8006B00C -/* 06BA74 8006AE74 3C088012 */ lui $t0, %hi(D_8012117C) # $t0, 0x8012 +/* 06BA74 8006AE74 3C088012 */ lui $t0, %hi(D_80121178+4) # $t0, 0x8012 /* 06BA78 8006AE78 00044880 */ sll $t1, $a0, 2 -/* 06BA7C 8006AE7C 8D08117C */ lw $t0, %lo(D_8012117C)($t0) +/* 06BA7C 8006AE7C 8D08117C */ lw $t0, %lo(D_80121178+4)($t0) /* 06BA80 8006AE80 01244823 */ subu $t1, $t1, $a0 /* 06BA84 8006AE84 00094840 */ sll $t1, $t1, 1 /* 06BA88 8006AE88 01091021 */ addu $v0, $t0, $t1 @@ -572,9 +572,9 @@ glabel func_8006A6B0 /* 06BAB8 8006AEB8 14A20013 */ bne $a1, $v0, .L8006AF08 /* 06BABC 8006AEBC 00000000 */ nop /* 06BAC0 8006AEC0 04800052 */ bltz $a0, .L8006B00C -/* 06BAC4 8006AEC4 3C0B8012 */ lui $t3, %hi(D_8012117C) # $t3, 0x8012 +/* 06BAC4 8006AEC4 3C0B8012 */ lui $t3, %hi(D_80121178+4) # $t3, 0x8012 /* 06BAC8 8006AEC8 00046080 */ sll $t4, $a0, 2 -/* 06BACC 8006AECC 8D6B117C */ lw $t3, %lo(D_8012117C)($t3) +/* 06BACC 8006AECC 8D6B117C */ lw $t3, %lo(D_80121178+4)($t3) /* 06BAD0 8006AED0 01846023 */ subu $t4, $t4, $a0 /* 06BAD4 8006AED4 000C6040 */ sll $t4, $t4, 1 /* 06BAD8 8006AED8 016C1021 */ addu $v0, $t3, $t4 @@ -594,9 +594,9 @@ glabel func_8006A6B0 /* 06BB04 8006AF04 2402FFFF */ li $v0, -1 .L8006AF08: /* 06BB08 8006AF08 04800040 */ bltz $a0, .L8006B00C -/* 06BB0C 8006AF0C 3C0E8012 */ lui $t6, %hi(D_8012117C) # $t6, 0x8012 +/* 06BB0C 8006AF0C 3C0E8012 */ lui $t6, %hi(D_80121178+4) # $t6, 0x8012 /* 06BB10 8006AF10 00047880 */ sll $t7, $a0, 2 -/* 06BB14 8006AF14 8DCE117C */ lw $t6, %lo(D_8012117C)($t6) +/* 06BB14 8006AF14 8DCE117C */ lw $t6, %lo(D_80121178+4)($t6) /* 06BB18 8006AF18 01E47823 */ subu $t7, $t7, $a0 /* 06BB1C 8006AF1C 000F7840 */ sll $t7, $t7, 1 /* 06BB20 8006AF20 01CF1021 */ addu $v0, $t6, $t7 @@ -623,9 +623,9 @@ glabel func_8006A6B0 /* 06BB64 8006AF64 14C20014 */ bne $a2, $v0, .L8006AFB8 /* 06BB68 8006AF68 00000000 */ nop /* 06BB6C 8006AF6C 04800027 */ bltz $a0, .L8006B00C -/* 06BB70 8006AF70 3C088012 */ lui $t0, %hi(D_8012117C) # $t0, 0x8012 +/* 06BB70 8006AF70 3C088012 */ lui $t0, %hi(D_80121178+4) # $t0, 0x8012 /* 06BB74 8006AF74 00044880 */ sll $t1, $a0, 2 -/* 06BB78 8006AF78 8D08117C */ lw $t0, %lo(D_8012117C)($t0) +/* 06BB78 8006AF78 8D08117C */ lw $t0, %lo(D_80121178+4)($t0) /* 06BB7C 8006AF7C 01244823 */ subu $t1, $t1, $a0 /* 06BB80 8006AF80 00094840 */ sll $t1, $t1, 1 /* 06BB84 8006AF84 01091021 */ addu $v0, $t0, $t1 @@ -646,9 +646,9 @@ glabel func_8006A6B0 /* 06BBB4 8006AFB4 2402FFFF */ li $v0, -1 .L8006AFB8: /* 06BBB8 8006AFB8 04800014 */ bltz $a0, .L8006B00C -/* 06BBBC 8006AFBC 3C0C8012 */ lui $t4, %hi(D_8012117C) # $t4, 0x8012 +/* 06BBBC 8006AFBC 3C0C8012 */ lui $t4, %hi(D_80121178+4) # $t4, 0x8012 /* 06BBC0 8006AFC0 00046880 */ sll $t5, $a0, 2 -/* 06BBC4 8006AFC4 8D8C117C */ lw $t4, %lo(D_8012117C)($t4) +/* 06BBC4 8006AFC4 8D8C117C */ lw $t4, %lo(D_80121178+4)($t4) /* 06BBC8 8006AFC8 01A46823 */ subu $t5, $t5, $a0 /* 06BBCC 8006AFCC 000D6840 */ sll $t5, $t5, 1 /* 06BBD0 8006AFD0 018D1021 */ addu $v0, $t4, $t5 @@ -700,10 +700,10 @@ glabel func_8006A6B0 /* 06BC64 8006B064 000E2603 */ sra $a0, $t6, 0x18 /* 06BC68 8006B068 18A0000E */ blez $a1, .L8006B0A4 /* 06BC6C 8006B06C 00001825 */ move $v1, $zero -/* 06BC70 8006B070 3C068012 */ lui $a2, %hi(D_8012117C) # $a2, 0x8012 +/* 06BC70 8006B070 3C068012 */ lui $a2, %hi(D_80121178+4) # $a2, 0x8012 /* 06BC74 8006B074 00053880 */ sll $a3, $a1, 2 /* 06BC78 8006B078 00E53823 */ subu $a3, $a3, $a1 -/* 06BC7C 8006B07C 8CC6117C */ lw $a2, %lo(D_8012117C)($a2) +/* 06BC7C 8006B07C 8CC6117C */ lw $a2, %lo(D_80121178+4)($a2) /* 06BC80 8006B080 00073840 */ sll $a3, $a3, 1 /* 06BC84 8006B084 00001025 */ move $v0, $zero .L8006B088: diff --git a/bss.txt b/bss.txt index 4d9273df..d2152b1a 100644 --- a/bss.txt +++ b/bss.txt @@ -25,65 +25,9 @@ unknown_05F690 unknown_0667D0 unknown_066AA0 -D_80120AC0; -D_80120AC4; -D_80120AF4; -D_80120BD0; -D_80120BD4; -D_80120CE0; -D_80120CE4; -D_80120CE8; -D_80120CF0; -D_80120D08; -D_80120D0C; -D_80120D10; -D_80120D14; -D_80120D15; -D_80120D18; -D_80120D1C; -D_80120D20; -D_80120D28; -D_80120D40; -D_80120D58; -D_80120D6C; -D_80120D70; -D_80120D74; -D_80120D88; -D_80120DA0; -D_80120EE0; -D_80120F20; -D_80120F60; -D_80120FA0; -D_80120FE0; -D_80121020; -D_80121060; -D_801210A0; -D_801210E0; -D_801210F8; -D_801210FC; -D_80121100; -D_80121103; -D_80121110; -D_80121128; -D_80121140; -D_80121148; -D_80121150; -D_80121151; -D_80121152; -D_80121153; -D_80121160; -D_80121164; -D_80121168; -D_8012116C; -D_80121170; -D_80121174; -D_80121178; -D_8012117C; -D_80121180; -D_801211C0; - unknown_06B2B0 +D_801211C0; D_801211C8; D_801211F0; D_801211F8; diff --git a/src/unknown_0667D0.c b/src/unknown_0667D0.c index be88af19..e4aa8899 100644 --- a/src/unknown_0667D0.c +++ b/src/unknown_0667D0.c @@ -32,7 +32,7 @@ s32 D_8011F75C; OSThread *D_8011F760; // OSThread for thread 1 s32 D_8011F764; s32 D_8011F768[106]; -s32 *D_8011F910; +s32 *D_8011F910[1132]; /******************************/ diff --git a/src/unknown_066AA0.c b/src/unknown_066AA0.c index 9e6845bb..53590b5e 100644 --- a/src/unknown_066AA0.c +++ b/src/unknown_066AA0.c @@ -1,956 +1,969 @@ -/* The comment below is needed for this file to be picked up by generate_ld */ -/* RAM_POS: 0x80065EA0 */ - -#include "types.h" -#include "macros.h" -#include "structs.h" -#include "fast3d.h" - -extern u32 osTvType; - -/************ .rodata ************/ - -const char D_800E6F00[] = "Camera Error: Illegal mode!\n"; -const char D_800E6F20[] = "Camera Error: Illegal player no!\n"; -const char D_800E6F34[] = "cameraPushSprMtx: model stack overflow!!\n"; -const char D_800E6F70[] = "\nCam do 2D sprite called with NULL pointer!"; -const char D_800E6F9C[] = "CamDo2DSprite FrameNo Overflow !!!\n"; -const char D_800E6FC0[] = "cameraPushModelMtx: model stack overflow!!\n"; -const char D_800E6FEC[] = "camPushModelMtx: bsp stack overflow!!\n"; -const char D_800E7010[] = "camPopModelMtx: model stack negative overflow!!\n"; -const char D_800E7048[] = "camPopModelMtx: bsp stack negative overflow!!\n"; - -/*********************************/ - -/************ .data ************/ - -s32 D_800DD060 = 0; // Currently unknown, might be a different type. - -/* Size: 0x34 bytes. */ -typedef struct unk800DD064 { - s32 unk0; - s32 unk4; - s32 unk8; - s32 unkC; - s32 unk10; - s32 unk14; - s32 unk18; - s32 unk1C; - s32 unk20; - s32 unk24; - s32 unk28; - s32 unk2C; - s32 unk30; -} unk800DD064; - -unk800DD064 D_800DD064[4] = { - { - 0x00, 0x00, 0x140, 0xF0, - 0xA0, 0x78, 0x140, 0xF0, - 0x00, 0x00, 0x13F, 0xEF, 0x00 - }, - { - 0x00, 0x00, 0x140, 0xF0, - 0xA0, 0x78, 0x140, 0xF0, - 0x00, 0x00, 0x13F, 0xEF, 0x00 - }, - { - 0x00, 0x00, 0x140, 0xF0, - 0xA0, 0x78, 0x140, 0xF0, - 0x00, 0x00, 0x13F, 0xEF, 0x00 - }, - { - 0x00, 0x00, 0x140, 0xF0, - 0xA0, 0x78, 0x140, 0xF0, - 0x00, 0x00, 0x13F, 0xEF, 0x00 - } -}; - -// Not sure about the typing here -s16 D_800DD134[10] = { - 0, 0, 0, 0, - 0, -1, -1, 0, - 0, 0 -}; - -// Not sure about the typing here -u16 D_800DD148[160] = { - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0, - 0, 0, 0x01FF, 0 -}; - -f32 D_800DD288[6] = { - 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, -281.0f -}; - -f32 D_800DD2A0[6] = { - 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f -}; - -f32 D_800DD2B8[5] = { - 1.0f, 0.0f, 0.0f, 0.0f, 0.0f -}; - -f32 D_800DD2CC[11] = { - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 160.0f -}; - -u8 D_800DD2F8[8] = { - 0, 0, 0, 0, 0, 0, 0, 0 -}; - -s32 D_800DD300 = 0; // Currently unknown, might be a different type. - -s16 D_800DD304 = -1; - -/*******************************/ - -/* Size: 0x44 bytes */ -typedef struct unk80120AC0 { - s16 unk0; - s16 unk2; - s16 unk4; - u8 pad6[6]; - f32 x_position; - f32 y_position; - f32 z_position; - f32 pad18; - f32 unk1C; - f32 pad20; - f32 unk24; - f32 unk28; - f32 unk2C; - f32 unk30; - s16 unk34; - s16 pad36; - s16 unk38; - s8 pad3A; - s8 unk3B; - u8 pad3C[8]; -} unk80120AC0; - -extern unk80120AC0 D_80120AC0[4]; // Unknown number of entries. -extern unk80120AC0 D_80120AFB[4]; // Unknown number of entries. -extern unk80120AC0 D_80120BD0[4]; // Unknown number of entries. -extern s32 D_80120CE0; -extern s32 D_80120CE4; -extern s32 D_80120CE8; -extern s32 D_80120D08; -extern s32 D_80120D0C; -extern f32 D_80120D10; -extern s8 D_80120D14; -extern u8 D_80120D15; -extern s32 D_80120D18; -extern s32 D_80120D1C; -extern s32 D_80120D6C; -extern s32 D_80120D70[6]; -extern s32 D_80120D88[6]; // Unknown number of entries. -extern s32 D_80120EE0; -extern s32 D_80120F20; -extern s32 D_80120F60; -extern s32 D_80120FE0; -extern s32 D_80120FA0; -extern s32 D_80121060; -extern s32 D_801210A0; -extern s32 D_801210E0; - -/* Size: 5 bytes */ -typedef struct unk80121110 { - u16 unk0; - s8 unk2; - s8 unk3; - s8 unk4; -} unk80121110; -extern unk80121110 D_80121110[2]; // Unknown number of entries -extern u16 D_80121140[2]; // Unknown number of entries. -extern u16 D_80121148[2]; // Unknown number of entries. -extern u8 D_80121150[8]; // Unknown number of entries. - -extern s32 D_A4000000; -extern s32 SP_IMEM; - -unk80120AC0 *func_80069D20(void); -void func_800014BC(f32 arg0); -s8* func_8001E29C(s32 arg0); -s32 func_8006A624(s8 arg0); -void func_8006F64C(s32*, f32, f32, f32, f32*, f32*, f32*); -void guPerspectiveF(s32*, s32*, f32, f32, f32, f32, f32); -void func_8006F870(s32*, s32*); -s16 func_80029F18(f32, f32, f32); -void func_8006A50C(void); -void func_800665E8(s32 arg0); -void func_8006CB58(s32 arg0, s32 arg1, s32 arg2, s32 arg3); -void func_8006C164(void); -void func_8000E194(void); -f32 sqrtf(f32); -void osSetTime(u64); -void func_8001D5E0(f32 arg0, f32 arg1, f32 arg2); -void func_800705F8(s32, f32, f32, f32); -void func_8006ECFC(s32 arg0); - - -GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_80065EA0.s") - -void func_80066060(s32 arg0, s32 arg1) { - if (arg0 >= 0 && arg0 < 4) { - D_800DD2F8[arg0] = arg1; - D_80120AC0[arg0].unk3B = arg1; - } -} - -void func_80066098(s8 arg0) { - s8 temp = (arg0 << 24) >> 24; - if (!osTvType) { - D_80120D15 = temp; - } -} -void func_800660C0(void) { - D_80120D18 = 1; -} -void func_800660D0(void) { - D_80120D18 = 0; -} -/* Unused? */ -f32 func_800660DC(void) { - return D_80120D10; -} - -void func_800660EC(f32 arg0) { - if (0.0f < arg0 && arg0 < 90.0f && arg0 != D_80120D10) { - D_80120D10 = arg0; - guPerspectiveF(&D_80120EE0, &D_80120D6C, arg0, 1.33333333f, 10.0f, 15000.0f, 1.0f); - func_8006F870(&D_80120EE0, &D_80120FE0); - } -} - -void func_80066194(void) { - guPerspectiveF(&D_80120EE0, &D_80120D6C, 60.0f, 1.33333333f, 10.0f, 15000.0f, 1.0f); - func_8006F870(&D_80120EE0, &D_80120FE0); -} - -/* Unused? */ -s32* func_80066204(void) { - return &D_801210A0; -} - -s32 func_80066210(void) { - return D_80120CE0; -} - -s32 func_80066220(void) { - return D_80120CE4; -} - -void func_80066230(s32 arg0, s32 arg1) { - unk80120AC0 *someStruct; - s16 sp2A; - s16 sp28; - s16 sp26; - s16 sp24; - f32 sp20; - f32 sp1C; - f32 sp18; - - func_8006652C(0); - func_800665E8(0); - someStruct = func_80069D20(); - sp2A = someStruct->unk0; - sp28 = someStruct->unk2; - sp26 = someStruct->unk4; - sp20 = someStruct->x_position; - sp1C = someStruct->y_position; - sp18 = someStruct->z_position; - sp24 = someStruct->unk38; - someStruct->unk4 = 0; - someStruct->unk2 = 0; - someStruct->unk0 = -0x8000; - someStruct->unk38 = 0; - someStruct->x_position = 0.0f; - someStruct->y_position = 0.0f; - someStruct->z_position = 0.0f; - func_8001D5E0(0.0f, 0.0f, -1.0f); - func_80066CDC(arg0, arg1); - someStruct->unk38 = sp24; - someStruct->unk0 = sp2A; - someStruct->unk2 = sp28; - someStruct->unk4 = sp26; - someStruct->x_position = sp20; - someStruct->y_position = sp1C; - someStruct->z_position = sp18; -} - -f32 func_80066348(f32 arg0, f32 arg1, f32 arg2) { - s32 phi_v1; - f32 temp_f2, temp_f0, temp_f14; - - phi_v1 = D_80120CE4; - - if (D_80120D14 != 0) { - phi_v1 += 4; - } - - temp_f0 = arg2 - D_80120AC0[phi_v1].z_position; - temp_f2 = arg0 - D_80120AC0[phi_v1].x_position; - temp_f14 = arg1 - D_80120AC0[phi_v1].y_position; - return sqrtf((temp_f0 * temp_f0) + ((temp_f2 * temp_f2) + (temp_f14 * temp_f14))); -} - -void func_800663DC(s32 x_pos, s32 y_pos, s32 z_pos, s32 arg3, s32 arg4, s32 arg5) { - D_80120AC0[D_80120CE4].unk4 = (s16) (arg3 * 0xB6); - D_80120AC0[D_80120CE4].x_position = (f32) x_pos; - D_80120AC0[D_80120CE4].y_position = (f32) y_pos; - D_80120AC0[D_80120CE4].z_position = (f32) z_pos; - D_80120AC0[D_80120CE4].unk2 = (s16) (arg4 * 0xB6); - D_80120AC0[D_80120CE4].unk38 = (u16)0; - D_80120AC0[D_80120CE4].unk24 = 0.0f; - D_80120AC0[D_80120CE4].unk28 = 0.0f; - D_80120AC0[D_80120CE4].unk2C = 0.0f; - D_80120AC0[D_80120CE4].unk30 = 0.0f; - D_80120AC0[D_80120CE4].unk1C = 160.0f; - D_80120AC0[D_80120CE4].unk0 = (s16) (arg5 * 0xB6); - D_80120AC0[D_80120CE4].unk3B = D_800DD2F8[D_80120CE4]; -} - -void func_80066488(s32 arg0, f32 arg1, f32 arg2, f32 arg3, s16 arg4, s16 arg5, s16 arg6) { - arg0 += 4; - D_80120AC0[arg0].unk38 = 0; - D_80120AC0[arg0].x_position = arg1; - D_80120AC0[arg0].y_position = arg2; - D_80120AC0[arg0].z_position = arg3; - D_80120AC0[arg0].unk0 = arg4; - D_80120AC0[arg0].unk2 = arg5; - D_80120AC0[arg0].unk4 = arg6; - D_80120AC0[arg0].unk34 = func_80029F18(arg1, arg2, arg3); - D_80120D14 = 1; -} - -s8 func_80066510(void) { - return D_80120D14; -} - -void func_80066520(void) { - D_80120D14 = 0; -} - -s32 func_8006652C(s32 arg0) { - if ((arg0 >= 0) && (arg0 < 4)) { - D_80120CE0 = arg0; - } else { - D_80120CE0 = 0; - } - switch(D_80120CE0) { - case 0: - D_80120CE8 = 1; - break; - case 1: - D_80120CE8 = 2; - break; - case 2: - D_80120CE8 = 3; - break; - case 3: - D_80120CE8 = 4; - break; - } - if (D_80120CE4 >= D_80120CE8) { - D_80120CE4 = 0; - } - return D_80120CE8; -} - -void func_800665E8(s32 arg0) { - if (arg0 >= 0 && arg0 < 4) { - D_80120CE4 = arg0; - } else { - D_80120CE4 = 0; - } -} - -GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_80066610.s") - -void func_80066818(s32 arg0, s32 arg1) { - if (arg1 != 0) { - D_800DD064[arg0].unk30 |= 1; - } else { - D_800DD064[arg0].unk30 |= 2; - } - D_800DD064[arg0].unk30 &= -5; -} - -void func_80066894(s32 arg0, s32 arg1) { - if (arg1 != 0) { - D_800DD064[arg0].unk30 &= -2; - } else { - D_800DD064[arg0].unk30 |= 4; - } - D_800DD064[arg0].unk30 &= -3; -} - -s32 func_80066910(s32 arg0) { - return D_800DD064[arg0].unk30 & 0x1; -} - -GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_80066940.s") - -void func_80066AA8(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { - if (arg1 != 0x8000) { - D_800DD064[arg0].unk10 = arg1; - D_800DD064[arg0].unk30 |= 8; - } else { - D_800DD064[arg0].unk30 &= 0xFFFFFFF7; - } - if (arg2 != 0x8000) { - D_800DD064[arg0].unk10 = arg2; - D_800DD064[arg0].unk30 |= 0x10; - } else { - D_800DD064[arg0].unk30 &= 0xFFFFFFEF; - } - if (arg3 != 0x8000) { - D_800DD064[arg0].unk18 = arg3; - D_800DD064[arg0].unk30 |= 0x20; - } else { - D_800DD064[arg0].unk30 &= 0xFFFFFFDF; - } - if (arg4 != 0x8000) { - D_800DD064[arg0].unk1C = arg4; - D_800DD064[arg0].unk30 |= 0x40; - return; - } - D_800DD064[arg0].unk30 &= 0xFFFFFFBF; -} - -s32 func_80066BA8(s32 arg0, s32 *arg1, s32 *arg2, s32 *arg3, s32 *arg4) { - *arg1 = D_800DD064[arg0].unk20; - *arg3 = D_800DD064[arg0].unk28; - *arg2 = D_800DD064[arg0].unk24; - *arg4 = D_800DD064[arg0].unk2C; - if ((*arg1 | *arg3 | *arg2 | *arg4) == 0) { - return 0; - } - return 1; -} - -void func_80066C2C(s32 arg0, s32 *arg1, s32 *arg2, s32 *arg3, s32 *arg4) { - *arg1 = D_800DD064[arg0].unk0; - *arg2 = D_800DD064[arg0].unk4; - *arg3 = D_800DD064[arg0].unk8; - *arg4 = D_800DD064[arg0].unkC; -} - -// Unused? -void func_80066C80(s32 *arg0, s32 *arg1, s32 *arg2, s32 *arg3) { - u32 temp_v0 = func_8007A520(); - *arg0 = 0; - *arg1 = 0; - *arg2 = temp_v0 & 0xFFFF; - *arg3 = (u32) (temp_v0 >> 0x10); -} - - -#if 1 -GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_80066CDC.s") -#else -// Work in progress! - -void func_80066CDC(Gfx **dlist, s32 *arg1) { - u32 sp58; - u32 sp54; - u32 sp50; - u32 sp4C; - s32 sp34; - s32 sp2C; - u32 temp_a0; - u32 temp_a0_3; - u32 temp_a0_4; - u32 temp_a2; - u32 temp_a3; - u32 temp_a3_2; - u32 temp_t0; - u32 temp_t1_2; - u32 temp_v0; - u32 temp_v0_3; - u32 temp_v0_4; - u32 temp_v1_10; - u32 temp_v1_3; - u32 temp_v1_4; - s32 phi_t1; - s32 phi_v1; - f32 phi_f6; - f32 phi_f18; - f32 phi_f16; - f32 phi_f8; - f32 phi_f6_2; - f32 phi_f18_2; - f32 phi_f8_2; - f32 phi_f16_2; - u32 phi_a1; - f32 phi_f8_3; - f32 phi_f16_3; - f32 phi_f16_4; - u32 phi_t3; - u32 phi_a3_2; - u32 phi_t5; - u32 phi_t4; - - sp34 = D_80120CE4; - phi_t1 = D_80120CE4; - if (func_8000E184() && D_80120CE0 == 0) { - D_80120CE4 = 1; - phi_t1 = 0; - } - temp_v0 = func_8007A520(); - temp_t0 = temp_v0 >> 0x10; - temp_a3 = temp_t0 >> 1; - - if (D_800DD064[phi_t1].unk30 & 1) { - sp2C = D_80120CE4; - D_80120CE4 = phi_t1; - fast3d_cmd( - (*dlist)++, - ((((s32)(D_800DD064[D_80120CE4].unk24 * 4.0f)) & 0xFFF) | 0xED000000) | (((s32)(D_800DD064[D_80120CE4].unk20 * 4.0f)) & 0xFFF) << 0xC, - (((s32)(D_800DD064[D_80120CE4].unk2C * 4.0f)) & 0xFFF) | (((s32)(D_800DD064[D_80120CE4].unk28 * 4.0f)) & 0xFFF) << 0xC - ) - func_80068158(dlist, 0, 0, 0, 0); - D_80120CE4 = sp2C; - if (arg1 != 0) { - func_80067D3C(dlist, arg1); - } - D_80120CE4 = sp34; - return; - } - temp_t1_2 = temp_v0 & 0xFFFF; - phi_v1 = D_80120CE0; - if (D_80120CE0 == 2) { - phi_v1 = 3; - } - temp_a2 = temp_t1_2 >> 1; - sp54 = temp_a2; - sp58 = temp_a3; - if (osTvType == 0) { - sp58 = 0x91; - } - - switch(phi_v1) { - case 0: - phi_t3 = sp58; - if (osTvType == 0) { - phi_t3 = sp58 - 0x12; - } - phi_f16_4 = temp_t0; - if (temp_t0 < 0) { - phi_f16_4 = temp_t0 + 4294967296.0f; - } - fast3d_cmd( - (*dlist)++, - 0xED000000, - ((((s32)(temp_t1_2 * 4.0f)) & 0xFFF) << 0xC) | (((s32)(phi_f16_4 * 4.0f)) & 0xFFF) - ) - sp4C = temp_a2; - phi_a3_2 = temp_a2; - break; - case 1: - if (D_80120CE4 == 0) { - temp_v0_4 = temp_t0 >> 2; - phi_t3 = temp_v0_4; - if (osTvType == 0) { - phi_t3 = temp_v0_4 - 0xC; - } - phi_f8_3 = temp_a3 - (temp_t0 >> 7); - if (phi_f8_3 < 0) { - phi_f8_3 += 4294967296.0f; - } - fast3d_cmd( - (*dlist)++, - 0xED000000, - ((((s32)(temp_t1_2 * 4.0f)) & 0xFFF) << 0xC) | (((s32)(phi_f8_3 * 4.0f)) & 0xFFF) - ) - } else { - temp_v1_10 = temp_t0 >> 7; - phi_f16_3 = temp_t0 - temp_v1_10; - if (phi_f16_3 < 0) { - phi_f16_3 += 4294967296.0f; - } - fast3d_cmd( - (*dlist)++, - (((s32)((temp_a3 + temp_v1_10) * 4.0f)) & 0xFFF) | 0xED000000, - ((((s32)(temp_t1_2 * 4.0f)) & 0xFFF) << 0xC) | (((s32)(phi_f16_3 * 4.0f)) & 0xFFF) - ) - phi_t3 = temp_a3 + (temp_t0 >> 2); - } - sp4C = temp_a2; - phi_a3_2 = temp_a2; - break; - case 2: - if (D_80120CE4 == 0) { - phi_f8_2 = temp_t0; - if (temp_t0 < 0) { - phi_f8_2 = temp_t0 + 4294967296.0f; - } - fast3d_cmd( - (*dlist)++, - 0xED000000, - ((((s32)((temp_a2 - (temp_t1_2 >> 8)) * 4.0f)) & 0xFFF) << 0xC) | (((s32)(phi_f8_2 * 4.0f)) & 0xFFF) - ) - phi_a1 = temp_t1_2 >> 2; - } else { - temp_a0_4 = temp_t1_2 >> 8; - phi_f16_2 = temp_t0; - if (temp_t0 < 0) { - phi_f16_2 = temp_t0 + 4294967296.0f; - } - fast3d_cmd( - (*dlist)++, - (((s32)((temp_a2 + temp_a0_4) * 4.0f) & 0xFFF) << 0xC) | 0xED000000, - (((s32)((temp_t1_2 - temp_a0_4) * 4.0f) & 0xFFF) << 0xC) | (((s32)(phi_f16_2 * 4.0f)) & 0xFFF) - ) - phi_a1 = temp_a2 + (temp_t1_2 >> 2); - } - sp4C = phi_a1; - phi_t3 = sp58; - phi_a3_2 = phi_a1; - break; - case 3: - switch(D_80120CE4) { - case 0: - phi_f6_2 = temp_a2 - (temp_t1_2 >> 8); - if (phi_f6_2 < 0) { - phi_f6_2 += 4294967296.0f; - } - phi_f18_2 = temp_a3 - (temp_t0 >> 7); - if (phi_f18_2 < 0) { - phi_f18_2 += 4294967296.0f; - } - fast3d_cmd( - (*dlist)++, - ((((s32)(0U * 4.0f) & 0xFFF) << 0xC) | 0xED000000) | (((s32)(0U * 4.0f)) & 0xFFF), - (((s32)(phi_f6_2 * 4.0f) & 0xFFF) << 0xC) | (((s32)(phi_f18_2 * 4.0f)) & 0xFFF) - ) - phi_t5 = 0U; - phi_t4 = 0U; - break; - case 1: - temp_a0_3 = temp_t1_2 >> 8; - phi_f8 = temp_a3 - (temp_t0 >> 7); - if (phi_f8 < 0) { - phi_f8 += 4294967296.0f; - } - fast3d_cmd( - (*dlist)++, - ((((s32)((temp_a2 + temp_a0_3) * 4.0f)) & 0xFFF) << 0xC) | 0xED000000, - ((((s32)(((temp_a2 * 2) - temp_a0_3) * 4.0f)) & 0xFFF) << 0xC) | (((s32)(phi_f8 * 4.0f)) & 0xFFF) - ) - phi_t5 = 0U; - phi_t4 = temp_a2; - break; - case 2: - temp_v1_4 = temp_t0 >> 7; - phi_f16 = (temp_a3 * 2) - temp_v1_4; - if (phi_f16 < 0) { - phi_f16 += 4294967296.0f; - } - fast3d_cmd( - (*dlist)++, - (((s32)((temp_a3 + temp_v1_4) * 4.0f)) & 0xFFF) | 0xED000000, - ((((s32)((temp_a2 - (temp_t1_2 >> 8)) * 4.0f)) & 0xFFF) << 0xC) | (((s32)(phi_f16 * 4.0f)) & 0xFFF) - ) - phi_t5 = temp_a3; - phi_t4 = 0U; - break; - case 3: - temp_a0 = temp_t1_2 >> 8; - temp_v1_3 = temp_t0 >> 7; - phi_f6 = (temp_a2 * 2) - temp_a0; - if (phi_f6 < 0) { - phi_f6 += 4294967296.0f; - } - phi_f18 = (temp_a3 * 2) - temp_v1_3; - if (phi_f18 < 0) { - phi_f18 += 4294967296.0f; - } - fast3d_cmd( - (*dlist)++, - (((((s32)((temp_a2 + temp_a0) * 4.0f)) & 0xFFF) << 0xC) | 0xED000000) | (((s32)((temp_a3 + temp_v1_3) * 4.0f)) & 0xFFF), - ((((s32)(phi_f6 * 4.0f) & 0xFFF)) << 0xC) | (((s32)(phi_f18 * 4.0f)) & 0xFFF) - ) - phi_t5 = temp_a3; - phi_t4 = temp_a2; - break; - default: - phi_t5 = 0; - phi_t4 = 0; - break; - } - temp_v0_3 = phi_t5 + sp58; - temp_a3_2 = phi_t4 + sp54; - phi_t3 = temp_v0_3; - phi_a3_2 = temp_a3_2; - if (osTvType == 0) { - phi_t3 = temp_v0_3 - 6; - phi_a3_2 = temp_a3_2; - if (D_80120CE4 < 2) { - phi_t3 = temp_v0_3 - 0x14; - phi_a3_2 = temp_a3_2; - } - } - break; - default: - phi_t3 = sp50; - phi_a3_2 = sp4C; - break; - } - - if (osTvType == 0) { - phi_a3_2 -= 4; - } - func_80068158(dlist, sp54, sp58, phi_a3_2, phi_t3); - if (arg1 != 0) { - func_80067D3C(dlist, arg1); - } - D_80120CE4 = sp34; -} -#endif - -GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_80067A3C.s") -GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_80067D3C.s") - -void func_80067F20(f32 arg0) { - D_800DD2CC[0] = arg0; -} - -GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_80067F2C.s") - -void func_8006807C(Gfx **dlist, s32 *arg1) { - func_8006FE74(&D_80121060, &D_800DD288); - func_8006F768(&D_80121060, &D_80120EE0, &D_80120F20); - func_8006FE74(D_80120D70[0], &D_800DD2A0); - func_8006F768(D_80120D70[0], &D_80120F20, &D_80121060); - func_8006F870(&D_80121060, (s32*)*arg1); // This doesn't look right. Need to check this! - fast3d_cmd((*dlist)++, 0x1000040, (u32)(*arg1 + 0x80000000)) - *arg1 += 0x40; - D_80120D1C = 0; - D_80120D08 = 0; -} - -GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_80068158.s") -GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_800682AC.s") - -void func_80068408(Gfx **dlist, s32 *arg1) { - func_800705F8(D_80120D70[D_80120D1C], 0.0f, 0.0f, 0.0f); - func_8006F768(D_80120D70[D_80120D1C], &D_80120F20, &D_80121060); - func_8006F870(&D_80121060, (s32*)*arg1); // This doesn't look right. Need to check this! - D_80120D88[D_80120D1C] = *arg1; - - fast3d_cmd((*dlist)++, ((((D_80120D08 << 6) & 0xFF) << 0x10) | 0x1000000) | 0x40, (u32)(*arg1 + 0x80000000)) - - *arg1 += 0x40; -} - -void func_80068508(s32 arg0) { - D_80120D0C = arg0; -} - -GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_80068514.s") -GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_80068BF4.s") -GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_80068FA8.s") -GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_80069484.s") -GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_80069790.s") -GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_80069A40.s") - -unk80120AC0 *func_80069CFC(void) { - return &D_80120AC0[D_80120CE4]; -} - -unk80120AC0 *func_80069D20(void) { - if (D_80120D14 != 0) { - return &D_80120AC0[D_80120CE4 + 4]; - } - return &D_80120AC0[D_80120CE4]; -} - -unk80120AC0 *func_80069D7C(void) { - if (D_80120D14 != 0) { - return D_80120BD0; - } - return D_80120AC0; -} - -s32* func_80069DA4(void) { - return &D_80120FA0; -} - -s32* func_80069DB0(void) { - return &D_80120FE0; -} - -s32* func_80069DBC(void) { - return &D_80120F60; -} - -f32 func_80069DC8(f32 arg0, f32 arg1, f32 arg2) { - f32 sp34; - f32 sp30; - f32 returnVal; - func_8006F64C(&D_80120F60, arg0, arg1, arg2, &sp34, &sp30, &returnVal); - return returnVal; -} - -void func_80069E14(f32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { - f32 temp_f0; - f32 temp_f0_2; - f32 temp_f14; - f32 temp_f2; - s32 i; - - for (i = 0; i <= D_80120CE0; i++) { - temp_f0 = arg0 - D_80120AC0[i].x_position; - temp_f2 = arg1 - D_80120AC0[i].y_position; - temp_f14 = arg2 - D_80120AC0[i].z_position; - temp_f0_2 = sqrtf(((temp_f0 * temp_f0) + (temp_f2 * temp_f2)) + (temp_f14 * temp_f14)); - if (temp_f0_2 < arg3) { - D_80120AC0[i].unk30 = ((arg3 - temp_f0_2) * arg4) / arg3; - } - } -} - -GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_80069F28.s") - -s32* func_8006A100(void) { - return &D_801210E0; -} - -#if 1 -GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_8006A10C.s") -#else - -extern s32 D_800DD300; -extern s32 D_801210F8; -extern s32 D_801210FC; -extern s8 D_80121100; -extern u8 D_80121103; - -// Has regalloc & stack issues. -s32 func_8006A10C(void) { - u8 sp23; - osCreateMesgQueue(&D_801210E0, &D_801210F8, 1); - osSetEventMesg(5, &D_801210E0, D_801210FC); - func_800CCC20(&D_801210E0, &sp23, &D_80121100); - func_800CCFE0(&D_801210E0); - func_8006A434(); - D_800DD300 = 0; - if ((sp23 & 1) && !(D_80121103 & 8)) { - return 0; - } - D_800DD300 = 1; - return -1; -} -#endif - -GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_8006A1C4.s") -GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_8006A434.s") - -void func_8006A458(s8 *activePlayers) { - s32 i; - s32 temp = 0; - for(i = 0; i < 4; i++) { - if (activePlayers[i]) { - D_80121150[temp++] = i; - } - } - for(i = 0; i < 4; i++) { - if (!activePlayers[i]) { - D_80121150[temp++] = i; - } - } -} - -u8 func_8006A4F8(s32 arg0) { - return D_80121150[arg0]; -} - -void func_8006A50C(void) { - u8 temp = D_80121150[0]; - D_80121150[0] = D_80121150[1]; - D_80121150[1] = temp; -} - -u16 func_8006A528(s32 arg0) { - return D_80121110[D_80121150[arg0]].unk0; -} - -u16 func_8006A554(s32 arg0) { - return D_80121140[D_80121150[arg0]]; -} - -u16 func_8006A578(s32 arg0) { - return D_80121148[D_80121150[arg0]]; -} - -s32 func_8006A59C(s32 arg0) { - func_8006A624(D_80121110[D_80121150[arg0]].unk2); -} - -s32 func_8006A5E0(s32 arg0) { - func_8006A624(D_80121110[D_80121150[arg0]].unk3); -} - -s32 func_8006A624(s8 arg0) { - if (arg0 < 8 && arg0 >= -7) { - return 0; - } - if (arg0 > 0) { - arg0 -= 8; - if (arg0 >= 0x47) { - arg0 = 0x46; - } - } else { - arg0 += 8; - if (arg0 < -0x46) { - arg0 = -0x46; - } - } - return arg0; -} - -void func_8006A6A0(void) { - D_800DD304 = 0; -} +/* The comment below is needed for this file to be picked up by generate_ld */ +/* RAM_POS: 0x80065EA0 */ + +#include "types.h" +#include "macros.h" +#include "structs.h" +#include "fast3d.h" + +extern u32 osTvType; + +/************ .rodata ************/ + +const char D_800E6F00[] = "Camera Error: Illegal mode!\n"; +const char D_800E6F20[] = "Camera Error: Illegal player no!\n"; +const char D_800E6F34[] = "cameraPushSprMtx: model stack overflow!!\n"; +const char D_800E6F70[] = "\nCam do 2D sprite called with NULL pointer!"; +const char D_800E6F9C[] = "CamDo2DSprite FrameNo Overflow !!!\n"; +const char D_800E6FC0[] = "cameraPushModelMtx: model stack overflow!!\n"; +const char D_800E6FEC[] = "camPushModelMtx: bsp stack overflow!!\n"; +const char D_800E7010[] = "camPopModelMtx: model stack negative overflow!!\n"; +const char D_800E7048[] = "camPopModelMtx: bsp stack negative overflow!!\n"; + +/*********************************/ + +/************ .data ************/ + +s32 D_800DD060 = 0; // Currently unknown, might be a different type. + +/* Size: 0x34 bytes. */ +typedef struct unk800DD064 { + s32 unk0; + s32 unk4; + s32 unk8; + s32 unkC; + s32 unk10; + s32 unk14; + s32 unk18; + s32 unk1C; + s32 unk20; + s32 unk24; + s32 unk28; + s32 unk2C; + s32 unk30; +} unk800DD064; + +unk800DD064 D_800DD064[4] = { + { + 0x00, 0x00, 0x140, 0xF0, + 0xA0, 0x78, 0x140, 0xF0, + 0x00, 0x00, 0x13F, 0xEF, 0x00 + }, + { + 0x00, 0x00, 0x140, 0xF0, + 0xA0, 0x78, 0x140, 0xF0, + 0x00, 0x00, 0x13F, 0xEF, 0x00 + }, + { + 0x00, 0x00, 0x140, 0xF0, + 0xA0, 0x78, 0x140, 0xF0, + 0x00, 0x00, 0x13F, 0xEF, 0x00 + }, + { + 0x00, 0x00, 0x140, 0xF0, + 0xA0, 0x78, 0x140, 0xF0, + 0x00, 0x00, 0x13F, 0xEF, 0x00 + } +}; + +// Not sure about the typing here +s16 D_800DD134[10] = { + 0, 0, 0, 0, + 0, -1, -1, 0, + 0, 0 +}; + +// Not sure about the typing here +u16 D_800DD148[160] = { + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0, + 0, 0, 0x01FF, 0 +}; + +f32 D_800DD288[6] = { + 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, -281.0f +}; + +f32 D_800DD2A0[6] = { + 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f +}; + +f32 D_800DD2B8[5] = { + 1.0f, 0.0f, 0.0f, 0.0f, 0.0f +}; + +f32 D_800DD2CC[11] = { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 160.0f +}; + +u8 D_800DD2F8[8] = { + 0, 0, 0, 0, 0, 0, 0, 0 +}; + +s32 D_800DD300 = 0; // Currently unknown, might be a different type. + +s16 D_800DD304 = -1; + +/*******************************/ + +/************ .bss ************/ + +/* Size: 0x44 bytes, might just be Player? */ +typedef struct unk80120AC0 { + s16 unk0; + s16 unk2; + s16 unk4; + u8 pad6[6]; + f32 x_position; + f32 y_position; + f32 z_position; + f32 pad18; + f32 unk1C; + f32 pad20; + f32 unk24; + f32 unk28; + f32 unk2C; + f32 unk30; + s16 unk34; + s16 pad36; + s16 unk38; + s8 pad3A; + s8 unk3B; + u8 pad3C[8]; +} unk80120AC0; + +unk80120AC0 D_80120AC0[8]; +s32 D_80120CE0; +s32 D_80120CE4; +s32 D_80120CE8; +s32 D_80120CEC; +s32 D_80120CF0[6]; +s32 D_80120D08; +s32 D_80120D0C; +f32 D_80120D10; +s8 D_80120D14; +u8 D_80120D15; +s32 D_80120D18; +s32 D_80120D1C; +s32 D_80120D20[2]; +s32 D_80120D28[6]; +s32 D_80120D40[6]; +s32 D_80120D58[6]; +s32 D_80120D70[6]; +s32 D_80120D88[6]; +s32 D_80120DA0[80]; +s32 D_80120EE0[16]; +s32 D_80120F20[16]; +s32 D_80120F60[16]; +s32 D_80120FA0[16]; +s32 D_80120FE0[16]; +s32 D_80121020[16]; +s32 D_80121060[16]; +s32 D_801210A0[16]; +s32 D_801210E0[6]; +s32 D_801210F8; +s32 D_801210FC; +u8 D_80121100[16]; + +/* Size: 6 bytes */ +typedef struct unk80121110 { + u16 unk0; + s8 unk2; + s8 unk3; + s8 unk4; + s8 unk6; +} unk80121110; +unk80121110 D_80121110[8]; +u16 D_80121140[4]; +u16 D_80121148[4]; +u8 D_80121150[16]; + +/******************************/ + +extern s32 D_A4000000; +extern s32 SP_IMEM; + +unk80120AC0 *func_80069D20(void); +void func_800014BC(f32 arg0); +s8* func_8001E29C(s32 arg0); +s32 func_8006A624(s8 arg0); +void func_8006F64C(s32*, f32, f32, f32, f32*, f32*, f32*); +void guPerspectiveF(s32*, s32*, f32, f32, f32, f32, f32); +void func_8006F870(s32*, s32*); +s16 func_80029F18(f32, f32, f32); +void func_8006A50C(void); +void func_800665E8(s32 arg0); +void func_8006CB58(s32 arg0, s32 arg1, s32 arg2, s32 arg3); +void func_8006C164(void); +void func_8000E194(void); +f32 sqrtf(f32); +void osSetTime(u64); +void func_8001D5E0(f32 arg0, f32 arg1, f32 arg2); +void func_800705F8(s32, f32, f32, f32); +void func_8006ECFC(s32 arg0); + + +GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_80065EA0.s") + +void func_80066060(s32 arg0, s32 arg1) { + if (arg0 >= 0 && arg0 < 4) { + D_800DD2F8[arg0] = arg1; + D_80120AC0[arg0].unk3B = arg1; + } +} + +void func_80066098(s8 arg0) { + s8 temp = (arg0 << 24) >> 24; + if (!osTvType) { + D_80120D15 = temp; + } +} +void func_800660C0(void) { + D_80120D18 = 1; +} +void func_800660D0(void) { + D_80120D18 = 0; +} +/* Unused? */ +f32 func_800660DC(void) { + return D_80120D10; +} + +void func_800660EC(f32 arg0) { + if (0.0f < arg0 && arg0 < 90.0f && arg0 != D_80120D10) { + D_80120D10 = arg0; + guPerspectiveF(&D_80120EE0, &D_80120D58[5], arg0, 1.33333333f, 10.0f, 15000.0f, 1.0f); + func_8006F870(&D_80120EE0, &D_80120FE0); + } +} + +void func_80066194(void) { + guPerspectiveF(&D_80120EE0, &D_80120D58[5], 60.0f, 1.33333333f, 10.0f, 15000.0f, 1.0f); + func_8006F870(&D_80120EE0, &D_80120FE0); +} + +/* Unused? */ +s32* func_80066204(void) { + return &D_801210A0; +} + +s32 func_80066210(void) { + return D_80120CE0; +} + +s32 func_80066220(void) { + return D_80120CE4; +} + +void func_80066230(s32 arg0, s32 arg1) { + unk80120AC0 *someStruct; + s16 sp2A; + s16 sp28; + s16 sp26; + s16 sp24; + f32 sp20; + f32 sp1C; + f32 sp18; + + func_8006652C(0); + func_800665E8(0); + someStruct = func_80069D20(); + sp2A = someStruct->unk0; + sp28 = someStruct->unk2; + sp26 = someStruct->unk4; + sp20 = someStruct->x_position; + sp1C = someStruct->y_position; + sp18 = someStruct->z_position; + sp24 = someStruct->unk38; + someStruct->unk4 = 0; + someStruct->unk2 = 0; + someStruct->unk0 = -0x8000; + someStruct->unk38 = 0; + someStruct->x_position = 0.0f; + someStruct->y_position = 0.0f; + someStruct->z_position = 0.0f; + func_8001D5E0(0.0f, 0.0f, -1.0f); + func_80066CDC(arg0, arg1); + someStruct->unk38 = sp24; + someStruct->unk0 = sp2A; + someStruct->unk2 = sp28; + someStruct->unk4 = sp26; + someStruct->x_position = sp20; + someStruct->y_position = sp1C; + someStruct->z_position = sp18; +} + +f32 func_80066348(f32 arg0, f32 arg1, f32 arg2) { + s32 phi_v1; + f32 temp_f2, temp_f0, temp_f14; + + phi_v1 = D_80120CE4; + + if (D_80120D14 != 0) { + phi_v1 += 4; + } + + temp_f0 = arg2 - D_80120AC0[phi_v1].z_position; + temp_f2 = arg0 - D_80120AC0[phi_v1].x_position; + temp_f14 = arg1 - D_80120AC0[phi_v1].y_position; + return sqrtf((temp_f0 * temp_f0) + ((temp_f2 * temp_f2) + (temp_f14 * temp_f14))); +} + +void func_800663DC(s32 x_pos, s32 y_pos, s32 z_pos, s32 arg3, s32 arg4, s32 arg5) { + D_80120AC0[D_80120CE4].unk4 = (s16) (arg3 * 0xB6); + D_80120AC0[D_80120CE4].x_position = (f32) x_pos; + D_80120AC0[D_80120CE4].y_position = (f32) y_pos; + D_80120AC0[D_80120CE4].z_position = (f32) z_pos; + D_80120AC0[D_80120CE4].unk2 = (s16) (arg4 * 0xB6); + D_80120AC0[D_80120CE4].unk38 = (u16)0; + D_80120AC0[D_80120CE4].unk24 = 0.0f; + D_80120AC0[D_80120CE4].unk28 = 0.0f; + D_80120AC0[D_80120CE4].unk2C = 0.0f; + D_80120AC0[D_80120CE4].unk30 = 0.0f; + D_80120AC0[D_80120CE4].unk1C = 160.0f; + D_80120AC0[D_80120CE4].unk0 = (s16) (arg5 * 0xB6); + D_80120AC0[D_80120CE4].unk3B = D_800DD2F8[D_80120CE4]; +} + +void func_80066488(s32 arg0, f32 arg1, f32 arg2, f32 arg3, s16 arg4, s16 arg5, s16 arg6) { + arg0 += 4; + D_80120AC0[arg0].unk38 = 0; + D_80120AC0[arg0].x_position = arg1; + D_80120AC0[arg0].y_position = arg2; + D_80120AC0[arg0].z_position = arg3; + D_80120AC0[arg0].unk0 = arg4; + D_80120AC0[arg0].unk2 = arg5; + D_80120AC0[arg0].unk4 = arg6; + D_80120AC0[arg0].unk34 = func_80029F18(arg1, arg2, arg3); + D_80120D14 = 1; +} + +s8 func_80066510(void) { + return D_80120D14; +} + +void func_80066520(void) { + D_80120D14 = 0; +} + +s32 func_8006652C(s32 arg0) { + if ((arg0 >= 0) && (arg0 < 4)) { + D_80120CE0 = arg0; + } else { + D_80120CE0 = 0; + } + switch(D_80120CE0) { + case 0: + D_80120CE8 = 1; + break; + case 1: + D_80120CE8 = 2; + break; + case 2: + D_80120CE8 = 3; + break; + case 3: + D_80120CE8 = 4; + break; + } + if (D_80120CE4 >= D_80120CE8) { + D_80120CE4 = 0; + } + return D_80120CE8; +} + +void func_800665E8(s32 arg0) { + if (arg0 >= 0 && arg0 < 4) { + D_80120CE4 = arg0; + } else { + D_80120CE4 = 0; + } +} + +GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_80066610.s") + +void func_80066818(s32 arg0, s32 arg1) { + if (arg1 != 0) { + D_800DD064[arg0].unk30 |= 1; + } else { + D_800DD064[arg0].unk30 |= 2; + } + D_800DD064[arg0].unk30 &= -5; +} + +void func_80066894(s32 arg0, s32 arg1) { + if (arg1 != 0) { + D_800DD064[arg0].unk30 &= -2; + } else { + D_800DD064[arg0].unk30 |= 4; + } + D_800DD064[arg0].unk30 &= -3; +} + +s32 func_80066910(s32 arg0) { + return D_800DD064[arg0].unk30 & 0x1; +} + +GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_80066940.s") + +void func_80066AA8(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { + if (arg1 != 0x8000) { + D_800DD064[arg0].unk10 = arg1; + D_800DD064[arg0].unk30 |= 8; + } else { + D_800DD064[arg0].unk30 &= 0xFFFFFFF7; + } + if (arg2 != 0x8000) { + D_800DD064[arg0].unk10 = arg2; + D_800DD064[arg0].unk30 |= 0x10; + } else { + D_800DD064[arg0].unk30 &= 0xFFFFFFEF; + } + if (arg3 != 0x8000) { + D_800DD064[arg0].unk18 = arg3; + D_800DD064[arg0].unk30 |= 0x20; + } else { + D_800DD064[arg0].unk30 &= 0xFFFFFFDF; + } + if (arg4 != 0x8000) { + D_800DD064[arg0].unk1C = arg4; + D_800DD064[arg0].unk30 |= 0x40; + return; + } + D_800DD064[arg0].unk30 &= 0xFFFFFFBF; +} + +s32 func_80066BA8(s32 arg0, s32 *arg1, s32 *arg2, s32 *arg3, s32 *arg4) { + *arg1 = D_800DD064[arg0].unk20; + *arg3 = D_800DD064[arg0].unk28; + *arg2 = D_800DD064[arg0].unk24; + *arg4 = D_800DD064[arg0].unk2C; + if ((*arg1 | *arg3 | *arg2 | *arg4) == 0) { + return 0; + } + return 1; +} + +void func_80066C2C(s32 arg0, s32 *arg1, s32 *arg2, s32 *arg3, s32 *arg4) { + *arg1 = D_800DD064[arg0].unk0; + *arg2 = D_800DD064[arg0].unk4; + *arg3 = D_800DD064[arg0].unk8; + *arg4 = D_800DD064[arg0].unkC; +} + +// Unused? +void func_80066C80(s32 *arg0, s32 *arg1, s32 *arg2, s32 *arg3) { + u32 temp_v0 = func_8007A520(); + *arg0 = 0; + *arg1 = 0; + *arg2 = temp_v0 & 0xFFFF; + *arg3 = (u32) (temp_v0 >> 0x10); +} + + +#if 1 +GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_80066CDC.s") +#else +// Work in progress! + +void func_80066CDC(Gfx **dlist, s32 *arg1) { + u32 sp58; + u32 sp54; + u32 sp50; + u32 sp4C; + s32 sp34; + s32 sp2C; + u32 temp_a0; + u32 temp_a0_3; + u32 temp_a0_4; + u32 temp_a2; + u32 temp_a3; + u32 temp_a3_2; + u32 temp_t0; + u32 temp_t1_2; + u32 temp_v0; + u32 temp_v0_3; + u32 temp_v0_4; + u32 temp_v1_10; + u32 temp_v1_3; + u32 temp_v1_4; + s32 phi_t1; + s32 phi_v1; + f32 phi_f6; + f32 phi_f18; + f32 phi_f16; + f32 phi_f8; + f32 phi_f6_2; + f32 phi_f18_2; + f32 phi_f8_2; + f32 phi_f16_2; + u32 phi_a1; + f32 phi_f8_3; + f32 phi_f16_3; + f32 phi_f16_4; + u32 phi_t3; + u32 phi_a3_2; + u32 phi_t5; + u32 phi_t4; + + sp34 = D_80120CE4; + phi_t1 = D_80120CE4; + if (func_8000E184() && D_80120CE0 == 0) { + D_80120CE4 = 1; + phi_t1 = 0; + } + temp_v0 = func_8007A520(); + temp_t0 = temp_v0 >> 0x10; + temp_a3 = temp_t0 >> 1; + + if (D_800DD064[phi_t1].unk30 & 1) { + sp2C = D_80120CE4; + D_80120CE4 = phi_t1; + fast3d_cmd( + (*dlist)++, + ((((s32)(D_800DD064[D_80120CE4].unk24 * 4.0f)) & 0xFFF) | 0xED000000) | (((s32)(D_800DD064[D_80120CE4].unk20 * 4.0f)) & 0xFFF) << 0xC, + (((s32)(D_800DD064[D_80120CE4].unk2C * 4.0f)) & 0xFFF) | (((s32)(D_800DD064[D_80120CE4].unk28 * 4.0f)) & 0xFFF) << 0xC + ) + func_80068158(dlist, 0, 0, 0, 0); + D_80120CE4 = sp2C; + if (arg1 != 0) { + func_80067D3C(dlist, arg1); + } + D_80120CE4 = sp34; + return; + } + temp_t1_2 = temp_v0 & 0xFFFF; + phi_v1 = D_80120CE0; + if (D_80120CE0 == 2) { + phi_v1 = 3; + } + temp_a2 = temp_t1_2 >> 1; + sp54 = temp_a2; + sp58 = temp_a3; + if (osTvType == 0) { + sp58 = 0x91; + } + + switch(phi_v1) { + case 0: + phi_t3 = sp58; + if (osTvType == 0) { + phi_t3 = sp58 - 0x12; + } + phi_f16_4 = temp_t0; + if (temp_t0 < 0) { + phi_f16_4 = temp_t0 + 4294967296.0f; + } + fast3d_cmd( + (*dlist)++, + 0xED000000, + ((((s32)(temp_t1_2 * 4.0f)) & 0xFFF) << 0xC) | (((s32)(phi_f16_4 * 4.0f)) & 0xFFF) + ) + sp4C = temp_a2; + phi_a3_2 = temp_a2; + break; + case 1: + if (D_80120CE4 == 0) { + temp_v0_4 = temp_t0 >> 2; + phi_t3 = temp_v0_4; + if (osTvType == 0) { + phi_t3 = temp_v0_4 - 0xC; + } + phi_f8_3 = temp_a3 - (temp_t0 >> 7); + if (phi_f8_3 < 0) { + phi_f8_3 += 4294967296.0f; + } + fast3d_cmd( + (*dlist)++, + 0xED000000, + ((((s32)(temp_t1_2 * 4.0f)) & 0xFFF) << 0xC) | (((s32)(phi_f8_3 * 4.0f)) & 0xFFF) + ) + } else { + temp_v1_10 = temp_t0 >> 7; + phi_f16_3 = temp_t0 - temp_v1_10; + if (phi_f16_3 < 0) { + phi_f16_3 += 4294967296.0f; + } + fast3d_cmd( + (*dlist)++, + (((s32)((temp_a3 + temp_v1_10) * 4.0f)) & 0xFFF) | 0xED000000, + ((((s32)(temp_t1_2 * 4.0f)) & 0xFFF) << 0xC) | (((s32)(phi_f16_3 * 4.0f)) & 0xFFF) + ) + phi_t3 = temp_a3 + (temp_t0 >> 2); + } + sp4C = temp_a2; + phi_a3_2 = temp_a2; + break; + case 2: + if (D_80120CE4 == 0) { + phi_f8_2 = temp_t0; + if (temp_t0 < 0) { + phi_f8_2 = temp_t0 + 4294967296.0f; + } + fast3d_cmd( + (*dlist)++, + 0xED000000, + ((((s32)((temp_a2 - (temp_t1_2 >> 8)) * 4.0f)) & 0xFFF) << 0xC) | (((s32)(phi_f8_2 * 4.0f)) & 0xFFF) + ) + phi_a1 = temp_t1_2 >> 2; + } else { + temp_a0_4 = temp_t1_2 >> 8; + phi_f16_2 = temp_t0; + if (temp_t0 < 0) { + phi_f16_2 = temp_t0 + 4294967296.0f; + } + fast3d_cmd( + (*dlist)++, + (((s32)((temp_a2 + temp_a0_4) * 4.0f) & 0xFFF) << 0xC) | 0xED000000, + (((s32)((temp_t1_2 - temp_a0_4) * 4.0f) & 0xFFF) << 0xC) | (((s32)(phi_f16_2 * 4.0f)) & 0xFFF) + ) + phi_a1 = temp_a2 + (temp_t1_2 >> 2); + } + sp4C = phi_a1; + phi_t3 = sp58; + phi_a3_2 = phi_a1; + break; + case 3: + switch(D_80120CE4) { + case 0: + phi_f6_2 = temp_a2 - (temp_t1_2 >> 8); + if (phi_f6_2 < 0) { + phi_f6_2 += 4294967296.0f; + } + phi_f18_2 = temp_a3 - (temp_t0 >> 7); + if (phi_f18_2 < 0) { + phi_f18_2 += 4294967296.0f; + } + fast3d_cmd( + (*dlist)++, + ((((s32)(0U * 4.0f) & 0xFFF) << 0xC) | 0xED000000) | (((s32)(0U * 4.0f)) & 0xFFF), + (((s32)(phi_f6_2 * 4.0f) & 0xFFF) << 0xC) | (((s32)(phi_f18_2 * 4.0f)) & 0xFFF) + ) + phi_t5 = 0U; + phi_t4 = 0U; + break; + case 1: + temp_a0_3 = temp_t1_2 >> 8; + phi_f8 = temp_a3 - (temp_t0 >> 7); + if (phi_f8 < 0) { + phi_f8 += 4294967296.0f; + } + fast3d_cmd( + (*dlist)++, + ((((s32)((temp_a2 + temp_a0_3) * 4.0f)) & 0xFFF) << 0xC) | 0xED000000, + ((((s32)(((temp_a2 * 2) - temp_a0_3) * 4.0f)) & 0xFFF) << 0xC) | (((s32)(phi_f8 * 4.0f)) & 0xFFF) + ) + phi_t5 = 0U; + phi_t4 = temp_a2; + break; + case 2: + temp_v1_4 = temp_t0 >> 7; + phi_f16 = (temp_a3 * 2) - temp_v1_4; + if (phi_f16 < 0) { + phi_f16 += 4294967296.0f; + } + fast3d_cmd( + (*dlist)++, + (((s32)((temp_a3 + temp_v1_4) * 4.0f)) & 0xFFF) | 0xED000000, + ((((s32)((temp_a2 - (temp_t1_2 >> 8)) * 4.0f)) & 0xFFF) << 0xC) | (((s32)(phi_f16 * 4.0f)) & 0xFFF) + ) + phi_t5 = temp_a3; + phi_t4 = 0U; + break; + case 3: + temp_a0 = temp_t1_2 >> 8; + temp_v1_3 = temp_t0 >> 7; + phi_f6 = (temp_a2 * 2) - temp_a0; + if (phi_f6 < 0) { + phi_f6 += 4294967296.0f; + } + phi_f18 = (temp_a3 * 2) - temp_v1_3; + if (phi_f18 < 0) { + phi_f18 += 4294967296.0f; + } + fast3d_cmd( + (*dlist)++, + (((((s32)((temp_a2 + temp_a0) * 4.0f)) & 0xFFF) << 0xC) | 0xED000000) | (((s32)((temp_a3 + temp_v1_3) * 4.0f)) & 0xFFF), + ((((s32)(phi_f6 * 4.0f) & 0xFFF)) << 0xC) | (((s32)(phi_f18 * 4.0f)) & 0xFFF) + ) + phi_t5 = temp_a3; + phi_t4 = temp_a2; + break; + default: + phi_t5 = 0; + phi_t4 = 0; + break; + } + temp_v0_3 = phi_t5 + sp58; + temp_a3_2 = phi_t4 + sp54; + phi_t3 = temp_v0_3; + phi_a3_2 = temp_a3_2; + if (osTvType == 0) { + phi_t3 = temp_v0_3 - 6; + phi_a3_2 = temp_a3_2; + if (D_80120CE4 < 2) { + phi_t3 = temp_v0_3 - 0x14; + phi_a3_2 = temp_a3_2; + } + } + break; + default: + phi_t3 = sp50; + phi_a3_2 = sp4C; + break; + } + + if (osTvType == 0) { + phi_a3_2 -= 4; + } + func_80068158(dlist, sp54, sp58, phi_a3_2, phi_t3); + if (arg1 != 0) { + func_80067D3C(dlist, arg1); + } + D_80120CE4 = sp34; +} +#endif + +GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_80067A3C.s") +GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_80067D3C.s") + +void func_80067F20(f32 arg0) { + D_800DD2CC[0] = arg0; +} + +GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_80067F2C.s") + +void func_8006807C(Gfx **dlist, s32 *arg1) { + func_8006FE74(&D_80121060, &D_800DD288); + func_8006F768(&D_80121060, &D_80120EE0, &D_80120F20); + func_8006FE74(D_80120D70[0], &D_800DD2A0); + func_8006F768(D_80120D70[0], &D_80120F20, &D_80121060); + func_8006F870(&D_80121060, (s32*)*arg1); // This doesn't look right. Need to check this! + fast3d_cmd((*dlist)++, 0x1000040, (u32)(*arg1 + 0x80000000)) + *arg1 += 0x40; + D_80120D1C = 0; + D_80120D08 = 0; +} + +GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_80068158.s") +GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_800682AC.s") + +void func_80068408(Gfx **dlist, s32 *arg1) { + func_800705F8(D_80120D70[D_80120D1C], 0.0f, 0.0f, 0.0f); + func_8006F768(D_80120D70[D_80120D1C], &D_80120F20, &D_80121060); + func_8006F870(&D_80121060, (s32*)*arg1); // This doesn't look right. Need to check this! + D_80120D88[D_80120D1C] = *arg1; + + fast3d_cmd((*dlist)++, ((((D_80120D08 << 6) & 0xFF) << 0x10) | 0x1000000) | 0x40, (u32)(*arg1 + 0x80000000)) + + *arg1 += 0x40; +} + +void func_80068508(s32 arg0) { + D_80120D0C = arg0; +} + +GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_80068514.s") +GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_80068BF4.s") +GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_80068FA8.s") +GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_80069484.s") +GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_80069790.s") +GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_80069A40.s") + +unk80120AC0 *func_80069CFC(void) { + return &D_80120AC0[D_80120CE4]; +} + +unk80120AC0 *func_80069D20(void) { + if (D_80120D14 != 0) { + return &D_80120AC0[D_80120CE4 + 4]; + } + return &D_80120AC0[D_80120CE4]; +} + +unk80120AC0 *func_80069D7C(void) { + if (D_80120D14 != 0) { + return &D_80120AC0[4]; + } + return &D_80120AC0[0]; +} + +s32* func_80069DA4(void) { + return &D_80120FA0; +} + +s32* func_80069DB0(void) { + return &D_80120FE0; +} + +s32* func_80069DBC(void) { + return &D_80120F60; +} + +f32 func_80069DC8(f32 arg0, f32 arg1, f32 arg2) { + f32 sp34; + f32 sp30; + f32 returnVal; + func_8006F64C(&D_80120F60, arg0, arg1, arg2, &sp34, &sp30, &returnVal); + return returnVal; +} + +void func_80069E14(f32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { + f32 temp_f0; + f32 temp_f0_2; + f32 temp_f14; + f32 temp_f2; + s32 i; + + for (i = 0; i <= D_80120CE0; i++) { + temp_f0 = arg0 - D_80120AC0[i].x_position; + temp_f2 = arg1 - D_80120AC0[i].y_position; + temp_f14 = arg2 - D_80120AC0[i].z_position; + temp_f0_2 = sqrtf(((temp_f0 * temp_f0) + (temp_f2 * temp_f2)) + (temp_f14 * temp_f14)); + if (temp_f0_2 < arg3) { + D_80120AC0[i].unk30 = ((arg3 - temp_f0_2) * arg4) / arg3; + } + } +} + +GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_80069F28.s") + +s32* func_8006A100(void) { + return &D_801210E0; +} + +#if 1 +GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_8006A10C.s") +#else + +extern s32 D_800DD300; +extern s32 D_801210F8; +extern s32 D_801210FC; +extern s8 D_80121100; +extern u8 D_80121100+3; + +// Has regalloc & stack issues. +s32 func_8006A10C(void) { + u8 sp23; + osCreateMesgQueue(&D_801210E0, &D_801210F8, 1); + osSetEventMesg(5, &D_801210E0, D_801210FC); + func_800CCC20(&D_801210E0, &sp23, &D_80121100); + func_800CCFE0(&D_801210E0); + func_8006A434(); + D_800DD300 = 0; + if ((sp23 & 1) && !(D_80121100+3 & 8)) { + return 0; + } + D_800DD300 = 1; + return -1; +} +#endif + +GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_8006A1C4.s") +GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_8006A434.s") + +void func_8006A458(s8 *activePlayers) { + s32 i; + s32 temp = 0; + for(i = 0; i < 4; i++) { + if (activePlayers[i]) { + D_80121150[temp++] = i; + } + } + for(i = 0; i < 4; i++) { + if (!activePlayers[i]) { + D_80121150[temp++] = i; + } + } +} + +u8 func_8006A4F8(s32 arg0) { + return D_80121150[arg0]; +} + +void func_8006A50C(void) { + u8 temp = D_80121150[0]; + D_80121150[0] = D_80121150[1]; + D_80121150[1] = temp; +} + +u16 func_8006A528(s32 arg0) { + return D_80121110[D_80121150[arg0]].unk0; +} + +u16 func_8006A554(s32 arg0) { + return D_80121140[D_80121150[arg0]]; +} + +u16 func_8006A578(s32 arg0) { + return D_80121148[D_80121150[arg0]]; +} + +s32 func_8006A59C(s32 arg0) { + func_8006A624(D_80121110[D_80121150[arg0]].unk2); +} + +s32 func_8006A5E0(s32 arg0) { + func_8006A624(D_80121110[D_80121150[arg0]].unk3); +} + +s32 func_8006A624(s8 arg0) { + if (arg0 < 8 && arg0 >= -7) { + return 0; + } + if (arg0 > 0) { + arg0 -= 8; + if (arg0 >= 0x47) { + arg0 = 0x46; + } + } else { + arg0 += 8; + if (arg0 < -0x46) { + arg0 = -0x46; + } + } + return arg0; +} + +void func_8006A6A0(void) { + D_800DD304 = 0; +} diff --git a/src/unknown_06B2B0.c b/src/unknown_06B2B0.c index 37ff8f82..94e2caaa 100644 --- a/src/unknown_06B2B0.c +++ b/src/unknown_06B2B0.c @@ -115,32 +115,35 @@ s32 D_800DD424[2] = { /*******************************/ - extern s32 D_800DFD94; -extern s32 D_80121164; -extern LevelHeader* D_80121168; +/************ .bss ************/ -extern s32 D_80121170; -extern s32 D_80121174; +s32 D_80121160; +s32 D_80121164; +LevelHeader* D_80121168; +s32 D_8012116C; +s32 D_80121170; +s32 D_80121174; -// Size: 6 bytes -typedef struct unk8012117C { +// Unknown size +typedef struct unk80121178 { s8 unk0; s8 unk1; s8 unk2; s8 pad3[3]; -} unk8012117C; -extern unk8012117C *D_8012117C[2]; // Unknown number of entries +} unk80121178; +unk80121178 *D_80121178[2]; +s32 D_80121180; -extern s32 D_801211C0; -extern s16 D_801211C8[8]; // Unknown number of entries -extern Gfx *D_801211F0[3]; // Unknown number of entries. +extern s32 D_801211C0[2]; +extern s16 D_801211C8[8]; +extern Gfx *D_801211F0[3]; extern Gfx *D_801211F8; extern s32 D_80121208; extern s32 D_80121218; extern s32 D_80121228; -extern s8 D_80121250[16]; // Unknown number of entries +extern s8 D_80121250[16]; extern s32 D_801234E8; extern s32 D_801234EC; extern s32 D_801234F0; @@ -163,6 +166,8 @@ extern u8 D_80123526; extern s32* D_80123548; // This is actually an OSMesgQueue pointer. extern s32 D_80123560; +/******************************/ + void func_800014BC(f32 arg0); s8* func_8001E29C(s32 arg0); s32 func_8006A624(s8 arg0); @@ -186,14 +191,14 @@ GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_8006A6B0.s") s32 func_8006B0AC(s32 arg0) { if (arg0 > 0 && arg0 < D_80121170) { - return (*D_8012117C)[arg0].unk2 & 0xF; + return D_80121178[1][arg0].unk2 & 0xF; } return 0; } s32 func_8006B0F8(s32 arg0) { if (arg0 > 0 && arg0 < D_80121170) { - s32 temp = (*D_8012117C)[arg0].unk2; + s32 temp = D_80121178[1][arg0].unk2; if(temp != 0) { return (temp >> 4) & 0xF; } @@ -203,14 +208,14 @@ s32 func_8006B0F8(s32 arg0) { s8 func_8006B14C(s32 arg0) { if (arg0 >= 0 && arg0 < D_80121170) { - return (*D_8012117C)[arg0].unk1; + return D_80121178[1][arg0].unk1; } return -1; } s8 func_8006B190(s32 arg0) { if (arg0 >= 0 && arg0 < D_80121170) { - return (*D_8012117C)[arg0].unk0; + return D_80121178[1][arg0].unk0; } return 0; } @@ -240,9 +245,6 @@ s32 func_8006B240(void) { GLOBAL_ASM("asm/non_matchings/unknown_066AA0/func_8006B250.s") #else -extern s32 *D_80121160; -extern s32 D_800DD314; - Settings *get_settings(void); s32 *func_80076C58(s32); LevelHeader *func_80070C9C(s32, s32); @@ -556,7 +558,6 @@ void func_8006BEFC(void) { } } -extern s32 *D_80121160; Settings *get_settings(void); s32 *func_80076C58(s32); @@ -609,18 +610,18 @@ void func_8006BFC8(s8 *arg0) { } temp2 = D_80121160[phi_s0]; temp = D_80121160[phi_s0 + 1] - temp2; - D_801211C0 = func_80070C9C(temp, 0xFFFF00FF, D_80121160); - func_80076E68(0, D_801211C0, temp2, temp); + D_801211C0[0] = func_80070C9C(temp, 0xFFFF00FF, D_80121160); + func_80076E68(0, D_801211C0[0], temp2, temp); func_80071140(D_80121160); } #endif void func_8006C164(void) { - func_80071140(D_801211C0); + func_80071140(D_801211C0[0]); } s32 func_8006C18C(void) { - return D_801211C0; + return D_801211C0[0]; } s8 func_8006C19C(void) { diff --git a/undefined_syms.txt b/undefined_syms.txt index 043adce3..b806f1ac 100755 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -25,67 +25,6 @@ osAppNMIBuffer = 0x8000031C; D_800E0001 = 0x800E0001; eqpower = 0x800E37A0; -/D_8011D750 = 0x8011D750; -/D_8011D758 = 0x8011D758; -/D_8011F758 = 0x8011F758; -/D_8011F760 = 0x8011F760; -/D_8011F910 = 0x8011F910; - -D_80120AC0 = 0x80120AC0; -D_80120AC4 = 0x80120AC4; -D_80120AF4 = 0x80120AF4; -D_80120BD0 = 0x80120BD0; -D_80120BD4 = 0x80120BD4; -D_80120CE0 = 0x80120CE0; -D_80120CE4 = 0x80120CE4; -D_80120CE8 = 0x80120CE8; -D_80120CF0 = 0x80120CF0; -D_80120D08 = 0x80120D08; -D_80120D0C = 0x80120D0C; -D_80120D10 = 0x80120D10; -D_80120D14 = 0x80120D14; -D_80120D15 = 0x80120D15; -D_80120D18 = 0x80120D18; -D_80120D1C = 0x80120D1C; -D_80120D20 = 0x80120D20; -D_80120D28 = 0x80120D28; -D_80120D40 = 0x80120D40; -D_80120D58 = 0x80120D58; -D_80120D6C = 0x80120D6C; -D_80120D70 = 0x80120D70; -D_80120D74 = 0x80120D74; -D_80120D88 = 0x80120D88; -D_80120DA0 = 0x80120DA0; -D_80120EE0 = 0x80120EE0; -D_80120F20 = 0x80120F20; -D_80120F60 = 0x80120F60; -D_80120FA0 = 0x80120FA0; -D_80120FE0 = 0x80120FE0; -D_80121020 = 0x80121020; -D_80121060 = 0x80121060; -D_801210A0 = 0x801210A0; -D_801210E0 = 0x801210E0; -D_801210F8 = 0x801210F8; -D_801210FC = 0x801210FC; -D_80121100 = 0x80121100; -D_80121103 = 0x80121103; -D_80121110 = 0x80121110; -D_80121128 = 0x80121128; -D_80121140 = 0x80121140; -D_80121148 = 0x80121148; -D_80121150 = 0x80121150; -D_80121151 = 0x80121151; -D_80121152 = 0x80121152; -D_80121153 = 0x80121153; -D_80121160 = 0x80121160; -D_80121164 = 0x80121164; -D_80121168 = 0x80121168; -D_8012116C = 0x8012116C; -D_80121170 = 0x80121170; -D_80121174 = 0x80121174; -D_80121178 = 0x80121178; -D_8012117C = 0x8012117C; -D_80121180 = 0x80121180; D_801211C0 = 0x801211C0; D_801211C8 = 0x801211C8; D_801211F0 = 0x801211F0;