From 06cd1ebcf29fe93b594d7d50e554e429ad66476f Mon Sep 17 00:00:00 2001 From: David Benepe Date: Sun, 15 Aug 2021 16:47:35 -0500 Subject: [PATCH] Decompiled 7 functions between menu.c and camera.c --- README.md | 12 +- asm/non_matchings/camera/func_80067F2C.s | 87 ---- asm/non_matchings/camera/func_80068158.s | 92 ---- asm/non_matchings/camera/func_800682AC.s | 93 ---- asm/non_matchings/camera/func_80069F28.s | 151 ------ asm/non_matchings/camera/func_80069F64.s | 73 +++ asm/non_matchings/camera/func_8006A434.s | 11 - ...aw_menu_element.s => draw_menu_elements.s} | 2 +- asm/non_matchings/menu/func_80081F4C.s | 2 +- asm/non_matchings/menu/func_80088938.s | 2 +- asm/non_matchings/menu/func_8008C698.s | 2 +- asm/non_matchings/menu/func_80094170.s | 2 +- asm/non_matchings/menu/func_80095728.s | 2 +- asm/non_matchings/menu/func_80098EBC.s | 2 +- asm/non_matchings/menu/func_8009E7E8.s | 118 ----- .../menu/menu_magic_codes_list_loop.s | 2 +- .../menu/menu_trophy_race_rankings_loop.s | 4 +- ....s => render_magic_codes_list_menu_text.s} | 2 +- ..._8009BF20.s => update_controller_sticks.s} | 2 +- include/structs.h | 32 +- src/camera.c | 195 +++++++- src/camera.h | 8 +- src/menu.c | 430 +++++++++++++++--- src/menu.h | 2 +- 24 files changed, 658 insertions(+), 670 deletions(-) delete mode 100644 asm/non_matchings/camera/func_80067F2C.s delete mode 100644 asm/non_matchings/camera/func_80068158.s delete mode 100644 asm/non_matchings/camera/func_800682AC.s delete mode 100644 asm/non_matchings/camera/func_80069F28.s create mode 100644 asm/non_matchings/camera/func_80069F64.s delete mode 100644 asm/non_matchings/camera/func_8006A434.s rename asm/non_matchings/menu/{draw_menu_element.s => draw_menu_elements.s} (99%) delete mode 100644 asm/non_matchings/menu/func_8009E7E8.s rename asm/non_matchings/menu/{func_8008A56C.s => render_magic_codes_list_menu_text.s} (99%) rename asm/non_matchings/menu/{func_8009BF20.s => update_controller_sticks.s} (99%) diff --git a/README.md b/README.md index 3d982ace..af052b88 100755 --- a/README.md +++ b/README.md @@ -113,14 +113,14 @@ s32 is_drumstick_unlocked(void) { } ``` -As of August 14th 2021, this is our current score: +As of August 15th 2021, this is our current score: ``` ======================================================= ADVENTURE ONE (ASM -> C Decompilation) - ------------------- 13.80% Complete ------------------- - # Decompiled functions: 867 - # GLOBAL_ASM remaining: 908 - # NON_MATCHING functions: 86 + ------------------- 14.00% Complete ------------------- + # Decompiled functions: 874 + # GLOBAL_ASM remaining: 903 + # NON_MATCHING functions: 92 --------------------- Game Status --------------------- Balloons: 8/47, Keys: 1/4, Trophies: 0/5 T.T. Amulets: 0/4, Wizpig Amulets: 0/4 @@ -130,7 +130,7 @@ As of August 14th 2021, this is our current score: ADVENTURE TWO (Cleanup & Documentation) ------------------- 0.75% Complete ------------------- # Documented functions: 61 - # Undocumented remaining: 1714 + # Undocumented remaining: 1716 --------------------- Game Status --------------------- Balloons: 0/47, Keys: 0/4, Trophies: 0/5 T.T. Amulets: 0/4, Wizpig Amulets: 0/4 diff --git a/asm/non_matchings/camera/func_80067F2C.s b/asm/non_matchings/camera/func_80067F2C.s deleted file mode 100644 index 2633ad27..00000000 --- a/asm/non_matchings/camera/func_80067F2C.s +++ /dev/null @@ -1,87 +0,0 @@ -glabel func_80067F2C -/* 068B2C 80067F2C 27BDFFD0 */ addiu $sp, $sp, -0x30 -/* 068B30 80067F30 AFBF001C */ sw $ra, 0x1c($sp) -/* 068B34 80067F34 AFB00018 */ sw $s0, 0x18($sp) -/* 068B38 80067F38 00A08025 */ move $s0, $a1 -/* 068B3C 80067F3C 0C01E948 */ jal get_video_width_and_height_as_s32 -/* 068B40 80067F40 AFA40030 */ sw $a0, 0x30($sp) -/* 068B44 80067F44 00027402 */ srl $t6, $v0, 0x10 -/* 068B48 80067F48 304FFFFF */ andi $t7, $v0, 0xffff -/* 068B4C 80067F4C AFAE0024 */ sw $t6, 0x24($sp) -/* 068B50 80067F50 AFAF0028 */ sw $t7, 0x28($sp) -/* 068B54 80067F54 8E050000 */ lw $a1, ($s0) -/* 068B58 80067F58 3C04800E */ lui $a0, %hi(D_800DD2B8) # $a0, 0x800e -/* 068B5C 80067F5C 0C01BE1C */ jal func_8006F870 -/* 068B60 80067F60 2484D2B8 */ addiu $a0, %lo(D_800DD2B8) # addiu $a0, $a0, -0x2d48 -/* 068B64 80067F64 8E180000 */ lw $t8, ($s0) -/* 068B68 80067F68 3C0C8012 */ lui $t4, %hi(D_80120CE4) # $t4, 0x8012 -/* 068B6C 80067F6C 3C018012 */ lui $at, %hi(D_80120D88) # $at, 0x8012 -/* 068B70 80067F70 258C0CE4 */ addiu $t4, %lo(D_80120CE4) # addiu $t4, $t4, 0xce4 -/* 068B74 80067F74 AC380D88 */ sw $t8, %lo(D_80120D88)($at) -/* 068B78 80067F78 8D990000 */ lw $t9, ($t4) -/* 068B7C 80067F7C 3C0B800E */ lui $t3, %hi(D_800DD148) # $t3, 0x800e -/* 068B80 80067F80 8FA60028 */ lw $a2, 0x28($sp) -/* 068B84 80067F84 256BD148 */ addiu $t3, %lo(D_800DD148) # addiu $t3, $t3, -0x2eb8 -/* 068B88 80067F88 00196900 */ sll $t5, $t9, 4 -/* 068B8C 80067F8C 016D2821 */ addu $a1, $t3, $t5 -/* 068B90 80067F90 8FAF0024 */ lw $t7, 0x24($sp) -/* 068B94 80067F94 00067040 */ sll $t6, $a2, 1 -/* 068B98 80067F98 8FA90030 */ lw $t1, 0x30($sp) -/* 068B9C 80067F9C 000FC040 */ sll $t8, $t7, 1 -/* 068BA0 80067FA0 A4AE0050 */ sh $t6, 0x50($a1) -/* 068BA4 80067FA4 A4AE0052 */ sh $t6, 0x52($a1) -/* 068BA8 80067FA8 A4AE0058 */ sh $t6, 0x58($a1) -/* 068BAC 80067FAC A4B8005A */ sh $t8, 0x5a($a1) -/* 068BB0 80067FB0 8D240000 */ lw $a0, ($t1) -/* 068BB4 80067FB4 3C0D0380 */ lui $t5, (0x03800010 >> 16) # lui $t5, 0x380 -/* 068BB8 80067FB8 24990008 */ addiu $t9, $a0, 8 -/* 068BBC 80067FBC 35AD0010 */ ori $t5, (0x03800010 & 0xFFFF) # ori $t5, $t5, 0x10 -/* 068BC0 80067FC0 AD390000 */ sw $t9, ($t1) -/* 068BC4 80067FC4 AC8D0000 */ sw $t5, ($a0) -/* 068BC8 80067FC8 8D8E0000 */ lw $t6, ($t4) -/* 068BCC 80067FCC 3C018000 */ lui $at, (0x80000050 >> 16) # lui $at, 0x8000 -/* 068BD0 80067FD0 000E7900 */ sll $t7, $t6, 4 -/* 068BD4 80067FD4 016FC021 */ addu $t8, $t3, $t7 -/* 068BD8 80067FD8 34210050 */ ori $at, (0x80000050 & 0xFFFF) # ori $at, $at, 0x50 -/* 068BDC 80067FDC 0301C821 */ addu $t9, $t8, $at -/* 068BE0 80067FE0 AC990004 */ sw $t9, 4($a0) -/* 068BE4 80067FE4 8D240000 */ lw $a0, ($t1) -/* 068BE8 80067FE8 3C0E0100 */ lui $t6, (0x01000040 >> 16) # lui $t6, 0x100 -/* 068BEC 80067FEC 248D0008 */ addiu $t5, $a0, 8 -/* 068BF0 80067FF0 35CE0040 */ ori $t6, (0x01000040 & 0xFFFF) # ori $t6, $t6, 0x40 -/* 068BF4 80067FF4 AD2D0000 */ sw $t5, ($t1) -/* 068BF8 80067FF8 AC8E0000 */ sw $t6, ($a0) -/* 068BFC 80067FFC 8E0F0000 */ lw $t7, ($s0) -/* 068C00 80068000 3C018000 */ lui $at, 0x8000 -/* 068C04 80068004 01E1C021 */ addu $t8, $t7, $at -/* 068C08 80068008 AC980004 */ sw $t8, 4($a0) -/* 068C0C 8006800C 8E190000 */ lw $t9, ($s0) -/* 068C10 80068010 3C018012 */ lui $at, %hi(D_80120D1C) # $at, 0x8012 -/* 068C14 80068014 272D0040 */ addiu $t5, $t9, 0x40 -/* 068C18 80068018 AE0D0000 */ sw $t5, ($s0) -/* 068C1C 8006801C AC200D1C */ sw $zero, %lo(D_80120D1C)($at) -/* 068C20 80068020 3C018012 */ lui $at, %hi(D_80120D08) # $at, 0x8012 -/* 068C24 80068024 3C04800E */ lui $a0, %hi(D_800DD2F8) # $a0, 0x800e -/* 068C28 80068028 3C038012 */ lui $v1, %hi(D_80120F20) # $v1, 0x8012 -/* 068C2C 8006802C 3C02800E */ lui $v0, %hi(D_800DD2B8) # $v0, 0x800e -/* 068C30 80068030 AC200D08 */ sw $zero, %lo(D_80120D08)($at) -/* 068C34 80068034 2442D2B8 */ addiu $v0, %lo(D_800DD2B8) # addiu $v0, $v0, -0x2d48 -/* 068C38 80068038 24630F20 */ addiu $v1, %lo(D_80120F20) # addiu $v1, $v1, 0xf20 -/* 068C3C 8006803C 2484D2F8 */ addiu $a0, %lo(D_800DD2F8) # addiu $a0, $a0, -0x2d08 -.L80068040: -/* 068C40 80068040 C4440000 */ lwc1 $f4, ($v0) -/* 068C44 80068044 C4460004 */ lwc1 $f6, 4($v0) -/* 068C48 80068048 C4480008 */ lwc1 $f8, 8($v0) -/* 068C4C 8006804C C44A000C */ lwc1 $f10, 0xc($v0) -/* 068C50 80068050 24420010 */ addiu $v0, $v0, 0x10 -/* 068C54 80068054 24630010 */ addiu $v1, $v1, 0x10 -/* 068C58 80068058 E464FFF0 */ swc1 $f4, -0x10($v1) -/* 068C5C 8006805C E466FFF4 */ swc1 $f6, -0xc($v1) -/* 068C60 80068060 E468FFF8 */ swc1 $f8, -8($v1) -/* 068C64 80068064 1444FFF6 */ bne $v0, $a0, .L80068040 -/* 068C68 80068068 E46AFFFC */ swc1 $f10, -4($v1) -/* 068C6C 8006806C 8FBF001C */ lw $ra, 0x1c($sp) -/* 068C70 80068070 8FB00018 */ lw $s0, 0x18($sp) -/* 068C74 80068074 03E00008 */ jr $ra -/* 068C78 80068078 27BD0030 */ addiu $sp, $sp, 0x30 - diff --git a/asm/non_matchings/camera/func_80068158.s b/asm/non_matchings/camera/func_80068158.s deleted file mode 100644 index 2cc286ef..00000000 --- a/asm/non_matchings/camera/func_80068158.s +++ /dev/null @@ -1,92 +0,0 @@ -glabel func_80068158 -/* 068D58 80068158 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 068D5C 8006815C AFBF0014 */ sw $ra, 0x14($sp) -/* 068D60 80068160 AFA40018 */ sw $a0, 0x18($sp) -/* 068D64 80068164 AFA60020 */ sw $a2, 0x20($sp) -/* 068D68 80068168 AFA70024 */ sw $a3, 0x24($sp) -/* 068D6C 8006816C 0C0270C3 */ jal get_filtered_cheats -/* 068D70 80068170 AFA5001C */ sw $a1, 0x1c($sp) -/* 068D74 80068174 8FA5001C */ lw $a1, 0x1c($sp) -/* 068D78 80068178 8FA80018 */ lw $t0, 0x18($sp) -/* 068D7C 8006817C 8FA90020 */ lw $t1, 0x20($sp) -/* 068D80 80068180 304E0004 */ andi $t6, $v0, 4 -/* 068D84 80068184 11C00003 */ beqz $t6, .L80068194 -/* 068D88 80068188 3C0F800E */ lui $t7, %hi(D_800DD060) # $t7, 0x800e -/* 068D8C 8006818C 10000002 */ b .L80068198 -/* 068D90 80068190 00053023 */ negu $a2, $a1 -.L80068194: -/* 068D94 80068194 00A03025 */ move $a2, $a1 -.L80068198: -/* 068D98 80068198 81EFD060 */ lb $t7, %lo(D_800DD060)($t7) -/* 068D9C 8006819C 3C078012 */ lui $a3, %hi(D_80120CE4) # $a3, 0x8012 -/* 068DA0 800681A0 11E00003 */ beqz $t7, .L800681B0 -/* 068DA4 800681A4 24E70CE4 */ addiu $a3, %lo(D_80120CE4) # addiu $a3, $a3, 0xce4 -/* 068DA8 800681A8 00094823 */ negu $t1, $t1 -/* 068DAC 800681AC 00053023 */ negu $a2, $a1 -.L800681B0: -/* 068DB0 800681B0 8CE50000 */ lw $a1, ($a3) -/* 068DB4 800681B4 3C19800E */ lui $t9, %hi(gScreenViewports + 0x30) # $t9, 0x800e -/* 068DB8 800681B8 0005C080 */ sll $t8, $a1, 2 -/* 068DBC 800681BC 0305C023 */ subu $t8, $t8, $a1 -/* 068DC0 800681C0 0018C080 */ sll $t8, $t8, 2 -/* 068DC4 800681C4 0305C021 */ addu $t8, $t8, $a1 -/* 068DC8 800681C8 0018C080 */ sll $t8, $t8, 2 -/* 068DCC 800681CC 0338C821 */ addu $t9, $t9, $t8 -/* 068DD0 800681D0 8F39D094 */ lw $t9, %lo(gScreenViewports + 0x30)($t9) -/* 068DD4 800681D4 3C0A800E */ lui $t2, %hi(D_800DD148) # $t2, 0x800e -/* 068DD8 800681D8 332B0001 */ andi $t3, $t9, 1 -/* 068DDC 800681DC 1560001A */ bnez $t3, .L80068248 -/* 068DE0 800681E0 254AD148 */ addiu $t2, %lo(D_800DD148) # addiu $t2, $t2, -0x2eb8 -/* 068DE4 800681E4 00056100 */ sll $t4, $a1, 4 -/* 068DE8 800681E8 014C1021 */ addu $v0, $t2, $t4 -/* 068DEC 800681EC 8FAD0024 */ lw $t5, 0x24($sp) -/* 068DF0 800681F0 8FAF0028 */ lw $t7, 0x28($sp) -/* 068DF4 800681F4 0006C880 */ sll $t9, $a2, 2 -/* 068DF8 800681F8 00095880 */ sll $t3, $t1, 2 -/* 068DFC 800681FC 000D7080 */ sll $t6, $t5, 2 -/* 068E00 80068200 000FC080 */ sll $t8, $t7, 2 -/* 068E04 80068204 A44E0008 */ sh $t6, 8($v0) -/* 068E08 80068208 A458000A */ sh $t8, 0xa($v0) -/* 068E0C 8006820C A4590000 */ sh $t9, ($v0) -/* 068E10 80068210 A44B0002 */ sh $t3, 2($v0) -/* 068E14 80068214 8D040000 */ lw $a0, ($t0) -/* 068E18 80068218 3C0D0380 */ lui $t5, (0x03800010 >> 16) # lui $t5, 0x380 -/* 068E1C 8006821C 248C0008 */ addiu $t4, $a0, 8 -/* 068E20 80068220 AD0C0000 */ sw $t4, ($t0) -/* 068E24 80068224 35AD0010 */ ori $t5, (0x03800010 & 0xFFFF) # ori $t5, $t5, 0x10 -/* 068E28 80068228 AC8D0000 */ sw $t5, ($a0) -/* 068E2C 8006822C 8CEE0000 */ lw $t6, ($a3) -/* 068E30 80068230 3C018000 */ lui $at, 0x8000 -/* 068E34 80068234 000E7900 */ sll $t7, $t6, 4 -/* 068E38 80068238 014FC021 */ addu $t8, $t2, $t7 -/* 068E3C 8006823C 0301C821 */ addu $t9, $t8, $at -/* 068E40 80068240 10000016 */ b .L8006829C -/* 068E44 80068244 AC990004 */ sw $t9, 4($a0) -.L80068248: -/* 068E48 80068248 8D040000 */ lw $a0, ($t0) -/* 068E4C 8006824C 3C0C0380 */ lui $t4, (0x03800010 >> 16) # lui $t4, 0x380 -/* 068E50 80068250 248B0008 */ addiu $t3, $a0, 8 -/* 068E54 80068254 AD0B0000 */ sw $t3, ($t0) -/* 068E58 80068258 358C0010 */ ori $t4, (0x03800010 & 0xFFFF) # ori $t4, $t4, 0x10 -/* 068E5C 8006825C 3C18800E */ lui $t8, %hi(D_800DD134) # $t8, 0x800e -/* 068E60 80068260 AC8C0000 */ sw $t4, ($a0) -/* 068E64 80068264 8F18D134 */ lw $t8, %lo(D_800DD134)($t8) -/* 068E68 80068268 8CED0000 */ lw $t5, ($a3) -/* 068E6C 8006826C 3C0A800E */ lui $t2, %hi(D_800DD148) # $t2, 0x800e -/* 068E70 80068270 0018C880 */ sll $t9, $t8, 2 -/* 068E74 80068274 254AD148 */ addiu $t2, %lo(D_800DD148) # addiu $t2, $t2, -0x2eb8 -/* 068E78 80068278 0338C821 */ addu $t9, $t9, $t8 -/* 068E7C 8006827C 000D7100 */ sll $t6, $t5, 4 -/* 068E80 80068280 014E7821 */ addu $t7, $t2, $t6 -/* 068E84 80068284 00195900 */ sll $t3, $t9, 4 -/* 068E88 80068288 3C018000 */ lui $at, (0x800000A0 >> 16) # lui $at, 0x8000 -/* 068E8C 8006828C 342100A0 */ ori $at, (0x800000A0 & 0xFFFF) # ori $at, $at, 0xa0 -/* 068E90 80068290 01EB6021 */ addu $t4, $t7, $t3 -/* 068E94 80068294 01816821 */ addu $t5, $t4, $at -/* 068E98 80068298 AC8D0004 */ sw $t5, 4($a0) -.L8006829C: -/* 068E9C 8006829C 8FBF0014 */ lw $ra, 0x14($sp) -/* 068EA0 800682A0 27BD0018 */ addiu $sp, $sp, 0x18 -/* 068EA4 800682A4 03E00008 */ jr $ra -/* 068EA8 800682A8 00000000 */ nop - diff --git a/asm/non_matchings/camera/func_800682AC.s b/asm/non_matchings/camera/func_800682AC.s deleted file mode 100644 index ba135825..00000000 --- a/asm/non_matchings/camera/func_800682AC.s +++ /dev/null @@ -1,93 +0,0 @@ -glabel func_800682AC -/* 068EAC 800682AC 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 068EB0 800682B0 AFBF001C */ sw $ra, 0x1c($sp) -/* 068EB4 800682B4 240E0004 */ li $t6, 4 -/* 068EB8 800682B8 3C018012 */ lui $at, %hi(D_80120CE4) # $at, 0x8012 -/* 068EBC 800682BC AC2E0CE4 */ sw $t6, %lo(D_80120CE4)($at) -/* 068EC0 800682C0 0C01E948 */ jal get_video_width_and_height_as_s32 -/* 068EC4 800682C4 AFA40020 */ sw $a0, 0x20($sp) -/* 068EC8 800682C8 3C0F8012 */ lui $t7, %hi(D_80120CE4) # $t7, 0x8012 -/* 068ECC 800682CC 8DEF0CE4 */ lw $t7, %lo(D_80120CE4)($t7) -/* 068ED0 800682D0 3C19800E */ lui $t9, %hi(gScreenViewports + 0x30) # $t9, 0x800e -/* 068ED4 800682D4 000FC080 */ sll $t8, $t7, 2 -/* 068ED8 800682D8 030FC023 */ subu $t8, $t8, $t7 -/* 068EDC 800682DC 0018C080 */ sll $t8, $t8, 2 -/* 068EE0 800682E0 030FC021 */ addu $t8, $t8, $t7 -/* 068EE4 800682E4 0018C080 */ sll $t8, $t8, 2 -/* 068EE8 800682E8 0338C821 */ addu $t9, $t9, $t8 -/* 068EEC 800682EC 8F39D094 */ lw $t9, %lo(gScreenViewports + 0x30)($t9) -/* 068EF0 800682F0 8FA40020 */ lw $a0, 0x20($sp) -/* 068EF4 800682F4 332A0001 */ andi $t2, $t9, 1 -/* 068EF8 800682F8 00024402 */ srl $t0, $v0, 0x10 -/* 068EFC 800682FC 15400035 */ bnez $t2, .L800683D4 -/* 068F00 80068300 3049FFFF */ andi $t1, $v0, 0xffff -/* 068F04 80068304 8C820000 */ lw $v0, ($a0) -/* 068F08 80068308 252DFFFF */ addiu $t5, $t1, -1 -/* 068F0C 8006830C 448D2000 */ mtc1 $t5, $f4 -/* 068F10 80068310 3C014080 */ li $at, 0x40800000 # 4.000000 -/* 068F14 80068314 244B0008 */ addiu $t3, $v0, 8 -/* 068F18 80068318 44810000 */ mtc1 $at, $f0 -/* 068F1C 8006831C AC8B0000 */ sw $t3, ($a0) -/* 068F20 80068320 3C0CED00 */ lui $t4, 0xed00 -/* 068F24 80068324 AC4C0000 */ sw $t4, ($v0) -/* 068F28 80068328 05A10005 */ bgez $t5, .L80068340 -/* 068F2C 8006832C 468021A0 */ cvt.s.w $f6, $f4 -/* 068F30 80068330 3C014F80 */ li $at, 0x4F800000 # 4294967296.000000 -/* 068F34 80068334 44814000 */ mtc1 $at, $f8 -/* 068F38 80068338 00000000 */ nop -/* 068F3C 8006833C 46083180 */ add.s $f6, $f6, $f8 -.L80068340: -/* 068F40 80068340 46003282 */ mul.s $f10, $f6, $f0 -/* 068F44 80068344 250AFFFF */ addiu $t2, $t0, -1 -/* 068F48 80068348 448A9000 */ mtc1 $t2, $f18 -/* 068F4C 8006834C 444EF800 */ cfc1 $t6, $31 -/* 068F50 80068350 00000000 */ nop -/* 068F54 80068354 35C10003 */ ori $at, $t6, 3 -/* 068F58 80068358 38210002 */ xori $at, $at, 2 -/* 068F5C 8006835C 44C1F800 */ ctc1 $at, $31 -/* 068F60 80068360 3C014F80 */ li $at, 0x4F800000 # 4294967296.000000 -/* 068F64 80068364 46005424 */ cvt.w.s $f16, $f10 -/* 068F68 80068368 440F8000 */ mfc1 $t7, $f16 -/* 068F6C 8006836C 44CEF800 */ ctc1 $t6, $31 -/* 068F70 80068370 31F80FFF */ andi $t8, $t7, 0xfff -/* 068F74 80068374 0018CB00 */ sll $t9, $t8, 0xc -/* 068F78 80068378 05410004 */ bgez $t2, .L8006838C -/* 068F7C 8006837C 46809120 */ cvt.s.w $f4, $f18 -/* 068F80 80068380 44814000 */ mtc1 $at, $f8 -/* 068F84 80068384 00000000 */ nop -/* 068F88 80068388 46082100 */ add.s $f4, $f4, $f8 -.L8006838C: -/* 068F8C 8006838C 46002182 */ mul.s $f6, $f4, $f0 -/* 068F90 80068390 444BF800 */ cfc1 $t3, $31 -/* 068F94 80068394 00092842 */ srl $a1, $t1, 1 -/* 068F98 80068398 35610003 */ ori $at, $t3, 3 -/* 068F9C 8006839C 38210002 */ xori $at, $at, 2 -/* 068FA0 800683A0 44C1F800 */ ctc1 $at, $31 -/* 068FA4 800683A4 00083042 */ srl $a2, $t0, 1 -/* 068FA8 800683A8 460032A4 */ cvt.w.s $f10, $f6 -/* 068FAC 800683AC 00A03825 */ move $a3, $a1 -/* 068FB0 800683B0 440C5000 */ mfc1 $t4, $f10 -/* 068FB4 800683B4 44CBF800 */ ctc1 $t3, $31 -/* 068FB8 800683B8 318D0FFF */ andi $t5, $t4, 0xfff -/* 068FBC 800683BC 032D7025 */ or $t6, $t9, $t5 -/* 068FC0 800683C0 AC4E0004 */ sw $t6, 4($v0) -/* 068FC4 800683C4 0C01A056 */ jal func_80068158 -/* 068FC8 800683C8 AFA60010 */ sw $a2, 0x10($sp) -/* 068FCC 800683CC 1000000A */ b .L800683F8 -/* 068FD0 800683D0 8FBF001C */ lw $ra, 0x1c($sp) -.L800683D4: -/* 068FD4 800683D4 0C019E8F */ jal func_80067A3C -/* 068FD8 800683D8 AFA40020 */ sw $a0, 0x20($sp) -/* 068FDC 800683DC 8FA40020 */ lw $a0, 0x20($sp) -/* 068FE0 800683E0 00002825 */ move $a1, $zero -/* 068FE4 800683E4 00003025 */ move $a2, $zero -/* 068FE8 800683E8 00003825 */ move $a3, $zero -/* 068FEC 800683EC 0C01A056 */ jal func_80068158 -/* 068FF0 800683F0 AFA00010 */ sw $zero, 0x10($sp) -/* 068FF4 800683F4 8FBF001C */ lw $ra, 0x1c($sp) -.L800683F8: -/* 068FF8 800683F8 3C018012 */ lui $at, %hi(D_80120CE4) # $at, 0x8012 -/* 068FFC 800683FC AC200CE4 */ sw $zero, %lo(D_80120CE4)($at) -/* 069000 80068400 03E00008 */ jr $ra -/* 069004 80068404 27BD0020 */ addiu $sp, $sp, 0x20 - diff --git a/asm/non_matchings/camera/func_80069F28.s b/asm/non_matchings/camera/func_80069F28.s deleted file mode 100644 index d136f1a7..00000000 --- a/asm/non_matchings/camera/func_80069F28.s +++ /dev/null @@ -1,151 +0,0 @@ -.rdata -glabel D_800E7078 -.asciz "%x." -glabel D_800E707C -.asciz "%x " -.ascii "\0\0\0" # padding -glabel D_800E7084 -.asciz "\n" -.ascii "\0\0" # padding -glabel D_800E7088 -.asciz "\n" -.ascii "\0\0" # padding -glabel D_800E708C -.asciz "%f " -.ascii "\0\0\0" # padding -glabel D_800E7094 -.asciz "\n" -.ascii "\0\0" # padding -glabel D_800E7098 -.asciz "\n" -.ascii "\0\0" # padding - -.text -glabel func_80069F28 -/* 06AB28 80069F28 3C038012 */ lui $v1, %hi(gNumberOfViewports) # $v1, 0x8012 -/* 06AB2C 80069F2C 8C630CE0 */ lw $v1, %lo(gNumberOfViewports)($v1) -/* 06AB30 80069F30 3C0E8012 */ lui $t6, %hi(D_80120AC0) # $t6, 0x8012 -/* 06AB34 80069F34 04600009 */ bltz $v1, .L80069F5C -/* 06AB38 80069F38 25C20AC0 */ addiu $v0, $t6, %lo(D_80120AC0) -/* 06AB3C 80069F3C 00037900 */ sll $t7, $v1, 4 -/* 06AB40 80069F40 01E37821 */ addu $t7, $t7, $v1 -/* 06AB44 80069F44 000F7880 */ sll $t7, $t7, 2 -/* 06AB48 80069F48 01E22021 */ addu $a0, $t7, $v0 -.L80069F4C: -/* 06AB4C 80069F4C 24420044 */ addiu $v0, $v0, 0x44 -/* 06AB50 80069F50 0082082B */ sltu $at, $a0, $v0 -/* 06AB54 80069F54 1020FFFD */ beqz $at, .L80069F4C -/* 06AB58 80069F58 E44CFFEC */ swc1 $f12, -0x14($v0) -.L80069F5C: -/* 06AB5C 80069F5C 03E00008 */ jr $ra -/* 06AB60 80069F60 00000000 */ nop - -/* 06AB64 80069F64 27BDFFC0 */ addiu $sp, $sp, -0x40 -/* 06AB68 80069F68 AFBE0038 */ sw $fp, 0x38($sp) -/* 06AB6C 80069F6C AFB40028 */ sw $s4, 0x28($sp) -/* 06AB70 80069F70 AFB30024 */ sw $s3, 0x24($sp) -/* 06AB74 80069F74 AFB70034 */ sw $s7, 0x34($sp) -/* 06AB78 80069F78 AFB60030 */ sw $s6, 0x30($sp) -/* 06AB7C 80069F7C AFB5002C */ sw $s5, 0x2c($sp) -/* 06AB80 80069F80 3C13800E */ lui $s3, %hi(D_800E7078) # $s3, 0x800e -/* 06AB84 80069F84 3C14800E */ lui $s4, %hi(D_800E707C) # $s4, 0x800e -/* 06AB88 80069F88 3C1E800E */ lui $fp, %hi(D_800E7084) # $fp, 0x800e -/* 06AB8C 80069F8C AFBF003C */ sw $ra, 0x3c($sp) -/* 06AB90 80069F90 AFB20020 */ sw $s2, 0x20($sp) -/* 06AB94 80069F94 AFB1001C */ sw $s1, 0x1c($sp) -/* 06AB98 80069F98 AFB00018 */ sw $s0, 0x18($sp) -/* 06AB9C 80069F9C 27DE7084 */ addiu $fp, %lo(D_800E7084) # addiu $fp, $fp, 0x7084 -/* 06ABA0 80069FA0 2694707C */ addiu $s4, %lo(D_800E707C) # addiu $s4, $s4, 0x707c -/* 06ABA4 80069FA4 26737078 */ addiu $s3, %lo(D_800E7078) # addiu $s3, $s3, 0x7078 -/* 06ABA8 80069FA8 24150008 */ li $s5, 8 -/* 06ABAC 80069FAC 0000B025 */ move $s6, $zero -/* 06ABB0 80069FB0 0080B825 */ move $s7, $a0 -.L80069FB4: -/* 06ABB4 80069FB4 00008825 */ move $s1, $zero -/* 06ABB8 80069FB8 02E08025 */ move $s0, $s7 -.L80069FBC: -/* 06ABBC 80069FBC 86050000 */ lh $a1, ($s0) -/* 06ABC0 80069FC0 0C032755 */ jal func_800C9D54 -/* 06ABC4 80069FC4 02602025 */ move $a0, $s3 -/* 06ABC8 80069FC8 86050020 */ lh $a1, 0x20($s0) -/* 06ABCC 80069FCC 02802025 */ move $a0, $s4 -/* 06ABD0 80069FD0 30AEFFFF */ andi $t6, $a1, 0xffff -/* 06ABD4 80069FD4 0C032755 */ jal func_800C9D54 -/* 06ABD8 80069FD8 01C02825 */ move $a1, $t6 -/* 06ABDC 80069FDC 26310002 */ addiu $s1, $s1, 2 -/* 06ABE0 80069FE0 1635FFF6 */ bne $s1, $s5, .L80069FBC -/* 06ABE4 80069FE4 26100002 */ addiu $s0, $s0, 2 -/* 06ABE8 80069FE8 0C032755 */ jal func_800C9D54 -/* 06ABEC 80069FEC 03C02025 */ move $a0, $fp -/* 06ABF0 80069FF0 26D60004 */ addiu $s6, $s6, 4 -/* 06ABF4 80069FF4 24010010 */ li $at, 16 -/* 06ABF8 80069FF8 16C1FFEE */ bne $s6, $at, .L80069FB4 -/* 06ABFC 80069FFC 26F70008 */ addiu $s7, $s7, 8 -/* 06AC00 8006A000 3C04800E */ lui $a0, %hi(D_800E7088) # $a0, 0x800e -/* 06AC04 8006A004 0C032755 */ jal func_800C9D54 -/* 06AC08 8006A008 24847088 */ addiu $a0, %lo(D_800E7088) # addiu $a0, $a0, 0x7088 -/* 06AC0C 8006A00C 8FBF003C */ lw $ra, 0x3c($sp) -/* 06AC10 8006A010 8FB00018 */ lw $s0, 0x18($sp) -/* 06AC14 8006A014 8FB1001C */ lw $s1, 0x1c($sp) -/* 06AC18 8006A018 8FB20020 */ lw $s2, 0x20($sp) -/* 06AC1C 8006A01C 8FB30024 */ lw $s3, 0x24($sp) -/* 06AC20 8006A020 8FB40028 */ lw $s4, 0x28($sp) -/* 06AC24 8006A024 8FB5002C */ lw $s5, 0x2c($sp) -/* 06AC28 8006A028 8FB60030 */ lw $s6, 0x30($sp) -/* 06AC2C 8006A02C 8FB70034 */ lw $s7, 0x34($sp) -/* 06AC30 8006A030 8FBE0038 */ lw $fp, 0x38($sp) -/* 06AC34 8006A034 03E00008 */ jr $ra -/* 06AC38 8006A038 27BD0040 */ addiu $sp, $sp, 0x40 - -/* 06AC3C 8006A03C 27BDFFC8 */ addiu $sp, $sp, -0x38 -/* 06AC40 8006A040 AFB6002C */ sw $s6, 0x2c($sp) -/* 06AC44 8006A044 AFB2001C */ sw $s2, 0x1c($sp) -/* 06AC48 8006A048 AFB70030 */ sw $s7, 0x30($sp) -/* 06AC4C 8006A04C AFB50028 */ sw $s5, 0x28($sp) -/* 06AC50 8006A050 AFB40024 */ sw $s4, 0x24($sp) -/* 06AC54 8006A054 AFB30020 */ sw $s3, 0x20($sp) -/* 06AC58 8006A058 3C12800E */ lui $s2, %hi(D_800E708C) # $s2, 0x800e -/* 06AC5C 8006A05C 3C16800E */ lui $s6, %hi(D_800E7094) # $s6, 0x800e -/* 06AC60 8006A060 AFBF0034 */ sw $ra, 0x34($sp) -/* 06AC64 8006A064 AFB10018 */ sw $s1, 0x18($sp) -/* 06AC68 8006A068 AFB00014 */ sw $s0, 0x14($sp) -/* 06AC6C 8006A06C 26D67094 */ addiu $s6, %lo(D_800E7094) # addiu $s6, $s6, 0x7094 -/* 06AC70 8006A070 2652708C */ addiu $s2, %lo(D_800E708C) # addiu $s2, $s2, 0x708c -/* 06AC74 8006A074 24130010 */ li $s3, 16 -/* 06AC78 8006A078 0000A025 */ move $s4, $zero -/* 06AC7C 8006A07C 0080A825 */ move $s5, $a0 -/* 06AC80 8006A080 24170010 */ li $s7, 16 -.L8006A084: -/* 06AC84 8006A084 00008025 */ move $s0, $zero -/* 06AC88 8006A088 02A08825 */ move $s1, $s5 -.L8006A08C: -/* 06AC8C 8006A08C C6240000 */ lwc1 $f4, ($s1) -/* 06AC90 8006A090 02402025 */ move $a0, $s2 -/* 06AC94 8006A094 460021A1 */ cvt.d.s $f6, $f4 -/* 06AC98 8006A098 44073000 */ mfc1 $a3, $f6 -/* 06AC9C 8006A09C 44063800 */ mfc1 $a2, $f7 -/* 06ACA0 8006A0A0 0C032755 */ jal func_800C9D54 -/* 06ACA4 8006A0A4 00000000 */ nop -/* 06ACA8 8006A0A8 26100004 */ addiu $s0, $s0, 4 -/* 06ACAC 8006A0AC 1613FFF7 */ bne $s0, $s3, .L8006A08C -/* 06ACB0 8006A0B0 26310004 */ addiu $s1, $s1, 4 -/* 06ACB4 8006A0B4 0C032755 */ jal func_800C9D54 -/* 06ACB8 8006A0B8 02C02025 */ move $a0, $s6 -/* 06ACBC 8006A0BC 26940004 */ addiu $s4, $s4, 4 -/* 06ACC0 8006A0C0 1697FFF0 */ bne $s4, $s7, .L8006A084 -/* 06ACC4 8006A0C4 26B50010 */ addiu $s5, $s5, 0x10 -/* 06ACC8 8006A0C8 3C04800E */ lui $a0, %hi(D_800E7098) # $a0, 0x800e -/* 06ACCC 8006A0CC 0C032755 */ jal func_800C9D54 -/* 06ACD0 8006A0D0 24847098 */ addiu $a0, %lo(D_800E7098) # addiu $a0, $a0, 0x7098 -/* 06ACD4 8006A0D4 8FBF0034 */ lw $ra, 0x34($sp) -/* 06ACD8 8006A0D8 8FB00014 */ lw $s0, 0x14($sp) -/* 06ACDC 8006A0DC 8FB10018 */ lw $s1, 0x18($sp) -/* 06ACE0 8006A0E0 8FB2001C */ lw $s2, 0x1c($sp) -/* 06ACE4 8006A0E4 8FB30020 */ lw $s3, 0x20($sp) -/* 06ACE8 8006A0E8 8FB40024 */ lw $s4, 0x24($sp) -/* 06ACEC 8006A0EC 8FB50028 */ lw $s5, 0x28($sp) -/* 06ACF0 8006A0F0 8FB6002C */ lw $s6, 0x2c($sp) -/* 06ACF4 8006A0F4 8FB70030 */ lw $s7, 0x30($sp) -/* 06ACF8 8006A0F8 03E00008 */ jr $ra -/* 06ACFC 8006A0FC 27BD0038 */ addiu $sp, $sp, 0x38 - diff --git a/asm/non_matchings/camera/func_80069F64.s b/asm/non_matchings/camera/func_80069F64.s new file mode 100644 index 00000000..c4b83ee9 --- /dev/null +++ b/asm/non_matchings/camera/func_80069F64.s @@ -0,0 +1,73 @@ +.rdata +glabel D_800E7078 +.asciz "%x." +glabel D_800E707C +.asciz "%x " +.ascii "\0\0\0" # padding +glabel D_800E7084 +.asciz "\n" +.ascii "\0\0" # padding +glabel D_800E7088 +.asciz "\n" +.ascii "\0\0" # padding + +.text + +# Unused +glabel func_80069F64 +/* 06AB64 80069F64 27BDFFC0 */ addiu $sp, $sp, -0x40 +/* 06AB68 80069F68 AFBE0038 */ sw $fp, 0x38($sp) +/* 06AB6C 80069F6C AFB40028 */ sw $s4, 0x28($sp) +/* 06AB70 80069F70 AFB30024 */ sw $s3, 0x24($sp) +/* 06AB74 80069F74 AFB70034 */ sw $s7, 0x34($sp) +/* 06AB78 80069F78 AFB60030 */ sw $s6, 0x30($sp) +/* 06AB7C 80069F7C AFB5002C */ sw $s5, 0x2c($sp) +/* 06AB80 80069F80 3C13800E */ lui $s3, %hi(D_800E7078) # $s3, 0x800e +/* 06AB84 80069F84 3C14800E */ lui $s4, %hi(D_800E707C) # $s4, 0x800e +/* 06AB88 80069F88 3C1E800E */ lui $fp, %hi(D_800E7084) # $fp, 0x800e +/* 06AB8C 80069F8C AFBF003C */ sw $ra, 0x3c($sp) +/* 06AB90 80069F90 AFB20020 */ sw $s2, 0x20($sp) +/* 06AB94 80069F94 AFB1001C */ sw $s1, 0x1c($sp) +/* 06AB98 80069F98 AFB00018 */ sw $s0, 0x18($sp) +/* 06AB9C 80069F9C 27DE7084 */ addiu $fp, %lo(D_800E7084) # addiu $fp, $fp, 0x7084 +/* 06ABA0 80069FA0 2694707C */ addiu $s4, %lo(D_800E707C) # addiu $s4, $s4, 0x707c +/* 06ABA4 80069FA4 26737078 */ addiu $s3, %lo(D_800E7078) # addiu $s3, $s3, 0x7078 +/* 06ABA8 80069FA8 24150008 */ li $s5, 8 +/* 06ABAC 80069FAC 0000B025 */ move $s6, $zero +/* 06ABB0 80069FB0 0080B825 */ move $s7, $a0 +.L80069FB4: +/* 06ABB4 80069FB4 00008825 */ move $s1, $zero +/* 06ABB8 80069FB8 02E08025 */ move $s0, $s7 +.L80069FBC: +/* 06ABBC 80069FBC 86050000 */ lh $a1, ($s0) +/* 06ABC0 80069FC0 0C032755 */ jal func_800C9D54 +/* 06ABC4 80069FC4 02602025 */ move $a0, $s3 +/* 06ABC8 80069FC8 86050020 */ lh $a1, 0x20($s0) +/* 06ABCC 80069FCC 02802025 */ move $a0, $s4 +/* 06ABD0 80069FD0 30AEFFFF */ andi $t6, $a1, 0xffff +/* 06ABD4 80069FD4 0C032755 */ jal func_800C9D54 +/* 06ABD8 80069FD8 01C02825 */ move $a1, $t6 +/* 06ABDC 80069FDC 26310002 */ addiu $s1, $s1, 2 +/* 06ABE0 80069FE0 1635FFF6 */ bne $s1, $s5, .L80069FBC +/* 06ABE4 80069FE4 26100002 */ addiu $s0, $s0, 2 +/* 06ABE8 80069FE8 0C032755 */ jal func_800C9D54 +/* 06ABEC 80069FEC 03C02025 */ move $a0, $fp +/* 06ABF0 80069FF0 26D60004 */ addiu $s6, $s6, 4 +/* 06ABF4 80069FF4 24010010 */ li $at, 16 +/* 06ABF8 80069FF8 16C1FFEE */ bne $s6, $at, .L80069FB4 +/* 06ABFC 80069FFC 26F70008 */ addiu $s7, $s7, 8 +/* 06AC00 8006A000 3C04800E */ lui $a0, %hi(D_800E7088) # $a0, 0x800e +/* 06AC04 8006A004 0C032755 */ jal func_800C9D54 +/* 06AC08 8006A008 24847088 */ addiu $a0, %lo(D_800E7088) # addiu $a0, $a0, 0x7088 +/* 06AC0C 8006A00C 8FBF003C */ lw $ra, 0x3c($sp) +/* 06AC10 8006A010 8FB00018 */ lw $s0, 0x18($sp) +/* 06AC14 8006A014 8FB1001C */ lw $s1, 0x1c($sp) +/* 06AC18 8006A018 8FB20020 */ lw $s2, 0x20($sp) +/* 06AC1C 8006A01C 8FB30024 */ lw $s3, 0x24($sp) +/* 06AC20 8006A020 8FB40028 */ lw $s4, 0x28($sp) +/* 06AC24 8006A024 8FB5002C */ lw $s5, 0x2c($sp) +/* 06AC28 8006A028 8FB60030 */ lw $s6, 0x30($sp) +/* 06AC2C 8006A02C 8FB70034 */ lw $s7, 0x34($sp) +/* 06AC30 8006A030 8FBE0038 */ lw $fp, 0x38($sp) +/* 06AC34 8006A034 03E00008 */ jr $ra +/* 06AC38 8006A038 27BD0040 */ addiu $sp, $sp, 0x40 diff --git a/asm/non_matchings/camera/func_8006A434.s b/asm/non_matchings/camera/func_8006A434.s deleted file mode 100644 index fc49980d..00000000 --- a/asm/non_matchings/camera/func_8006A434.s +++ /dev/null @@ -1,11 +0,0 @@ -glabel func_8006A434 -/* 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_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, %lo(D_80121150)($at) - diff --git a/asm/non_matchings/menu/draw_menu_element.s b/asm/non_matchings/menu/draw_menu_elements.s similarity index 99% rename from asm/non_matchings/menu/draw_menu_element.s rename to asm/non_matchings/menu/draw_menu_elements.s index 16917f3b..8add2aae 100644 --- a/asm/non_matchings/menu/draw_menu_element.s +++ b/asm/non_matchings/menu/draw_menu_elements.s @@ -3,7 +3,7 @@ glabel jpt_800E836C .word L800823E8, L80082454, L800824B8, L80082524, L8008256C, L80082608, L80082760, L800827C0 .text -glabel draw_menu_element +glabel draw_menu_elements /* 082DEC 800821EC 27BDFF90 */ addiu $sp, $sp, -0x70 /* 082DF0 800821F0 E7B4003C */ swc1 $f20, 0x3c($sp) /* 082DF4 800821F4 4486A000 */ mtc1 $a2, $f20 diff --git a/asm/non_matchings/menu/func_80081F4C.s b/asm/non_matchings/menu/func_80081F4C.s index 7ed84dd1..91906f92 100644 --- a/asm/non_matchings/menu/func_80081F4C.s +++ b/asm/non_matchings/menu/func_80081F4C.s @@ -169,7 +169,7 @@ glabel func_80081F4C /* 082DA0 800821A0 3C05800E */ lui $a1, %hi(D_800DF798) # $a1, 0x800e /* 082DA4 800821A4 8CA5F798 */ lw $a1, %lo(D_800DF798)($a1) /* 082DA8 800821A8 4406A000 */ mfc1 $a2, $f20 -/* 082DAC 800821AC 0C02087B */ jal draw_menu_element +/* 082DAC 800821AC 0C02087B */ jal draw_menu_elements /* 082DB0 800821B0 00E02025 */ move $a0, $a3 /* 082DB4 800821B4 AFA00040 */ sw $zero, 0x40($sp) .L800821B8: diff --git a/asm/non_matchings/menu/func_80088938.s b/asm/non_matchings/menu/func_80088938.s index 70ad8cb5..59621ab3 100644 --- a/asm/non_matchings/menu/func_80088938.s +++ b/asm/non_matchings/menu/func_80088938.s @@ -31,7 +31,7 @@ glabel func_80088938 /* 0895A8 800889A8 3C19800E */ lui $t9, %hi(gShowControllerPakMenu) # $t9, 0x800e /* 0895AC 800889AC 3C05800E */ lui $a1, %hi(D_800DFCB4) # $a1, 0x800e /* 0895B0 800889B0 24A5FCB4 */ addiu $a1, %lo(D_800DFCB4) # addiu $a1, $a1, -0x34c -/* 0895B4 800889B4 0C02087B */ jal draw_menu_element +/* 0895B4 800889B4 0C02087B */ jal draw_menu_elements /* 0895B8 800889B8 3C063F80 */ lui $a2, 0x3f80 /* 0895BC 800889BC 100001B1 */ b .L80089084 /* 0895C0 800889C0 8FBF0044 */ lw $ra, 0x44($sp) diff --git a/asm/non_matchings/menu/func_8008C698.s b/asm/non_matchings/menu/func_8008C698.s index 94fd919d..f8b06498 100644 --- a/asm/non_matchings/menu/func_8008C698.s +++ b/asm/non_matchings/menu/func_8008C698.s @@ -69,7 +69,7 @@ glabel func_8008C698 .L8008C790: /* 08D390 8008C790 8CE50000 */ lw $a1, ($a3) /* 08D394 8008C794 24040001 */ li $a0, 1 -/* 08D398 8008C798 0C02087B */ jal draw_menu_element +/* 08D398 8008C798 0C02087B */ jal draw_menu_elements /* 08D39C 8008C79C 3C063F80 */ lui $a2, 0x3f80 /* 08D3A0 8008C7A0 3C048012 */ lui $a0, %hi(D_801263A0) # $a0, 0x8012 /* 08D3A4 8008C7A4 0C0202F2 */ jal func_80080BC8 diff --git a/asm/non_matchings/menu/func_80094170.s b/asm/non_matchings/menu/func_80094170.s index 08ef6b31..c6a450ba 100644 --- a/asm/non_matchings/menu/func_80094170.s +++ b/asm/non_matchings/menu/func_80094170.s @@ -20,7 +20,7 @@ glabel func_80094170 /* 094DB4 800941B4 00000000 */ nop /* 094DB8 800941B8 01F8C821 */ addu $t9, $t7, $t8 /* 094DBC 800941BC 3329003F */ andi $t1, $t9, 0x3f -/* 094DC0 800941C0 0C026FC8 */ jal func_8009BF20 +/* 094DC0 800941C0 0C026FC8 */ jal update_controller_sticks /* 094DC4 800941C4 AC490000 */ sw $t1, ($v0) /* 094DC8 800941C8 3C0A8012 */ lui $t2, %hi(gIgnorePlayerInput) # $t2, 0x8012 /* 094DCC 800941CC 8D4A63C4 */ lw $t2, %lo(gIgnorePlayerInput)($t2) diff --git a/asm/non_matchings/menu/func_80095728.s b/asm/non_matchings/menu/func_80095728.s index 8504b0d4..39c12b21 100644 --- a/asm/non_matchings/menu/func_80095728.s +++ b/asm/non_matchings/menu/func_80095728.s @@ -107,7 +107,7 @@ glabel func_80095728 /* 09649C 8009589C 8FAA0030 */ lw $t2, 0x30($sp) /* 0964A0 800958A0 00000000 */ nop .L800958A4: -/* 0964A4 800958A4 0C026FC8 */ jal func_8009BF20 +/* 0964A4 800958A4 0C026FC8 */ jal update_controller_sticks /* 0964A8 800958A8 AFAA0030 */ sw $t2, 0x30($sp) /* 0964AC 800958AC 3C0E8012 */ lui $t6, %hi(gIgnorePlayerInput) # $t6, 0x8012 /* 0964B0 800958B0 8DCE63C4 */ lw $t6, %lo(gIgnorePlayerInput)($t6) diff --git a/asm/non_matchings/menu/func_80098EBC.s b/asm/non_matchings/menu/func_80098EBC.s index 0af63f8f..5b875a30 100644 --- a/asm/non_matchings/menu/func_80098EBC.s +++ b/asm/non_matchings/menu/func_80098EBC.s @@ -70,7 +70,7 @@ glabel func_80098EBC .L80098FB4: /* 099BB4 80098FB4 3C05800E */ lui $a1, %hi(D_800E1048) # $a1, 0x800e /* 099BB8 80098FB8 24A51048 */ addiu $a1, %lo(D_800E1048) # addiu $a1, $a1, 0x1048 -/* 099BBC 80098FBC 0C02087B */ jal draw_menu_element +/* 099BBC 80098FBC 0C02087B */ jal draw_menu_elements /* 099BC0 80098FC0 3C063F80 */ lui $a2, 0x3f80 .L80098FC4: /* 099BC4 80098FC4 8FBF0014 */ lw $ra, 0x14($sp) diff --git a/asm/non_matchings/menu/func_8009E7E8.s b/asm/non_matchings/menu/func_8009E7E8.s deleted file mode 100644 index 8de973f4..00000000 --- a/asm/non_matchings/menu/func_8009E7E8.s +++ /dev/null @@ -1,118 +0,0 @@ -glabel func_8009E7E8 -/* 09F3E8 8009E7E8 27BDFFD8 */ addiu $sp, $sp, -0x28 -/* 09F3EC 8009E7EC AFBF001C */ sw $ra, 0x1c($sp) -/* 09F3F0 8009E7F0 240E0078 */ li $t6, 120 -/* 09F3F4 8009E7F4 AFAE0010 */ sw $t6, 0x10($sp) -/* 09F3F8 8009E7F8 24040001 */ li $a0, 1 -/* 09F3FC 8009E7FC 24050018 */ li $a1, 24 -/* 09F400 8009E800 24060010 */ li $a2, 16 -/* 09F404 8009E804 0C0313B7 */ jal func_800C4EDC -/* 09F408 8009E808 240700B8 */ li $a3, 184 -/* 09F40C 8009E80C 24040001 */ li $a0, 1 -/* 09F410 8009E810 0C0313DF */ jal func_800C4F7C -/* 09F414 8009E814 00002825 */ move $a1, $zero -/* 09F418 8009E818 AFA00024 */ sw $zero, 0x24($sp) -/* 09F41C 8009E81C 0C01A955 */ jal get_buttons_pressed_from_player -/* 09F420 8009E820 00002025 */ move $a0, $zero -/* 09F424 8009E824 3C0F800E */ lui $t7, %hi(gMenuText) # $t7, 0x800e -/* 09F428 8009E828 8DEFF4A0 */ lw $t7, %lo(gMenuText)($t7) -/* 09F42C 8009E82C AFA20020 */ sw $v0, 0x20($sp) -/* 09F430 8009E830 8DE70118 */ lw $a3, 0x118($t7) -/* 09F434 8009E834 24180001 */ li $t8, 1 -/* 09F438 8009E838 24190004 */ li $t9, 4 -/* 09F43C 8009E83C AFB90014 */ sw $t9, 0x14($sp) -/* 09F440 8009E840 AFB80010 */ sw $t8, 0x10($sp) -/* 09F444 8009E844 24040001 */ li $a0, 1 -/* 09F448 8009E848 24058000 */ li $a1, -32768 -/* 09F44C 8009E84C 0C03145A */ jal func_800C5168 -/* 09F450 8009E850 24060006 */ li $a2, 6 -/* 09F454 8009E854 3C038012 */ lui $v1, %hi(gControllersYAxisDirection) # $v1, 0x8012 -/* 09F458 8009E858 80636464 */ lb $v1, %lo(gControllersYAxisDirection)($v1) -/* 09F45C 8009E85C 00000000 */ nop -/* 09F460 8009E860 04610008 */ bgez $v1, .L8009E884 -/* 09F464 8009E864 00000000 */ nop -/* 09F468 8009E868 3C038012 */ lui $v1, %hi(D_801264D8) # $v1, 0x8012 -/* 09F46C 8009E86C 246364D8 */ addiu $v1, %lo(D_801264D8) # addiu $v1, $v1, 0x64d8 -/* 09F470 8009E870 80680000 */ lb $t0, ($v1) -/* 09F474 8009E874 00000000 */ nop -/* 09F478 8009E878 25090001 */ addiu $t1, $t0, 1 -/* 09F47C 8009E87C 10000008 */ b .L8009E8A0 -/* 09F480 8009E880 A0690000 */ sb $t1, ($v1) -.L8009E884: -/* 09F484 8009E884 18600006 */ blez $v1, .L8009E8A0 -/* 09F488 8009E888 3C038012 */ lui $v1, %hi(D_801264D8) # $v1, 0x8012 -/* 09F48C 8009E88C 246364D8 */ addiu $v1, %lo(D_801264D8) # addiu $v1, $v1, 0x64d8 -/* 09F490 8009E890 806A0000 */ lb $t2, ($v1) -/* 09F494 8009E894 00000000 */ nop -/* 09F498 8009E898 254BFFFF */ addiu $t3, $t2, -1 -/* 09F49C 8009E89C A06B0000 */ sb $t3, ($v1) -.L8009E8A0: -/* 09F4A0 8009E8A0 3C038012 */ lui $v1, %hi(D_801264D8) # $v1, 0x8012 -/* 09F4A4 8009E8A4 246364D8 */ addiu $v1, %lo(D_801264D8) # addiu $v1, $v1, 0x64d8 -/* 09F4A8 8009E8A8 80620000 */ lb $v0, ($v1) -/* 09F4AC 8009E8AC 00000000 */ nop -/* 09F4B0 8009E8B0 04410005 */ bgez $v0, .L8009E8C8 -/* 09F4B4 8009E8B4 28410002 */ slti $at, $v0, 2 -/* 09F4B8 8009E8B8 A0600000 */ sb $zero, ($v1) -/* 09F4BC 8009E8BC 80620000 */ lb $v0, ($v1) -/* 09F4C0 8009E8C0 00000000 */ nop -/* 09F4C4 8009E8C4 28410002 */ slti $at, $v0, 2 -.L8009E8C8: -/* 09F4C8 8009E8C8 14200004 */ bnez $at, .L8009E8DC -/* 09F4CC 8009E8CC 240C0001 */ li $t4, 1 -/* 09F4D0 8009E8D0 A06C0000 */ sb $t4, ($v1) -/* 09F4D4 8009E8D4 80620000 */ lb $v0, ($v1) -/* 09F4D8 8009E8D8 00000000 */ nop -.L8009E8DC: -/* 09F4DC 8009E8DC 0C027446 */ jal func_8009D118 -/* 09F4E0 8009E8E0 2C440001 */ sltiu $a0, $v0, 1 -/* 09F4E4 8009E8E4 3C0D800E */ lui $t5, %hi(gMenuText) # $t5, 0x800e -/* 09F4E8 8009E8E8 8DADF4A0 */ lw $t5, %lo(gMenuText)($t5) -/* 09F4EC 8009E8EC 240E0001 */ li $t6, 1 -/* 09F4F0 8009E8F0 8DA702D0 */ lw $a3, 0x2d0($t5) -/* 09F4F4 8009E8F4 240F0004 */ li $t7, 4 -/* 09F4F8 8009E8F8 AFAF0014 */ sw $t7, 0x14($sp) -/* 09F4FC 8009E8FC AFAE0010 */ sw $t6, 0x10($sp) -/* 09F500 8009E900 24040001 */ li $a0, 1 -/* 09F504 8009E904 24058000 */ li $a1, -32768 -/* 09F508 8009E908 0C03145A */ jal func_800C5168 -/* 09F50C 8009E90C 2406001E */ li $a2, 30 -/* 09F510 8009E910 3C038012 */ lui $v1, %hi(D_801264D8) # $v1, 0x8012 -/* 09F514 8009E914 246364D8 */ addiu $v1, %lo(D_801264D8) # addiu $v1, $v1, 0x64d8 -/* 09F518 8009E918 80640000 */ lb $a0, ($v1) -/* 09F51C 8009E91C 00000000 */ nop -/* 09F520 8009E920 38980001 */ xori $t8, $a0, 1 -/* 09F524 8009E924 0C027446 */ jal func_8009D118 -/* 09F528 8009E928 2F040001 */ sltiu $a0, $t8, 1 -/* 09F52C 8009E92C 3C19800E */ lui $t9, %hi(gMenuText) # $t9, 0x800e -/* 09F530 8009E930 8F39F4A0 */ lw $t9, %lo(gMenuText)($t9) -/* 09F534 8009E934 24080001 */ li $t0, 1 -/* 09F538 8009E938 8F2700CC */ lw $a3, 0xcc($t9) -/* 09F53C 8009E93C 24090004 */ li $t1, 4 -/* 09F540 8009E940 AFA90014 */ sw $t1, 0x14($sp) -/* 09F544 8009E944 AFA80010 */ sw $t0, 0x10($sp) -/* 09F548 8009E948 24040001 */ li $a0, 1 -/* 09F54C 8009E94C 24058000 */ li $a1, -32768 -/* 09F550 8009E950 0C03145A */ jal func_800C5168 -/* 09F554 8009E954 24060032 */ li $a2, 50 -/* 09F558 8009E958 8FA50020 */ lw $a1, 0x20($sp) -/* 09F55C 8009E95C 3C038012 */ lui $v1, %hi(D_801264D8) # $v1, 0x8012 -/* 09F560 8009E960 30AA8000 */ andi $t2, $a1, 0x8000 -/* 09F564 8009E964 11400005 */ beqz $t2, .L8009E97C -/* 09F568 8009E968 246364D8 */ addiu $v1, %lo(D_801264D8) # addiu $v1, $v1, 0x64d8 -/* 09F56C 8009E96C 80640000 */ lb $a0, ($v1) -/* 09F570 8009E970 00000000 */ nop -/* 09F574 8009E974 24840001 */ addiu $a0, $a0, 1 -/* 09F578 8009E978 AFA40024 */ sw $a0, 0x24($sp) -.L8009E97C: -/* 09F57C 8009E97C 8FA40024 */ lw $a0, 0x24($sp) -/* 09F580 8009E980 30AB4000 */ andi $t3, $a1, 0x4000 -/* 09F584 8009E984 11600003 */ beqz $t3, .L8009E994 -/* 09F588 8009E988 8FBF001C */ lw $ra, 0x1c($sp) -/* 09F58C 8009E98C 24040002 */ li $a0, 2 -/* 09F590 8009E990 8FBF001C */ lw $ra, 0x1c($sp) -.L8009E994: -/* 09F594 8009E994 27BD0028 */ addiu $sp, $sp, 0x28 -/* 09F598 8009E998 03E00008 */ jr $ra -/* 09F59C 8009E99C 00801025 */ move $v0, $a0 - diff --git a/asm/non_matchings/menu/menu_magic_codes_list_loop.s b/asm/non_matchings/menu/menu_magic_codes_list_loop.s index 9e466a1c..6104383a 100644 --- a/asm/non_matchings/menu/menu_magic_codes_list_loop.s +++ b/asm/non_matchings/menu/menu_magic_codes_list_loop.s @@ -36,7 +36,7 @@ glabel menu_magic_codes_list_loop /* 08B5A8 8008A9A8 28410014 */ slti $at, $v0, 0x14 /* 08B5AC 8008A9AC 10200003 */ beqz $at, .L8008A9BC /* 08B5B0 8008A9B0 00000000 */ nop -/* 08B5B4 8008A9B4 0C02295B */ jal func_8008A56C +/* 08B5B4 8008A9B4 0C02295B */ jal render_magic_codes_list_menu_text /* 08B5B8 8008A9B8 00000000 */ nop .L8008A9BC: /* 08B5BC 8008A9BC 3C0A8012 */ lui $t2, %hi(gIgnorePlayerInput) # $t2, 0x8012 diff --git a/asm/non_matchings/menu/menu_trophy_race_rankings_loop.s b/asm/non_matchings/menu/menu_trophy_race_rankings_loop.s index 9cea2923..9115f99a 100644 --- a/asm/non_matchings/menu/menu_trophy_race_rankings_loop.s +++ b/asm/non_matchings/menu/menu_trophy_race_rankings_loop.s @@ -19,7 +19,7 @@ glabel menu_trophy_race_rankings_loop /* 099C18 80099018 8FAB002C */ lw $t3, 0x2c($sp) /* 099C1C 8009901C 00000000 */ nop .L80099020: -/* 099C20 80099020 0C026FC8 */ jal func_8009BF20 +/* 099C20 80099020 0C026FC8 */ jal update_controller_sticks /* 099C24 80099024 AFAB002C */ sw $t3, 0x2c($sp) /* 099C28 80099028 3C028012 */ lui $v0, %hi(D_801263E0) # $v0, 0x8012 /* 099C2C 8009902C 8C4263E0 */ lw $v0, %lo(D_801263E0)($v0) @@ -68,7 +68,7 @@ glabel menu_trophy_race_rankings_loop /* 099CD0 800990D0 AC2F63E0 */ sw $t7, %lo(D_801263E0)($at) /* 099CD4 800990D4 24A51048 */ addiu $a1, %lo(D_800E1048) # addiu $a1, $a1, 0x1048 /* 099CD8 800990D8 24040001 */ li $a0, 1 -/* 099CDC 800990DC 0C02087B */ jal draw_menu_element +/* 099CDC 800990DC 0C02087B */ jal draw_menu_elements /* 099CE0 800990E0 3C063F80 */ lui $a2, 0x3f80 /* 099CE4 800990E4 10000141 */ b .L800995EC /* 099CE8 800990E8 8FBF001C */ lw $ra, 0x1c($sp) diff --git a/asm/non_matchings/menu/func_8008A56C.s b/asm/non_matchings/menu/render_magic_codes_list_menu_text.s similarity index 99% rename from asm/non_matchings/menu/func_8008A56C.s rename to asm/non_matchings/menu/render_magic_codes_list_menu_text.s index f47d573d..c8439aae 100644 --- a/asm/non_matchings/menu/func_8008A56C.s +++ b/asm/non_matchings/menu/render_magic_codes_list_menu_text.s @@ -1,4 +1,4 @@ -glabel func_8008A56C +glabel render_magic_codes_list_menu_text /* 08B16C 8008A56C 27BDFFB0 */ addiu $sp, $sp, -0x50 /* 08B170 8008A570 AFBF004C */ sw $ra, 0x4c($sp) /* 08B174 8008A574 AFA40050 */ sw $a0, 0x50($sp) diff --git a/asm/non_matchings/menu/func_8009BF20.s b/asm/non_matchings/menu/update_controller_sticks.s similarity index 99% rename from asm/non_matchings/menu/func_8009BF20.s rename to asm/non_matchings/menu/update_controller_sticks.s index 64e04449..02141f2e 100644 --- a/asm/non_matchings/menu/func_8009BF20.s +++ b/asm/non_matchings/menu/update_controller_sticks.s @@ -1,4 +1,4 @@ -glabel func_8009BF20 +glabel update_controller_sticks /* 09CB20 8009BF20 27BDFFC0 */ addiu $sp, $sp, -0x40 /* 09CB24 8009BF24 AFB70034 */ sw $s7, 0x34($sp) /* 09CB28 8009BF28 AFB60030 */ sw $s6, 0x30($sp) diff --git a/include/structs.h b/include/structs.h index e9c55602..1a322084 100644 --- a/include/structs.h +++ b/include/structs.h @@ -7,29 +7,37 @@ /* Size: 0x20 bytes */ typedef struct MenuElement { - /* 0x00 */ s16 unk0; // This is something related to position, not sure what though. - /* 0x02 */ s16 unk2; // This is something related to position, not sure what though. - /* 0x04 */ s16 screenX; - /* 0x06 */ s16 screenY; - /* 0x08 */ s16 unk6; - /* 0x0A */ s16 unk8; + // Element Position + /* 0x00 */ s16 left; + /* 0x02 */ s16 top; + /* 0x04 */ s16 center; + /* 0x06 */ s16 middle; + /* 0x08 */ s16 right; + /* 0x0A */ s16 bottom; + // Element Color/Transparency /* 0x0C */ u8 filterRed; /* 0x0D */ u8 filterGreen; /* 0x0E */ u8 filterBlue; /* 0x0F */ u8 filterAlpha; // 0 = no filter color, 0xFF = full color. /* 0x10 */ u8 opacity; - /* 0x11 */ u8 textType; + // Element Properties + /* 0x11 */ u8 textFont; /* 0x12 */ u8 textAlignFlags; - /* 0x13 */ u8 unk13; // Source type? 0 = ascii text, 2 = number, 7 = texture + // Element Type + /* 0x13 */ u8 elementType; // Source type? 0 = ascii text, 2 = number, 7 = texture union { /* 0x14 */ char* asciiText; // Pointer to ascii text to be displayed on the screen. /* 0x14 */ u32* texture; // Pointer to texture to be displayed on the screen. /* 0x14 */ s32* number; // Pointer to a number to be displayed on the screen. + /* 0x14 */ u16* numberU16; // Pointer to a number to be displayed on the screen. + /* 0x14 */ s32 value; // Some value for elementType == 5 + /* 0x14 */ void* element; // Generic pointer }; - /* 0x18 */ u16 backgroundRed; - /* 0x1A */ u16 backgroundGreen; - /* 0x1C */ u16 backgroundBlue; - /* 0x1E */ u16 backgroundAlpha; // 0x0000 = No background, 0x00FF = full background color. + // Element Background Color/Transparency + /* 0x18 */ s16 backgroundRed; + /* 0x1A */ s16 backgroundGreen; + /* 0x1C */ s16 backgroundBlue; + /* 0x1E */ s16 backgroundAlpha; // 0x0000 = No background, 0x00FF = full background color. } MenuElement; #define TEX_FORMAT_RGBA32 0 diff --git a/src/camera.c b/src/camera.c index 5505118d..bdca1fca 100644 --- a/src/camera.c +++ b/src/camera.c @@ -43,7 +43,8 @@ s16 D_800DD138[8] = { 0, 0, 0, -1, -1, 0, 0, 0 }; -s16 D_800DD148[20][8] = { +// RSP Viewports +Vp D_800DD148[20] = { { 0, 0, 0x01FF, 0, 0, 0, 0x01FF, 0 }, { 0, 0, 0x01FF, 0, 0, 0, 0x01FF, 0 }, { 0, 0, 0x01FF, 0, 0, 0, 0x01FF, 0 }, @@ -74,14 +75,12 @@ 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] = { +// This is a matrix. +f32 D_800DD2B8[16] = { 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 160.0f + 0.0f, 0.0f, 0.0f, 160.0f }; u8 D_800DD2F8[8] = { @@ -141,7 +140,7 @@ Mtx *D_80120D70[6]; s32 D_80120D88[6]; Mtx D_80120DA0[5]; s32 D_80120EE0[16]; -s32 D_80120F20[16]; +f32 D_80120F20[16]; // Matrix s32 D_80120F60[16]; s32 D_80120FA0[16]; s32 D_80120FE0[16]; @@ -189,7 +188,7 @@ void osSetTime(u64); void func_8001D5E0(f32 arg0, f32 arg1, f32 arg2); void func_800705F8(s32, f32, f32, f32); void func_8006ECFC(s32 arg0); - +void func_80068158(Gfx **dlist, s32 arg1, s32 arg2, s32 arg3, s32 arg4); #ifdef NON_MATCHING void func_800663DC(s32 x_pos, s32 y_pos, s32 z_pos, s32 arg3, s32 arg4, s32 arg5); @@ -461,10 +460,10 @@ void func_80066610(void) { if (get_filtered_cheats() & CHEAT_MIRRORED_TRACKS) { s2 = -s2; } - D_800DD148[s3][4] = s5; - D_800DD148[s3][5] = s4; - D_800DD148[s3][0] = s1; - D_800DD148[s3][1] = s2; + D_800DD148[s3].vp.vtrans[0] = s5; + D_800DD148[s3].vp.vtrans[1] = s4; + D_800DD148[s3].vp.vscale[0] = s1; + D_800DD148[s3].vp.vscale[1] = s2; } } } @@ -494,7 +493,65 @@ s32 func_80066910(s32 arg0) { return gScreenViewports[arg0].flags & 0x1; } +#ifdef NON_MATCHING + +// Should be functionally equivalent. +void func_80066940(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { + s32 widthAndHeight, width, height; + s32 phi_a1; + s32 phi_a2; + s32 phi_a3; + + widthAndHeight = get_video_width_and_height_as_s32(); + width = widthAndHeight & 0xFFFF; + // Placement issues with the height variable. + height = (widthAndHeight >> 0x10) & 0xFFFF; + phi_a2 = arg4; + phi_a3 = arg3; + phi_a1 = arg1; + if (arg3 < arg1) { + phi_a1 = arg3; + phi_a3 = arg1; + } + if (arg4 < arg2) { + arg2 = arg4; + phi_a2 = arg2; + } + if ((phi_a1 >= width) || (phi_a3 < 0) || (arg2 >= height) || (phi_a2 < 0)) { + gScreenViewports[arg0].unk20 = 0; + gScreenViewports[arg0].unk24 = 0; + gScreenViewports[arg0].unk28 = 0; + gScreenViewports[arg0].unk2C = 0; + } else { + if (phi_a1 < 0) { + gScreenViewports[arg0].unk20 = 0; + } else { + gScreenViewports[arg0].unk20 = phi_a1; + } + if (arg2 < 0) { + gScreenViewports[arg0].unk24 = 0; + } else { + gScreenViewports[arg0].unk24 = arg2; + } + if (phi_a3 >= width) { + gScreenViewports[arg0].unk28 = width - 1; + } else { + gScreenViewports[arg0].unk28 = phi_a3; + } + if (phi_a2 >= height) { + gScreenViewports[arg0].unk2C = height - 1; + } else { + gScreenViewports[arg0].unk2C = phi_a2; + } + } + gScreenViewports[arg0].unk4 = arg2; + gScreenViewports[arg0].unk0 = phi_a1; + gScreenViewports[arg0].unk8 = phi_a3; + gScreenViewports[arg0].unkC = phi_a2; +} +#else GLOBAL_ASM("asm/non_matchings/camera/func_80066940.s") +#endif void func_80066AA8(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { if (arg1 != 0x8000) { @@ -702,10 +759,34 @@ GLOBAL_ASM("asm/non_matchings/camera/func_80067A3C.s") GLOBAL_ASM("asm/non_matchings/camera/func_80067D3C.s") void func_80067F20(f32 arg0) { - D_800DD2CC[0] = arg0; + D_800DD2B8[5] = arg0; } -GLOBAL_ASM("asm/non_matchings/camera/func_80067F2C.s") +void func_80067F2C(Gfx **dlist, s32 *arg1) { + u32 widthAndHeight, width, height; + s32 i; + + widthAndHeight = get_video_width_and_height_as_s32(); + height = widthAndHeight >> 0x10; + width = widthAndHeight & 0xFFFF; + func_8006F870(&D_800DD2B8, *arg1); + D_80120D88[0] = *arg1; + D_800DD148[D_80120CE4 + 5].vp.vscale[0] = width * 2; + D_800DD148[D_80120CE4 + 5].vp.vscale[1] = width * 2; + D_800DD148[D_80120CE4 + 5].vp.vtrans[0] = width * 2; + D_800DD148[D_80120CE4 + 5].vp.vtrans[1] = height * 2; + gSPViewport((*dlist)++, (u8*)&D_800DD148[D_80120CE4 + 5] + 0x80000000) + fast3d_cmd((*dlist)++, 0x1000040, (u32)(*arg1 + 0x80000000)) + *arg1 += 0x40; + D_80120D1C = 0; + D_80120D08 = 0; + + i = 0; + while(i < 16) { // for loop doesn't match here. + D_80120F20[i] = D_800DD2B8[i]; + i++; + } +} void func_8006807C(Gfx **dlist, s32 *arg1) { func_8006FE74(&D_80121060, &D_800DD288); @@ -719,8 +800,38 @@ void func_8006807C(Gfx **dlist, s32 *arg1) { D_80120D08 = 0; } -GLOBAL_ASM("asm/non_matchings/camera/func_80068158.s") -GLOBAL_ASM("asm/non_matchings/camera/func_800682AC.s") +void func_80068158(Gfx **dlist, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { + s32 tempArg1 = (get_filtered_cheats() & CHEAT_MIRRORED_TRACKS) ? -arg1 : arg1; + if (D_800DD060 != 0) { + arg2 = -arg2; + tempArg1 = -arg1; + } + if (!(gScreenViewports[D_80120CE4].flags & 1)) { + D_800DD148[D_80120CE4].vp.vtrans[0] = arg3 * 4; + D_800DD148[D_80120CE4].vp.vtrans[1] = arg4 * 4; + D_800DD148[D_80120CE4].vp.vscale[0] = tempArg1 * 4; + D_800DD148[D_80120CE4].vp.vscale[1] = arg2 * 4; + gSPViewport((*dlist)++, (u8*)&D_800DD148[D_80120CE4] + 0x80000000) + } else { + gSPViewport((*dlist)++, (u8*)&D_800DD148[D_80120CE4 + 10 + (D_800DD134 * 5)] + 0x80000000) + } +} + +void func_800682AC(Gfx **dlist) { + u32 widthAndHeight, width, height; + D_80120CE4 = 4; + widthAndHeight = get_video_width_and_height_as_s32(); + height = widthAndHeight >> 0x10; + width = widthAndHeight & 0xFFFF; + if (!(gScreenViewports[D_80120CE4].flags & 1)) { + gDPSetScissor((*dlist)++, G_SC_NON_INTERLACE, 0, 0, width - 1, height - 1) + func_80068158(dlist, width >> 1, height >> 1, width >> 1, height >> 1); + } else { + func_80067A3C(dlist); + func_80068158(dlist, 0, 0, 0, 0); + } + D_80120CE4 = 0; +} void func_80068408(Gfx **dlist, s32 *arg1) { func_800705F8(D_80120D70[D_80120D1C], 0.0f, 0.0f, 0.0f); @@ -800,12 +911,52 @@ void func_80069E14(f32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { } } -GLOBAL_ASM("asm/non_matchings/camera/func_80069F28.s") +void func_80069F28(f32 arg0) { + s32 i; + for(i = 0; i <= gNumberOfViewports; i++) { + D_80120AC0[i].unk30 = arg0; + } +} + +#ifdef NON_MATCHING +// Unused. Prints/Displays a 4x4 fixed-point RSP matrix. +void func_80069F64(s16 *mtx) { + s32 i, j; + s32 val; + for(i = 0; i < 4; i++) { + for(j = 0; j < 4; j++) { + val = mtx[i * 4 + j]; + func_800C9D54("%x.", val); + val = mtx[((i + 4) * 4 + j)]; // Issue here. + func_800C9D54("%x ", (u16)val); + } + func_800C9D54("\n"); + } + func_800C9D54("\n"); +} +#else +GLOBAL_ASM("asm/non_matchings/camera/func_80069F64.s") +#endif + +// Unused. Prints/Displays a 4x4 floating-point matrix. +void func_8006A03C(f32 *mtx) { + s32 i, j; + + for(i = 0; i < 4; i++) { + for(j = 0; j < 4; j++) { + func_800C9D54("%f ", mtx[i * 4 + j]); + } + func_800C9D54("\n"); + } + func_800C9D54("\n"); +} s32* func_8006A100(void) { return &D_801210E0; } +void func_8006A434(void); + #ifdef NON_MATCHING // Has regalloc & stack issues. s32 func_8006A10C(void) { @@ -827,7 +978,13 @@ GLOBAL_ASM("asm/non_matchings/camera/func_8006A10C.s") #endif GLOBAL_ASM("asm/non_matchings/camera/func_8006A1C4.s") -GLOBAL_ASM("asm/non_matchings/camera/func_8006A434.s") + +void func_8006A434(void) { + s32 i; + for(i = 0; i < 4; i++) { + D_80121150[i] = i; + } +} void func_8006A458(s8 *activePlayers) { s32 i; diff --git a/src/camera.h b/src/camera.h index 79b17c3f..9f64d051 100644 --- a/src/camera.h +++ b/src/camera.h @@ -54,16 +54,14 @@ extern ScreenViewport gScreenViewports[4]; // Not sure about the typing here extern s16 D_800DD138[8]; -// Not sure about the typing here -extern s16 D_800DD148[20][8]; +// RSP Viewports +extern Vp D_800DD148[20]; extern f32 D_800DD288[6]; extern f32 D_800DD2A0[6]; -extern f32 D_800DD2B8[5]; - -extern f32 D_800DD2CC[11]; +extern f32 D_800DD2B8[16]; extern u8 D_800DD2F8[8]; diff --git a/src/menu.c b/src/menu.c index 3e9d95a2..81b673af 100644 --- a/src/menu.c +++ b/src/menu.c @@ -71,13 +71,13 @@ s32 D_80126434; s32 D_80126438[4]; s64 D_80126448; f32 D_80126450; -u8 gControllersXAxisDelay[4]; -u8 gControllersYAxisDelay[4]; +s8 gControllersXAxisDelay[4]; +s8 gControllersYAxisDelay[4]; s8 gControllersXAxisDirection[4]; // X axis (-1 = left, 1 = right) for controller MenuElement **D_80126460; s8 gControllersYAxisDirection[4]; // Y axis (-1 = down, 1 = up) for controller -u8 gControllersXAxis[4]; -u8 gControllersYAxis[4]; +s8 gControllersXAxis[4]; +s8 gControllersYAxis[4]; s32 D_80126470; s32 D_80126474; s32 D_80126478; @@ -177,7 +177,7 @@ s32 D_80126840; s32 D_80126844; s32 D_80126848; s32 D_8012684C; -s32 D_80126850; +s32 *D_80126850; s32 D_80126854; s32 D_80126858; s32 D_8012685C; @@ -290,7 +290,7 @@ s32 D_80126C70; s32 D_80126C74; s32 D_80126C78; s32 D_80126C7C; -s32 D_80126C80[16]; +s16 D_80126C80[32]; s32 D_80126CC0; /******************************/ @@ -324,7 +324,7 @@ u8 D_800DF4A4 = 0xFF; u8 D_800DF4A8 = 0xFF; u8 D_800DF4AC = 0xFF; -s32 D_800DF4B0 = 0; +u8 D_800DF4B0 = 0; s32 D_800DF4B4 = 0; s32 gIsInTracksMode = 1; s32 gNumberOfActivePlayers = 1; @@ -1567,6 +1567,8 @@ void set_text_color(s32 red, s32 green, s32 blue, s32 alpha, s32 opacity); void func_80082FAC(void); void func_8009ABAC(void); void func_800C31EC(s32); +void update_controller_sticks(void); +void func_80078D00(Gfx**, void *element, s32, s32, f32, f32, u32, s32); void reset_controller_sticks(void); void menu_logos_screen_init(void); @@ -1905,7 +1907,7 @@ s32 menu_loop(Gfx **arg0, s32 **arg1, s32 **arg2, s32 **arg3, s32 arg4) { D_801263A8 = *arg1; D_801263AC = *arg2; D_801263B0 = *arg3; - func_8009BF20(); + update_controller_sticks(); switch (gCurrentMenuId) { case MENU_LOGOS: sp1C = menu_logo_screen_loop(arg4); @@ -2064,7 +2066,171 @@ void func_80081E54(s32 arg0, f32 arg1, f32 arg2, f32 arg3, s32 arg4, s32 arg5) { GLOBAL_ASM("asm/non_matchings/menu/func_80081F4C.s") -GLOBAL_ASM("asm/non_matchings/menu/draw_menu_element.s") + +#ifdef NON_MATCHING + +void draw_menu_elements(s32 arg0, MenuElement *elem, f32 arg2) { + s32 s5; + s32 tempX, tempY; + s32 xPos, yPos; + + s5 = FALSE; + if (arg0 != 4) { + func_80067F2C(&D_801263A0, &D_801263A8); + while(elem->element != NULL) { + if (&D_80126850 != elem->element) { + if (arg0 == 0) { + tempX = elem->center - elem->left; + tempX *= arg2; + xPos = tempX + elem->left; + tempY = elem->middle - elem->top; + tempY *= arg2; + yPos = tempY + elem->top; + } else if (arg0 == 1) { + xPos = elem->center; + yPos = elem->middle; + } else { + tempX = elem->right - elem->center; + tempX *= arg2; + xPos = tempX + elem->center; + tempY = elem->bottom - elem->middle; + tempY *= arg2; + yPos = tempY + elem->middle; + } + switch (elem->elementType) { + case 0: + set_text_background_color(elem->backgroundRed, elem->backgroundGreen, elem->backgroundBlue, elem->backgroundAlpha); + set_text_color(elem->filterRed, elem->filterGreen, elem->filterBlue, elem->filterAlpha, elem->opacity); + set_text_font(elem->textFont); + draw_text(&D_801263A0, xPos, yPos + D_800DF79C, elem->asciiText, elem->textAlignFlags); + break; + case 1: + if (s5) { + s5 = FALSE; + func_8007B3D0(&D_801263A0); + } + D_800DF764 = elem->opacity; + func_80081800( + *elem->numberU16, + xPos - 0xA0, + (-yPos - D_800DF7A0) + 0x78, + elem->filterRed, + elem->filterGreen, + elem->filterBlue, + elem->textFont + ); + break; + case 2: + if (s5) { + s5 = FALSE; + func_8007B3D0(&D_801263A0); + } + func_80081C04( + *elem->number, + xPos - 0xA0, + (-yPos - D_800DF7A0) + 0x78, + elem->filterRed, + elem->filterGreen, + elem->filterBlue, + elem->opacity, + elem->textFont, + elem->textAlignFlags + ); + break; + case 3: + s5 = TRUE; + render_textured_rectangle( + &D_801263A0, + elem->texture, + xPos, + yPos + D_800DF79C, + elem->filterRed, + elem->filterGreen, + elem->filterBlue, + elem->opacity + ); + break; + case 4: + s5 = TRUE; + func_80078D00( + &D_801263A0, + elem->element, + xPos, + yPos + D_800DF79C, + elem->backgroundRed / 256.0f, + elem->backgroundGreen / 256.0f, + (elem->filterRed << 0x18) | (elem->filterGreen << 0x10) | (elem->filterBlue << 8) | elem->opacity, + elem->textAlignFlags + ); + break; + case 5: + if (s5) { + s5 = FALSE; + func_8007B3D0(&D_801263A0); + } + func_80068508(1); + func_8007BF1C(0); + D_800DF75C[elem->value].unkC = xPos - 0xA0; + D_800DF75C[elem->value].unk10 = (-yPos - D_800DF7A0) + 0x78; + D_800DF75C[elem->value].unk18 = elem->textFont; + D_800DF75C[elem->value].unk4 = elem->backgroundRed; + D_800DF75C[elem->value].unk2 = elem->backgroundGreen; + D_800DF75C[elem->value].unk0 = elem->backgroundBlue; + D_800DF75C[elem->value].unk8 = elem->backgroundAlpha / 256.0f; + D_800DF4A4 = elem->filterRed; + D_800DF4A8 = elem->filterGreen; + D_800DF4AC = elem->filterBlue; + D_800DF4B0 = elem->filterAlpha; + D_800DF764 = elem->opacity; + func_8009CA60(elem->value); + func_80068508(0); + func_8007BF1C(1); + break; + case 6: + func_80080E90( + &D_801263A0, + xPos, + yPos + D_800DF7A0, + elem->backgroundRed, + elem->backgroundGreen, + elem->backgroundBlue, + elem->backgroundAlpha, + elem->filterRed, + elem->filterGreen, + elem->filterBlue, + elem->opacity + ); + break; + case 7: + func_80080580( + &D_801263A0, + xPos, + yPos + D_800DF7A0, + elem->backgroundRed, + elem->backgroundGreen, + elem->backgroundBlue, + elem->backgroundAlpha, + (elem->filterRed << 0x18) | (elem->filterGreen << 0x10) | (elem->filterBlue << 8) | elem->opacity, + elem->element + ); + break; + } + } + elem++; // Go onto the next element. + } + if (s5) { + func_8007B3D0(&D_801263A0); + } + D_800DF4A4 = 0xFF; + D_800DF4A8 = 0xFF; + D_800DF4AC = 0xFF; + D_800DF4B0 = 0; + D_800DF764 = 0xFF; + } +} +#else +GLOBAL_ASM("asm/non_matchings/menu/draw_menu_elements.s") +#endif void func_800828B8(void) { s32 i; @@ -3141,7 +3307,68 @@ void menu_magic_codes_list_init(void) { } -GLOBAL_ASM("asm/non_matchings/menu/func_8008A56C.s") +#ifdef NON_MATCHING + +// Should be functionally equivalent +void render_magic_codes_list_menu_text(s32 arg0) { + s32 numOfUnlockedCheats; + s32 fp; + s32 phi_v0; + s32 s2; + s32 i; + + set_text_background_color(0, 0, 0, 0); + set_text_font(2); + set_text_color(0, 0, 0, 0xFF, 0x80); + draw_text(&D_801263A0, 0xA1, 0x23, gMenuText[20], 0xC); // MAGIC CODES LIST + set_text_color(0xFF, 0xFF, 0xFF, 0, 0xFF); + draw_text(&D_801263A0, 0xA0, 0x20, gMenuText[20], 0xC); // MAGIC CODES LIST + numOfUnlockedCheats = 0; + phi_v0 = 1; + for(i = 0; i < 32; i++) { + if (phi_v0 & gUnlockedMagicCodes) { + D_80126C80[numOfUnlockedCheats] = i; + numOfUnlockedCheats += 1; + } + phi_v0 <<= 1; + } + s2 = 0x36; + fp = D_801263BC; + fp *= 8; + if (fp >= 0x100) { + fp = 0x1FF - fp; + } + set_text_font(0); + set_text_color(0xFF, 0xFF, 0xFF, 0, 0xFF); + for(i = D_801263E0; (i < D_801263E0 + D_80126C70) && (i < numOfUnlockedCheats); i++) { + if (i == gOptionsMenuItemIndex) { + set_text_color(0xFF, 0xFF, 0xFF, fp, 0xFF); + } + draw_text(&D_801263A0, 0x30, s2, (char*)(*gCheatsAssetData) + ((*gCheatsAssetData + 1)[D_80126C80[i]*2+1]), 0); + if ((1 << D_80126C80[i]) & gActiveMagicCodes) { + draw_text(&D_801263A0, 0x100, s2, gMenuText[21], 0); // ON + } else { + draw_text(&D_801263A0, 0x100, s2, gMenuText[22], 0); // OFF + } + if (i == gOptionsMenuItemIndex) { + set_text_color(0xFF, 0xFF, 0xFF, 0, 0xFF); + } + s2 += 0x10; + } + if (i < D_801263E0 + D_80126C70) { + if (numOfUnlockedCheats == gOptionsMenuItemIndex) { + set_text_color(0xFF, 0xFF, 0xFF, fp, 0xFF); + } + draw_text(&D_801263A0, -0x8000, s2, gMenuText[5], 4); // RETURN + return; + } + if (D_801263BC & 8) { + render_textured_rectangle(&D_801263A0, &D_800E043C, 0xA0, s2 + 8, 0xFF, 0xFF, 0xFF, 0xFF); + } +} +#else +GLOBAL_ASM("asm/non_matchings/menu/render_magic_codes_list_menu_text.s") +#endif void func_8008A8F8(s32 arg0, s32 arg1, s32 arg2) { if ((arg0 & arg1) && (arg0 & gActiveMagicCodes)) { @@ -3149,27 +3376,21 @@ void func_8008A8F8(s32 arg0, s32 arg1, s32 arg2) { } } -#if 1 -GLOBAL_ASM("asm/non_matchings/menu/menu_magic_codes_list_loop.s") -#else +#ifdef NON_MATCHING -extern s16 D_80126C80[0x1E]; // Array of shorts of the unlocked cheat's bit ids. void func_8008AD1C(void); -void func_8008A56C(void); -s32 get_buttons_pressed_from_player(s32 arg0); s32 menu_magic_codes_list_loop(s32 arg0) { - s32 temp_t0; s32 phi_a2; - s32 phi_s0; s32 sp48; + s32 buttonsPressed; + s32 xAxis; + s32 yAxis; + s32 i; s32 phi_s1; - s32 phi_s2; - s32 phi_a3_2; - s32 phi_v0_2; - s32 phi_s3; - s8 *temp, *temp2; - + s32 numUnlockedCodes; + s32 code; + sp48 = 0; if (gMenuDelay != 0) { if (gMenuDelay > 0) { @@ -3180,39 +3401,31 @@ s32 menu_magic_codes_list_loop(s32 arg0) { } D_801263BC = (D_801263BC + arg0) & 0x3F; if (gMenuDelay >= -0x13 && gMenuDelay < 0x14) { - func_8008A56C(); + render_magic_codes_list_menu_text(arg0); } - phi_s3 = 0; - phi_a2 = 0; - phi_s2 = 0; + buttonsPressed = 0; + xAxis = 0; + yAxis = 0; if (!gIgnorePlayerInput && gMenuDelay == 0) { - phi_s0 = 0; - temp = (s8*)&gControllersYAxisDirection; - temp2 = (s8*)&gControllersXAxisDirection; - while(phi_s0 < 4) { - phi_s3 |= get_buttons_pressed_from_player(phi_s0); - phi_a2 += *temp; - phi_s2 += *temp2; - temp++; - temp2++; - phi_s0++; + for(i = 0; i < 4; i++){ + buttonsPressed |= get_buttons_pressed_from_player(i); + xAxis += gControllersXAxisDirection[i]; + yAxis += gControllersYAxisDirection[i]; } } - phi_s0 = 0; - phi_s1 = 1; - phi_a3_2 = 0; - while(phi_s0 < 32) { // 32 is the max number of cheats. - if (phi_s1 & gUnlockedMagicCodes) { - D_80126C80[phi_a3_2] = phi_s0; - phi_a3_2++; + code = 1; + numUnlockedCodes = 0; + for(i = 0; i < 32; i++) { // 32 is the max number of cheats. + if (code & gUnlockedMagicCodes) { + D_80126C80[numUnlockedCodes] = i; + numUnlockedCodes++; } - phi_s1 <<= 1; - phi_s0++; + code <<= 1; } - if (((phi_a2 < 0) || (phi_a2 > 0)) && (phi_a3_2 != gOptionsMenuItemIndex)) { + if (((xAxis < 0) || (xAxis > 0)) && (numUnlockedCodes != gOptionsMenuItemIndex)) { func_80001D04(0xEF, NULL); phi_s1 = 1 << D_80126C80[gOptionsMenuItemIndex]; gActiveMagicCodes ^= phi_s1; // Toggle active cheats? @@ -3231,13 +3444,13 @@ s32 menu_magic_codes_list_loop(s32 arg0) { phi_a2 = gOptionsMenuItemIndex; - if (phi_s2 < 0) { + if (yAxis < 0) { gOptionsMenuItemIndex++; - if (phi_a3_2 < gOptionsMenuItemIndex) { - gOptionsMenuItemIndex = phi_a3_2; + if (numUnlockedCodes < gOptionsMenuItemIndex) { + gOptionsMenuItemIndex = numUnlockedCodes; } } - if (phi_s2 > 0) { + if (yAxis > 0) { gOptionsMenuItemIndex--; if ((s32) gOptionsMenuItemIndex < 0) { gOptionsMenuItemIndex = 0; @@ -3254,10 +3467,10 @@ s32 menu_magic_codes_list_loop(s32 arg0) { func_80001D04(0xEB, NULL); } - if ((phi_s3 & 0x9000) && (phi_a3_2 == gOptionsMenuItemIndex)) { + if ((buttonsPressed & 0x9000) && (numUnlockedCodes == gOptionsMenuItemIndex)) { sp48 = -1; } - if (phi_s3 & 0x4000) { + if (buttonsPressed & 0x4000) { sp48 = -1; } if (sp48 != 0) { @@ -3273,6 +3486,8 @@ s32 menu_magic_codes_list_loop(s32 arg0) { gIgnorePlayerInput = 0; return 0; } +#else +GLOBAL_ASM("asm/non_matchings/menu/menu_magic_codes_list_loop.s") #endif void func_8008AD1C(void) { @@ -3626,7 +3841,7 @@ void menu_caution_init(void) { void func_8008C4E8(void); -void draw_menu_element(s32, MenuElement*, f32); +void draw_menu_elements(s32, MenuElement*, f32); s32 menu_caution_loop(s32 arg0) { if (gMenuDelay != 0) { @@ -3637,7 +3852,7 @@ s32 menu_caution_loop(s32 arg0) { func_800C01D8(&D_800DF774); } if (gMenuDelay < 0x14) { - draw_menu_element(1, gCautionMenuTextElements, 1.0f); + draw_menu_elements(1, gCautionMenuTextElements, 1.0f); } if (gMenuDelay >= 0x1F) { func_8008C4E8(); @@ -3731,7 +3946,7 @@ void func_8008C698(s32 arg0) { D_800DF7A0 = 0; } - draw_menu_element(1, (MenuElement*)D_80126460, 1.0f); + draw_menu_elements(1, (MenuElement*)D_80126460, 1.0f); func_80080BC8(&D_801263A0); } } @@ -5195,7 +5410,7 @@ void func_80098EBC(s32 arg0) { } if (D_801263E0 == 2 || D_801263E0 == 3) { - draw_menu_element(1, &D_800E1048, 1.0f); + draw_menu_elements(1, &D_800E1048, 1.0f); } } #else @@ -5607,7 +5822,65 @@ void reset_controller_sticks(void) { } } -GLOBAL_ASM("asm/non_matchings/menu/func_8009BF20.s") +#ifdef NON_MATCHING + +#define STICK_DEADZONE 35 +#define STICK_DELAY_AMOUNT 15 + +// Should be functionally equivalent +void update_controller_sticks(void) { + s32 prevXAxis, prevYAxis; + s32 i; + for(i = 0; i < 4; i++) { + prevXAxis = gControllersXAxis[i]; + prevYAxis = gControllersYAxis[i]; + gControllersXAxis[i] = func_8006A59C(i); + gControllersYAxis[i] = func_8006A5E0(i); + gControllersXAxisDirection[i] = 0; + gControllersYAxisDirection[i] = 0; + if (gControllersXAxis[i] < -STICK_DEADZONE && prevXAxis > -STICK_DEADZONE) { + gControllersXAxisDirection[i] = -1; + gControllersXAxisDelay[i] = 0; + } + if (gControllersXAxis[i] > STICK_DEADZONE && prevXAxis < STICK_DEADZONE) { + gControllersXAxisDirection[i] = 1; + gControllersXAxisDelay[i] = 0; + } + if (gControllersYAxis[i] < -STICK_DEADZONE && prevYAxis > -STICK_DEADZONE) { + gControllersYAxisDirection[i] = -1; + gControllersYAxisDelay[i] = 0; + } + if (gControllersYAxis[i] > STICK_DEADZONE && prevYAxis < STICK_DEADZONE) { + gControllersYAxisDirection[i] = 1; + gControllersYAxisDelay[i] = 0; + } + if (gControllersYAxis[i] < -STICK_DEADZONE) { + gControllersYAxisDelay[i]++; + } else if (gControllersYAxis[i] > STICK_DEADZONE) { + gControllersYAxisDelay[i]++; + } else { + gControllersYAxisDelay[i] = 0; + } + if (gControllersYAxisDelay[i] > STICK_DELAY_AMOUNT) { + gControllersYAxis[i] = 0; + gControllersYAxisDelay[i] = 0; + } + if (gControllersXAxis[i] < -STICK_DEADZONE) { + gControllersXAxisDelay[i]++; + } else if (gControllersXAxis[i] > STICK_DEADZONE) { + gControllersXAxisDelay[i]++; + } else { + gControllersXAxisDelay[i] = 0; + } + if (gControllersXAxisDelay[i] > STICK_DELAY_AMOUNT) { + gControllersXAxis[i] = 0; + gControllersXAxisDelay[i] = 0; + } + } +} +#else +GLOBAL_ASM("asm/non_matchings/menu/update_controller_sticks.s") +#endif /** * Reset the character id number slots to the default. @@ -5913,7 +6186,7 @@ s32 func_8009CFEC(u32 arg0) { func_8006F388(1); } result = 0; - func_8009BF20(); + update_controller_sticks(); func_800C5494(1); func_800C55F4(1); func_800C4FBC(1, 0, 0, 0, 0x80); @@ -5929,7 +6202,7 @@ s32 func_8009CFEC(u32 arg0) { result = func_800C3564(); // Taj challenge completed/failed menu break; case 4: - result = func_8009E7E8(); // Trophy race cabinet menu + result = trophy_race_cabinet_menu_loop(); // Trophy race cabinet menu break; case 5: result = func_8009D9F4(); @@ -6398,9 +6671,40 @@ s32 tt_menu_loop(void) { GLOBAL_ASM("asm/non_matchings/menu/tt_menu_loop.s") #endif - GLOBAL_ASM("asm/non_matchings/menu/func_8009E3D0.s") -GLOBAL_ASM("asm/non_matchings/menu/func_8009E7E8.s") + +s32 trophy_race_cabinet_menu_loop(void) { + s32 sp24; + s32 buttonsPressed; + + func_800C4EDC(1, 0x18, 0x10, 0xB8, 0x78); + func_800C4F7C(1, 0); + sp24 = 0; + buttonsPressed = get_buttons_pressed_from_player(0); + func_800C5168(1, -0x8000, 6, gMenuText[70], 1, 4); // TROPHY RACE + if (gControllersYAxisDirection[0] < 0) { + D_801264D8++; + } else if (gControllersYAxisDirection[0] > 0) { + D_801264D8--; + } + if (D_801264D8 < 0) { + D_801264D8 = 0; + } + if (D_801264D8 > 1) { + D_801264D8 = 1; + } + func_8009D118(D_801264D8 == 0); + func_800C5168(1, -0x8000, 0x1E, gMenuText[180], 1, 4); // ENTER TROPHY RACE + func_8009D118(D_801264D8 == 1); + func_800C5168(1, -0x8000, 0x32, gMenuText[51], 1, 4); // EXIT + if (buttonsPressed & A_BUTTON) { + sp24 = D_801264D8 + 1; + } + if (buttonsPressed & B_BUTTON) { + sp24 = 2; + } + return sp24; +} void func_8009E9A0(void) { diff --git a/src/menu.h b/src/menu.h index cb3c3477..14e691ba 100644 --- a/src/menu.h +++ b/src/menu.h @@ -104,7 +104,7 @@ extern u8 D_800DF4A4; extern u8 D_800DF4A8; extern u8 D_800DF4AC; -extern s32 D_800DF4B0; +extern u8 D_800DF4B0; extern s32 D_800DF4B4; extern s32 gIsInTracksMode; extern s32 gNumberOfActivePlayers;