From ae7451596a8f5a58334f74f6401b317c09170f14 Mon Sep 17 00:00:00 2001 From: Tyler McGavran Date: Sun, 26 Dec 2021 18:10:11 -0500 Subject: [PATCH] Texture related structs and some controller pak menu stuff (#116) Some of this is identifying some functions and structs related to the Controller pak menu Some of it is related to structs concerning textures and "animations" and their associated functions * Match draw_box, func_80098C18, func_80098FC8 Signed-off-by: Taggerung --- asm/bss_8001C4D0.s | 4 +- asm/non_matchings/code_80091750/draw_box.s | 128 ---- .../code_80091750/func_80091D74.s | 4 +- .../code_80091750/func_80098C18.s | 132 ---- .../code_80091750/func_80098FC8.s | 15 - .../code_80091750/func_8009A640.s | 41 -- .../code_80091750/func_8009A6D4.s | 41 ++ .../code_80091750/func_8009A76C.s | 34 - .../code_80091750/func_8009A7EC.s | 37 - .../code_80091750/func_800A0AD0.s | 46 -- .../code_80091750/func_800A0DFC.s | 4 +- .../code_80091750/func_800A0EB8.s | 8 +- .../code_80091750/func_800A954C.s | 123 ---- .../code_80091750/func_800A9710.s | 4 +- .../code_80091750/func_800AA2EC.s | 12 +- .../code_80091750/func_800AD2E8.s | 4 +- .../code_80091750/func_800AE218.s | 4 +- .../code_80091750/segmented_to_virtual.s | 13 - .../code_80091750/segmented_to_virtual_dupe.s | 13 - .../code_800AF9B0/func_800B1C90.s | 32 +- .../code_800AF9B0/func_800B3F74.s | 4 +- .../code_800AF9B0/func_800B5B94.s | 12 +- .../code_800AF9B0/func_800B5F30.s | 8 +- .../code_800AF9B0/func_800B6A68.s | 8 +- data/data_0DD0A0_2.s | 2 +- include/common_structs.h | 63 ++ include/variables.h | 6 + src/code_80005FD0.c | 22 +- src/code_80091750.c | 690 ++++++++---------- src/code_800AF9B0.c | 72 +- 30 files changed, 505 insertions(+), 1081 deletions(-) delete mode 100644 asm/non_matchings/code_80091750/draw_box.s delete mode 100644 asm/non_matchings/code_80091750/func_80098C18.s delete mode 100644 asm/non_matchings/code_80091750/func_80098FC8.s create mode 100644 asm/non_matchings/code_80091750/func_8009A6D4.s delete mode 100644 asm/non_matchings/code_80091750/func_8009A76C.s delete mode 100644 asm/non_matchings/code_80091750/func_8009A7EC.s delete mode 100644 asm/non_matchings/code_80091750/func_800A0AD0.s delete mode 100644 asm/non_matchings/code_80091750/func_800A954C.s delete mode 100644 asm/non_matchings/code_80091750/segmented_to_virtual.s delete mode 100644 asm/non_matchings/code_80091750/segmented_to_virtual_dupe.s diff --git a/asm/bss_8001C4D0.s b/asm/bss_8001C4D0.s index aef5d138a..b2953cfa8 100644 --- a/asm/bss_8001C4D0.s +++ b/asm/bss_8001C4D0.s @@ -1917,7 +1917,7 @@ glabel D_8018EB78 glabel D_8018EB7C .skip 4 -glabel D_8018EB80 +glabel gControllerPakNumPagesFree .skip 4 glabel D_8018EB84 @@ -2082,7 +2082,7 @@ glabel D_8018EDEE glabel gDebugMenuSelection .skip 1 -glabel gPlayerCountSelection2 # 0x8018EDF0 +glabel gMenuState # 0x8018EDF0 .skip 1 glabel D_8018EDF1 diff --git a/asm/non_matchings/code_80091750/draw_box.s b/asm/non_matchings/code_80091750/draw_box.s deleted file mode 100644 index cace7d58b..000000000 --- a/asm/non_matchings/code_80091750/draw_box.s +++ /dev/null @@ -1,128 +0,0 @@ -glabel draw_box -/* 0999F8 80098DF8 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 0999FC 80098DFC 8FAE0034 */ lw $t6, 0x34($sp) -/* 099A00 80098E00 8FB80038 */ lw $t8, 0x38($sp) -/* 099A04 80098E04 8FA8003C */ lw $t0, 0x3c($sp) -/* 099A08 80098E08 8FAA0040 */ lw $t2, 0x40($sp) -/* 099A0C 80098E0C AFB00018 */ sw $s0, 0x18($sp) -/* 099A10 80098E10 00E5082A */ slt $at, $a3, $a1 -/* 099A14 80098E14 31CF00FF */ andi $t7, $t6, 0xff -/* 099A18 80098E18 331900FF */ andi $t9, $t8, 0xff -/* 099A1C 80098E1C 310900FF */ andi $t1, $t0, 0xff -/* 099A20 80098E20 314B00FF */ andi $t3, $t2, 0xff -/* 099A24 80098E24 00808025 */ move $s0, $a0 -/* 099A28 80098E28 AFBF001C */ sw $ra, 0x1c($sp) -/* 099A2C 80098E2C AFA50024 */ sw $a1, 0x24($sp) -/* 099A30 80098E30 AFA60028 */ sw $a2, 0x28($sp) -/* 099A34 80098E34 AFA7002C */ sw $a3, 0x2c($sp) -/* 099A38 80098E38 AFAF0034 */ sw $t7, 0x34($sp) -/* 099A3C 80098E3C AFB90038 */ sw $t9, 0x38($sp) -/* 099A40 80098E40 AFA9003C */ sw $t1, 0x3c($sp) -/* 099A44 80098E44 10200004 */ beqz $at, .L80098E58 -/* 099A48 80098E48 AFAB0040 */ sw $t3, 0x40($sp) -/* 099A4C 80098E4C 27A40024 */ addiu $a0, $sp, 0x24 -/* 099A50 80098E50 0C0246D9 */ jal swap_values -/* 099A54 80098E54 27A5002C */ addiu $a1, $sp, 0x2c -.L80098E58: -/* 099A58 80098E58 8FA20030 */ lw $v0, 0x30($sp) -/* 099A5C 80098E5C 8FAE0028 */ lw $t6, 0x28($sp) -/* 099A60 80098E60 27A40028 */ addiu $a0, $sp, 0x28 -/* 099A64 80098E64 004E082A */ slt $at, $v0, $t6 -/* 099A68 80098E68 50200005 */ beql $at, $zero, .L80098E80 -/* 099A6C 80098E6C 8FAF0024 */ lw $t7, 0x24($sp) -/* 099A70 80098E70 0C0246D9 */ jal swap_values -/* 099A74 80098E74 27A50030 */ addiu $a1, $sp, 0x30 -/* 099A78 80098E78 8FA20030 */ lw $v0, 0x30($sp) -/* 099A7C 80098E7C 8FAF0024 */ lw $t7, 0x24($sp) -.L80098E80: -/* 099A80 80098E80 8FB80028 */ lw $t8, 0x28($sp) -/* 099A84 80098E84 29E10140 */ slti $at, $t7, 0x140 -/* 099A88 80098E88 10200003 */ beqz $at, .L80098E98 -/* 099A8C 80098E8C 2B0100F0 */ slti $at, $t8, 0xf0 -/* 099A90 80098E90 14200003 */ bnez $at, .L80098EA0 -/* 099A94 80098E94 8FB90024 */ lw $t9, 0x24($sp) -.L80098E98: -/* 099A98 80098E98 10000046 */ b .L80098FB4 -/* 099A9C 80098E9C 02001025 */ move $v0, $s0 -.L80098EA0: -/* 099AA0 80098EA0 07230003 */ bgezl $t9, .L80098EB0 -/* 099AA4 80098EA4 8FA80028 */ lw $t0, 0x28($sp) -/* 099AA8 80098EA8 AFA00024 */ sw $zero, 0x24($sp) -/* 099AAC 80098EAC 8FA80028 */ lw $t0, 0x28($sp) -.L80098EB0: -/* 099AB0 80098EB0 05030003 */ bgezl $t0, .L80098EC0 -/* 099AB4 80098EB4 8FA9002C */ lw $t1, 0x2c($sp) -/* 099AB8 80098EB8 AFA00028 */ sw $zero, 0x28($sp) -/* 099ABC 80098EBC 8FA9002C */ lw $t1, 0x2c($sp) -.L80098EC0: -/* 099AC0 80098EC0 05200003 */ bltz $t1, .L80098ED0 -/* 099AC4 80098EC4 00000000 */ nop -/* 099AC8 80098EC8 04410003 */ bgez $v0, .L80098ED8 -/* 099ACC 80098ECC 8FAA002C */ lw $t2, 0x2c($sp) -.L80098ED0: -/* 099AD0 80098ED0 10000038 */ b .L80098FB4 -/* 099AD4 80098ED4 02001025 */ move $v0, $s0 -.L80098ED8: -/* 099AD8 80098ED8 29410141 */ slti $at, $t2, 0x141 -/* 099ADC 80098EDC 14200003 */ bnez $at, .L80098EEC -/* 099AE0 80098EE0 3C0C0600 */ lui $t4, 0x600 -/* 099AE4 80098EE4 240B0140 */ li $t3, 320 -/* 099AE8 80098EE8 AFAB002C */ sw $t3, 0x2c($sp) -.L80098EEC: -/* 099AEC 80098EEC 284100F1 */ slti $at, $v0, 0xf1 -/* 099AF0 80098EF0 14200003 */ bnez $at, .L80098F00 -/* 099AF4 80098EF4 3C0D0201 */ lui $t5, %hi(D_02008008) # $t5, 0x201 -/* 099AF8 80098EF8 240200F0 */ li $v0, 240 -/* 099AFC 80098EFC AFA20030 */ sw $v0, 0x30($sp) -.L80098F00: -/* 099B00 80098F00 02001025 */ move $v0, $s0 -/* 099B04 80098F04 25AD8008 */ addiu $t5, %lo(D_02008008) # addiu $t5, $t5, -0x7ff8 -/* 099B08 80098F08 AC4D0004 */ sw $t5, 4($v0) -/* 099B0C 80098F0C AC4C0000 */ sw $t4, ($v0) -/* 099B10 80098F10 3C0EFA00 */ lui $t6, 0xfa00 -/* 099B14 80098F14 AE0E0008 */ sw $t6, 8($s0) -/* 099B18 80098F18 8FB80034 */ lw $t8, 0x34($sp) -/* 099B1C 80098F1C 8FA80038 */ lw $t0, 0x38($sp) -/* 099B20 80098F20 8FAC003C */ lw $t4, 0x3c($sp) -/* 099B24 80098F24 0018CE00 */ sll $t9, $t8, 0x18 -/* 099B28 80098F28 8FB80040 */ lw $t8, 0x40($sp) -/* 099B2C 80098F2C 310900FF */ andi $t1, $t0, 0xff -/* 099B30 80098F30 00095400 */ sll $t2, $t1, 0x10 -/* 099B34 80098F34 318D00FF */ andi $t5, $t4, 0xff -/* 099B38 80098F38 000D7200 */ sll $t6, $t5, 8 -/* 099B3C 80098F3C 032A5825 */ or $t3, $t9, $t2 -/* 099B40 80098F40 016E7825 */ or $t7, $t3, $t6 -/* 099B44 80098F44 330800FF */ andi $t0, $t8, 0xff -/* 099B48 80098F48 01E84825 */ or $t1, $t7, $t0 -/* 099B4C 80098F4C AE09000C */ sw $t1, 0xc($s0) -/* 099B50 80098F50 8FB9002C */ lw $t9, 0x2c($sp) -/* 099B54 80098F54 8FAB0030 */ lw $t3, 0x30($sp) -/* 099B58 80098F58 3C01F600 */ lui $at, 0xf600 -/* 099B5C 80098F5C 332A03FF */ andi $t2, $t9, 0x3ff -/* 099B60 80098F60 000A6380 */ sll $t4, $t2, 0xe -/* 099B64 80098F64 316E03FF */ andi $t6, $t3, 0x3ff -/* 099B68 80098F68 26100008 */ addiu $s0, $s0, 8 -/* 099B6C 80098F6C 000EC080 */ sll $t8, $t6, 2 -/* 099B70 80098F70 01816825 */ or $t5, $t4, $at -/* 099B74 80098F74 26040008 */ addiu $a0, $s0, 8 -/* 099B78 80098F78 01B87825 */ or $t7, $t5, $t8 -/* 099B7C 80098F7C AC8F0000 */ sw $t7, ($a0) -/* 099B80 80098F80 8FAA0028 */ lw $t2, 0x28($sp) -/* 099B84 80098F84 8FA80024 */ lw $t0, 0x24($sp) -/* 099B88 80098F88 24830008 */ addiu $v1, $a0, 8 -/* 099B8C 80098F8C 314C03FF */ andi $t4, $t2, 0x3ff -/* 099B90 80098F90 310903FF */ andi $t1, $t0, 0x3ff -/* 099B94 80098F94 0009CB80 */ sll $t9, $t1, 0xe -/* 099B98 80098F98 000C5880 */ sll $t3, $t4, 2 -/* 099B9C 80098F9C 032B7025 */ or $t6, $t9, $t3 -/* 099BA0 80098FA0 AC8E0004 */ sw $t6, 4($a0) -/* 099BA4 80098FA4 3C0DE700 */ lui $t5, 0xe700 -/* 099BA8 80098FA8 AC6D0000 */ sw $t5, ($v1) -/* 099BAC 80098FAC AC600004 */ sw $zero, 4($v1) -/* 099BB0 80098FB0 24620008 */ addiu $v0, $v1, 8 -.L80098FB4: -/* 099BB4 80098FB4 8FBF001C */ lw $ra, 0x1c($sp) -/* 099BB8 80098FB8 8FB00018 */ lw $s0, 0x18($sp) -/* 099BBC 80098FBC 27BD0020 */ addiu $sp, $sp, 0x20 -/* 099BC0 80098FC0 03E00008 */ jr $ra -/* 099BC4 80098FC4 00000000 */ nop diff --git a/asm/non_matchings/code_80091750/func_80091D74.s b/asm/non_matchings/code_80091750/func_80091D74.s index a35c5d119..8c324fae0 100644 --- a/asm/non_matchings/code_80091750/func_80091D74.s +++ b/asm/non_matchings/code_80091750/func_80091D74.s @@ -77,8 +77,8 @@ glabel func_80091D74 /* 092A84 80091E84 26310004 */ addiu $s1, $s1, 4 /* 092A88 80091E88 1613FFF8 */ bne $s0, $s3, .L80091E6C /* 092A8C 80091E8C AE22FFFC */ sw $v0, -4($s1) -/* 092A90 80091E90 3C108019 */ lui $s0, %hi(D_8018EB80) # $s0, 0x8019 -/* 092A94 80091E94 2610EB80 */ addiu $s0, %lo(D_8018EB80) # addiu $s0, $s0, -0x1480 +/* 092A90 80091E90 3C108019 */ lui $s0, %hi(gControllerPakNumPagesFree) # $s0, 0x8019 +/* 092A94 80091E94 2610EB80 */ addiu $s0, %lo(gControllerPakNumPagesFree) # addiu $s0, $s0, -0x1480 /* 092A98 80091E98 02002825 */ move $a1, $s0 /* 092A9C 80091E9C 0C033B48 */ jal osPfsFreeBlocks /* 092AA0 80091EA0 02802025 */ move $a0, $s4 diff --git a/asm/non_matchings/code_80091750/func_80098C18.s b/asm/non_matchings/code_80091750/func_80098C18.s deleted file mode 100644 index 2119ab76b..000000000 --- a/asm/non_matchings/code_80091750/func_80098C18.s +++ /dev/null @@ -1,132 +0,0 @@ -glabel func_80098C18 -/* 099818 80098C18 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 09981C 80098C1C 8FAE0034 */ lw $t6, 0x34($sp) -/* 099820 80098C20 8FB80038 */ lw $t8, 0x38($sp) -/* 099824 80098C24 8FA8003C */ lw $t0, 0x3c($sp) -/* 099828 80098C28 8FAA0040 */ lw $t2, 0x40($sp) -/* 09982C 80098C2C AFB00018 */ sw $s0, 0x18($sp) -/* 099830 80098C30 00E5082A */ slt $at, $a3, $a1 -/* 099834 80098C34 31CF00FF */ andi $t7, $t6, 0xff -/* 099838 80098C38 331900FF */ andi $t9, $t8, 0xff -/* 09983C 80098C3C 310900FF */ andi $t1, $t0, 0xff -/* 099840 80098C40 314B00FF */ andi $t3, $t2, 0xff -/* 099844 80098C44 00808025 */ move $s0, $a0 -/* 099848 80098C48 AFBF001C */ sw $ra, 0x1c($sp) -/* 09984C 80098C4C AFA50024 */ sw $a1, 0x24($sp) -/* 099850 80098C50 AFA60028 */ sw $a2, 0x28($sp) -/* 099854 80098C54 AFA7002C */ sw $a3, 0x2c($sp) -/* 099858 80098C58 AFAF0034 */ sw $t7, 0x34($sp) -/* 09985C 80098C5C AFB90038 */ sw $t9, 0x38($sp) -/* 099860 80098C60 AFA9003C */ sw $t1, 0x3c($sp) -/* 099864 80098C64 10200004 */ beqz $at, .L80098C78 -/* 099868 80098C68 AFAB0040 */ sw $t3, 0x40($sp) -/* 09986C 80098C6C 27A40024 */ addiu $a0, $sp, 0x24 -/* 099870 80098C70 0C0246D9 */ jal swap_values -/* 099874 80098C74 27A5002C */ addiu $a1, $sp, 0x2c -.L80098C78: -/* 099878 80098C78 8FA20030 */ lw $v0, 0x30($sp) -/* 09987C 80098C7C 8FAE0028 */ lw $t6, 0x28($sp) -/* 099880 80098C80 27A40028 */ addiu $a0, $sp, 0x28 -/* 099884 80098C84 004E082A */ slt $at, $v0, $t6 -/* 099888 80098C88 50200005 */ beql $at, $zero, .L80098CA0 -/* 09988C 80098C8C 8FAF0024 */ lw $t7, 0x24($sp) -/* 099890 80098C90 0C0246D9 */ jal swap_values -/* 099894 80098C94 27A50030 */ addiu $a1, $sp, 0x30 -/* 099898 80098C98 8FA20030 */ lw $v0, 0x30($sp) -/* 09989C 80098C9C 8FAF0024 */ lw $t7, 0x24($sp) -.L80098CA0: -/* 0998A0 80098CA0 8FB80028 */ lw $t8, 0x28($sp) -/* 0998A4 80098CA4 29E10140 */ slti $at, $t7, 0x140 -/* 0998A8 80098CA8 10200003 */ beqz $at, .L80098CB8 -/* 0998AC 80098CAC 2B0100F0 */ slti $at, $t8, 0xf0 -/* 0998B0 80098CB0 14200003 */ bnez $at, .L80098CC0 -/* 0998B4 80098CB4 8FB90024 */ lw $t9, 0x24($sp) -.L80098CB8: -/* 0998B8 80098CB8 1000004A */ b .L80098DE4 -/* 0998BC 80098CBC 02001025 */ move $v0, $s0 -.L80098CC0: -/* 0998C0 80098CC0 07230003 */ bgezl $t9, .L80098CD0 -/* 0998C4 80098CC4 8FA80028 */ lw $t0, 0x28($sp) -/* 0998C8 80098CC8 AFA00024 */ sw $zero, 0x24($sp) -/* 0998CC 80098CCC 8FA80028 */ lw $t0, 0x28($sp) -.L80098CD0: -/* 0998D0 80098CD0 05030003 */ bgezl $t0, .L80098CE0 -/* 0998D4 80098CD4 8FA9002C */ lw $t1, 0x2c($sp) -/* 0998D8 80098CD8 AFA00028 */ sw $zero, 0x28($sp) -/* 0998DC 80098CDC 8FA9002C */ lw $t1, 0x2c($sp) -.L80098CE0: -/* 0998E0 80098CE0 05200003 */ bltz $t1, .L80098CF0 -/* 0998E4 80098CE4 00000000 */ nop -/* 0998E8 80098CE8 04410003 */ bgez $v0, .L80098CF8 -/* 0998EC 80098CEC 8FAA002C */ lw $t2, 0x2c($sp) -.L80098CF0: -/* 0998F0 80098CF0 1000003C */ b .L80098DE4 -/* 0998F4 80098CF4 02001025 */ move $v0, $s0 -.L80098CF8: -/* 0998F8 80098CF8 29410140 */ slti $at, $t2, 0x140 -/* 0998FC 80098CFC 14200003 */ bnez $at, .L80098D0C -/* 099900 80098D00 3C060600 */ lui $a2, 0x600 -/* 099904 80098D04 240B013F */ li $t3, 319 -/* 099908 80098D08 AFAB002C */ sw $t3, 0x2c($sp) -.L80098D0C: -/* 09990C 80098D0C 284100F0 */ slti $at, $v0, 0xf0 -/* 099910 80098D10 14200003 */ bnez $at, .L80098D20 -/* 099914 80098D14 3C0C0201 */ lui $t4, %hi(D_02008030) # $t4, 0x201 -/* 099918 80098D18 240200EF */ li $v0, 239 -/* 09991C 80098D1C AFA20030 */ sw $v0, 0x30($sp) -.L80098D20: -/* 099920 80098D20 02001025 */ move $v0, $s0 -/* 099924 80098D24 258C8030 */ addiu $t4, %lo(D_02008030) # addiu $t4, $t4, -0x7fd0 -/* 099928 80098D28 AC4C0004 */ sw $t4, 4($v0) -/* 09992C 80098D2C AC460000 */ sw $a2, ($v0) -/* 099930 80098D30 3C0DF700 */ lui $t5, 0xf700 -/* 099934 80098D34 AE0D0008 */ sw $t5, 8($s0) -/* 099938 80098D38 8FAE0034 */ lw $t6, 0x34($sp) -/* 09993C 80098D3C 8FB90038 */ lw $t9, 0x38($sp) -/* 099940 80098D40 8FAB003C */ lw $t3, 0x3c($sp) -/* 099944 80098D44 000E7A00 */ sll $t7, $t6, 8 -/* 099948 80098D48 31F8F800 */ andi $t8, $t7, 0xf800 -/* 09994C 80098D4C 8FAF0040 */ lw $t7, 0x40($sp) -/* 099950 80098D50 001940C0 */ sll $t0, $t9, 3 -/* 099954 80098D54 310907C0 */ andi $t1, $t0, 0x7c0 -/* 099958 80098D58 000B6082 */ srl $t4, $t3, 2 -/* 09995C 80098D5C 318D003E */ andi $t5, $t4, 0x3e -/* 099960 80098D60 03095025 */ or $t2, $t8, $t1 -/* 099964 80098D64 014D7025 */ or $t6, $t2, $t5 -/* 099968 80098D68 31F90001 */ andi $t9, $t7, 1 -/* 09996C 80098D6C 01D92025 */ or $a0, $t6, $t9 -/* 099970 80098D70 00044400 */ sll $t0, $a0, 0x10 -/* 099974 80098D74 0104C025 */ or $t8, $t0, $a0 -/* 099978 80098D78 AE18000C */ sw $t8, 0xc($s0) -/* 09997C 80098D7C 8FA9002C */ lw $t1, 0x2c($sp) -/* 099980 80098D80 8FAD0030 */ lw $t5, 0x30($sp) -/* 099984 80098D84 3C01F600 */ lui $at, 0xf600 -/* 099988 80098D88 312B03FF */ andi $t3, $t1, 0x3ff -/* 09998C 80098D8C 000B6380 */ sll $t4, $t3, 0xe -/* 099990 80098D90 31AF03FF */ andi $t7, $t5, 0x3ff -/* 099994 80098D94 26100008 */ addiu $s0, $s0, 8 -/* 099998 80098D98 000F7080 */ sll $t6, $t7, 2 -/* 09999C 80098D9C 01815025 */ or $t2, $t4, $at -/* 0999A0 80098DA0 26050008 */ addiu $a1, $s0, 8 -/* 0999A4 80098DA4 014EC825 */ or $t9, $t2, $t6 -/* 0999A8 80098DA8 ACB90000 */ sw $t9, ($a1) -/* 0999AC 80098DAC 8FAB0028 */ lw $t3, 0x28($sp) -/* 0999B0 80098DB0 8FA80024 */ lw $t0, 0x24($sp) -/* 0999B4 80098DB4 24A30008 */ addiu $v1, $a1, 8 -/* 0999B8 80098DB8 316C03FF */ andi $t4, $t3, 0x3ff -/* 0999BC 80098DBC 311803FF */ andi $t8, $t0, 0x3ff -/* 0999C0 80098DC0 00184B80 */ sll $t1, $t8, 0xe -/* 0999C4 80098DC4 000C6880 */ sll $t5, $t4, 2 -/* 0999C8 80098DC8 012D7825 */ or $t7, $t1, $t5 -/* 0999CC 80098DCC ACAF0004 */ sw $t7, 4($a1) -/* 0999D0 80098DD0 3C0A0201 */ lui $t2, %hi(D_02008058) # $t2, 0x201 -/* 0999D4 80098DD4 254A8058 */ addiu $t2, %lo(D_02008058) # addiu $t2, $t2, -0x7fa8 -/* 0999D8 80098DD8 AC6A0004 */ sw $t2, 4($v1) -/* 0999DC 80098DDC AC660000 */ sw $a2, ($v1) -/* 0999E0 80098DE0 24620008 */ addiu $v0, $v1, 8 -.L80098DE4: -/* 0999E4 80098DE4 8FBF001C */ lw $ra, 0x1c($sp) -/* 0999E8 80098DE8 8FB00018 */ lw $s0, 0x18($sp) -/* 0999EC 80098DEC 27BD0020 */ addiu $sp, $sp, 0x20 -/* 0999F0 80098DF0 03E00008 */ jr $ra -/* 0999F4 80098DF4 00000000 */ nop diff --git a/asm/non_matchings/code_80091750/func_80098FC8.s b/asm/non_matchings/code_80091750/func_80098FC8.s deleted file mode 100644 index 1025c7651..000000000 --- a/asm/non_matchings/code_80091750/func_80098FC8.s +++ /dev/null @@ -1,15 +0,0 @@ -glabel func_80098FC8 -/* 099BC8 80098FC8 27BDFFD0 */ addiu $sp, $sp, -0x30 -/* 099BCC 80098FCC 8FAE0040 */ lw $t6, 0x40($sp) -/* 099BD0 80098FD0 AFBF002C */ sw $ra, 0x2c($sp) -/* 099BD4 80098FD4 240F00FF */ li $t7, 255 -/* 099BD8 80098FD8 AFAF0020 */ sw $t7, 0x20($sp) -/* 099BDC 80098FDC AFA00014 */ sw $zero, 0x14($sp) -/* 099BE0 80098FE0 AFA00018 */ sw $zero, 0x18($sp) -/* 099BE4 80098FE4 AFA0001C */ sw $zero, 0x1c($sp) -/* 099BE8 80098FE8 0C026306 */ jal func_80098C18 -/* 099BEC 80098FEC AFAE0010 */ sw $t6, 0x10($sp) -/* 099BF0 80098FF0 8FBF002C */ lw $ra, 0x2c($sp) -/* 099BF4 80098FF4 27BD0030 */ addiu $sp, $sp, 0x30 -/* 099BF8 80098FF8 03E00008 */ jr $ra -/* 099BFC 80098FFC 00000000 */ nop diff --git a/asm/non_matchings/code_80091750/func_8009A640.s b/asm/non_matchings/code_80091750/func_8009A640.s index aac366110..0696385d3 100644 --- a/asm/non_matchings/code_80091750/func_8009A640.s +++ b/asm/non_matchings/code_80091750/func_8009A640.s @@ -36,44 +36,3 @@ glabel func_8009A640 /* 09B2C8 8009A6C8 27BD0028 */ addiu $sp, $sp, 0x28 /* 09B2CC 8009A6CC 03E00008 */ jr $ra /* 09B2D0 8009A6D0 00000000 */ nop - -/* 09B2D4 8009A6D4 27BDFFD0 */ addiu $sp, $sp, -0x30 -/* 09B2D8 8009A6D8 AFB30028 */ sw $s3, 0x28($sp) -/* 09B2DC 8009A6DC AFB10020 */ sw $s1, 0x20($sp) -/* 09B2E0 8009A6E0 AFB0001C */ sw $s0, 0x1c($sp) -/* 09B2E4 8009A6E4 AFB20024 */ sw $s2, 0x24($sp) -/* 09B2E8 8009A6E8 3C108019 */ lui $s0, %hi(D_8018DEE0) # $s0, 0x8019 -/* 09B2EC 8009A6EC 3C118015 */ lui $s1, %hi(gDisplayListHead) # $s1, 0x8015 -/* 09B2F0 8009A6F0 3C138019 */ lui $s3, %hi(D_8018E060) # $s3, 0x8019 -/* 09B2F4 8009A6F4 AFBF002C */ sw $ra, 0x2c($sp) -/* 09B2F8 8009A6F8 2673E060 */ addiu $s3, %lo(D_8018E060) # addiu $s3, $s3, -0x1fa0 -/* 09B2FC 8009A6FC 26310298 */ addiu $s1, %lo(gDisplayListHead) # addiu $s1, $s1, 0x298 -/* 09B300 8009A700 2610DEE0 */ addiu $s0, %lo(D_8018DEE0) # addiu $s0, $s0, -0x2120 -/* 09B304 8009A704 3C128000 */ lui $s2, 0x8000 -/* 09B308 8009A708 8E0E000C */ lw $t6, 0xc($s0) -.L8009A70C: -/* 09B30C 8009A70C 01D27824 */ and $t7, $t6, $s2 -/* 09B310 8009A710 51E0000B */ beql $t7, $zero, .L8009A740 -/* 09B314 8009A714 26100018 */ addiu $s0, $s0, 0x18 -/* 09B318 8009A718 0C026A1E */ jal func_8009A878 -/* 09B31C 8009A71C 02002025 */ move $a0, $s0 -/* 09B320 8009A720 8E240000 */ lw $a0, ($s1) -/* 09B324 8009A724 02002825 */ move $a1, $s0 -/* 09B328 8009A728 00003025 */ move $a2, $zero -/* 09B32C 8009A72C 00003825 */ move $a3, $zero -/* 09B330 8009A730 0C02710D */ jal func_8009C434 -/* 09B334 8009A734 AFA00010 */ sw $zero, 0x10($sp) -/* 09B338 8009A738 AE220000 */ sw $v0, ($s1) -/* 09B33C 8009A73C 26100018 */ addiu $s0, $s0, 0x18 -.L8009A740: -/* 09B340 8009A740 5613FFF2 */ bnel $s0, $s3, .L8009A70C -/* 09B344 8009A744 8E0E000C */ lw $t6, 0xc($s0) -/* 09B348 8009A748 0C0266BB */ jal func_80099AEC -/* 09B34C 8009A74C 00000000 */ nop -/* 09B350 8009A750 8FBF002C */ lw $ra, 0x2c($sp) -/* 09B354 8009A754 8FB0001C */ lw $s0, 0x1c($sp) -/* 09B358 8009A758 8FB10020 */ lw $s1, 0x20($sp) -/* 09B35C 8009A75C 8FB20024 */ lw $s2, 0x24($sp) -/* 09B360 8009A760 8FB30028 */ lw $s3, 0x28($sp) -/* 09B364 8009A764 03E00008 */ jr $ra -/* 09B368 8009A768 27BD0030 */ addiu $sp, $sp, 0x30 diff --git a/asm/non_matchings/code_80091750/func_8009A6D4.s b/asm/non_matchings/code_80091750/func_8009A6D4.s new file mode 100644 index 000000000..8a9b57af5 --- /dev/null +++ b/asm/non_matchings/code_80091750/func_8009A6D4.s @@ -0,0 +1,41 @@ +glabel func_8009A6D4 #UNUSED +/* 09B2D4 8009A6D4 27BDFFD0 */ addiu $sp, $sp, -0x30 +/* 09B2D8 8009A6D8 AFB30028 */ sw $s3, 0x28($sp) +/* 09B2DC 8009A6DC AFB10020 */ sw $s1, 0x20($sp) +/* 09B2E0 8009A6E0 AFB0001C */ sw $s0, 0x1c($sp) +/* 09B2E4 8009A6E4 AFB20024 */ sw $s2, 0x24($sp) +/* 09B2E8 8009A6E8 3C108019 */ lui $s0, %hi(D_8018DEE0) # $s0, 0x8019 +/* 09B2EC 8009A6EC 3C118015 */ lui $s1, %hi(gDisplayListHead) # $s1, 0x8015 +/* 09B2F0 8009A6F0 3C138019 */ lui $s3, %hi(D_8018E060) # $s3, 0x8019 +/* 09B2F4 8009A6F4 AFBF002C */ sw $ra, 0x2c($sp) +/* 09B2F8 8009A6F8 2673E060 */ addiu $s3, %lo(D_8018E060) # addiu $s3, $s3, -0x1fa0 +/* 09B2FC 8009A6FC 26310298 */ addiu $s1, %lo(gDisplayListHead) # addiu $s1, $s1, 0x298 +/* 09B300 8009A700 2610DEE0 */ addiu $s0, %lo(D_8018DEE0) # addiu $s0, $s0, -0x2120 +/* 09B304 8009A704 3C128000 */ lui $s2, 0x8000 +/* 09B308 8009A708 8E0E000C */ lw $t6, 0xc($s0) +.L8009A70C: +/* 09B30C 8009A70C 01D27824 */ and $t7, $t6, $s2 +/* 09B310 8009A710 51E0000B */ beql $t7, $zero, .L8009A740 +/* 09B314 8009A714 26100018 */ addiu $s0, $s0, 0x18 +/* 09B318 8009A718 0C026A1E */ jal func_8009A878 +/* 09B31C 8009A71C 02002025 */ move $a0, $s0 +/* 09B320 8009A720 8E240000 */ lw $a0, ($s1) +/* 09B324 8009A724 02002825 */ move $a1, $s0 +/* 09B328 8009A728 00003025 */ move $a2, $zero +/* 09B32C 8009A72C 00003825 */ move $a3, $zero +/* 09B330 8009A730 0C02710D */ jal func_8009C434 +/* 09B334 8009A734 AFA00010 */ sw $zero, 0x10($sp) +/* 09B338 8009A738 AE220000 */ sw $v0, ($s1) +/* 09B33C 8009A73C 26100018 */ addiu $s0, $s0, 0x18 +.L8009A740: +/* 09B340 8009A740 5613FFF2 */ bnel $s0, $s3, .L8009A70C +/* 09B344 8009A744 8E0E000C */ lw $t6, 0xc($s0) +/* 09B348 8009A748 0C0266BB */ jal func_80099AEC +/* 09B34C 8009A74C 00000000 */ nop +/* 09B350 8009A750 8FBF002C */ lw $ra, 0x2c($sp) +/* 09B354 8009A754 8FB0001C */ lw $s0, 0x1c($sp) +/* 09B358 8009A758 8FB10020 */ lw $s1, 0x20($sp) +/* 09B35C 8009A75C 8FB20024 */ lw $s2, 0x24($sp) +/* 09B360 8009A760 8FB30028 */ lw $s3, 0x28($sp) +/* 09B364 8009A764 03E00008 */ jr $ra +/* 09B368 8009A768 27BD0030 */ addiu $sp, $sp, 0x30 diff --git a/asm/non_matchings/code_80091750/func_8009A76C.s b/asm/non_matchings/code_80091750/func_8009A76C.s deleted file mode 100644 index 8b6ecfab6..000000000 --- a/asm/non_matchings/code_80091750/func_8009A76C.s +++ /dev/null @@ -1,34 +0,0 @@ -glabel func_8009A76C -/* 09B36C 8009A76C 27BDFFD8 */ addiu $sp, $sp, -0x28 -/* 09B370 8009A770 00047080 */ sll $t6, $a0, 2 -/* 09B374 8009A774 01C47023 */ subu $t6, $t6, $a0 -/* 09B378 8009A778 3C0F8019 */ lui $t7, %hi(D_8018DEE0) # $t7, 0x8019 -/* 09B37C 8009A77C 25EFDEE0 */ addiu $t7, %lo(D_8018DEE0) # addiu $t7, $t7, -0x2120 -/* 09B380 8009A780 000E70C0 */ sll $t6, $t6, 3 -/* 09B384 8009A784 01CFC021 */ addu $t8, $t6, $t7 -/* 09B388 8009A788 AFBF001C */ sw $ra, 0x1c($sp) -/* 09B38C 8009A78C AFA5002C */ sw $a1, 0x2c($sp) -/* 09B390 8009A790 AFA60030 */ sw $a2, 0x30($sp) -/* 09B394 8009A794 AFA70034 */ sw $a3, 0x34($sp) -/* 09B398 8009A798 AFB80020 */ sw $t8, 0x20($sp) -/* 09B39C 8009A79C 8F19000C */ lw $t9, 0xc($t8) -/* 09B3A0 8009A7A0 00194000 */ sll $t0, $t9, 0 -/* 09B3A4 8009A7A4 0503000E */ bgezl $t0, .L8009A7E0 -/* 09B3A8 8009A7A8 8FBF001C */ lw $ra, 0x1c($sp) -/* 09B3AC 8009A7AC 0C026A1E */ jal func_8009A878 -/* 09B3B0 8009A7B0 03002025 */ move $a0, $t8 -/* 09B3B4 8009A7B4 8FA90034 */ lw $t1, 0x34($sp) -/* 09B3B8 8009A7B8 3C048015 */ lui $a0, %hi(gDisplayListHead) # $a0, 0x8015 -/* 09B3BC 8009A7BC 8C840298 */ lw $a0, %lo(gDisplayListHead)($a0) -/* 09B3C0 8009A7C0 8FA50020 */ lw $a1, 0x20($sp) -/* 09B3C4 8009A7C4 8FA6002C */ lw $a2, 0x2c($sp) -/* 09B3C8 8009A7C8 8FA70030 */ lw $a3, 0x30($sp) -/* 09B3CC 8009A7CC 0C02710D */ jal func_8009C434 -/* 09B3D0 8009A7D0 AFA90010 */ sw $t1, 0x10($sp) -/* 09B3D4 8009A7D4 3C018015 */ lui $at, %hi(gDisplayListHead) # $at, 0x8015 -/* 09B3D8 8009A7D8 AC220298 */ sw $v0, %lo(gDisplayListHead)($at) -/* 09B3DC 8009A7DC 8FBF001C */ lw $ra, 0x1c($sp) -.L8009A7E0: -/* 09B3E0 8009A7E0 27BD0028 */ addiu $sp, $sp, 0x28 -/* 09B3E4 8009A7E4 03E00008 */ jr $ra -/* 09B3E8 8009A7E8 00000000 */ nop diff --git a/asm/non_matchings/code_80091750/func_8009A7EC.s b/asm/non_matchings/code_80091750/func_8009A7EC.s deleted file mode 100644 index 66610bb32..000000000 --- a/asm/non_matchings/code_80091750/func_8009A7EC.s +++ /dev/null @@ -1,37 +0,0 @@ -glabel func_8009A7EC -/* 09B3EC 8009A7EC 27BDFFD8 */ addiu $sp, $sp, -0x28 -/* 09B3F0 8009A7F0 00047080 */ sll $t6, $a0, 2 -/* 09B3F4 8009A7F4 01C47023 */ subu $t6, $t6, $a0 -/* 09B3F8 8009A7F8 3C0F8019 */ lui $t7, %hi(D_8018DEE0) # $t7, 0x8019 -/* 09B3FC 8009A7FC 25EFDEE0 */ addiu $t7, %lo(D_8018DEE0) # addiu $t7, $t7, -0x2120 -/* 09B400 8009A800 000E70C0 */ sll $t6, $t6, 3 -/* 09B404 8009A804 01CFC021 */ addu $t8, $t6, $t7 -/* 09B408 8009A808 AFBF001C */ sw $ra, 0x1c($sp) -/* 09B40C 8009A80C AFA5002C */ sw $a1, 0x2c($sp) -/* 09B410 8009A810 AFA60030 */ sw $a2, 0x30($sp) -/* 09B414 8009A814 AFA70034 */ sw $a3, 0x34($sp) -/* 09B418 8009A818 AFB80020 */ sw $t8, 0x20($sp) -/* 09B41C 8009A81C 8F19000C */ lw $t9, 0xc($t8) -/* 09B420 8009A820 03002025 */ move $a0, $t8 -/* 09B424 8009A824 00194000 */ sll $t0, $t9, 0 -/* 09B428 8009A828 05030010 */ bgezl $t0, .L8009A86C -/* 09B42C 8009A82C 8FBF001C */ lw $ra, 0x1c($sp) -/* 09B430 8009A830 0C026A51 */ jal func_8009A944 -/* 09B434 8009A834 00E02825 */ move $a1, $a3 -/* 09B438 8009A838 8FA90034 */ lw $t1, 0x34($sp) -/* 09B43C 8009A83C 8FAA0038 */ lw $t2, 0x38($sp) -/* 09B440 8009A840 3C048015 */ lui $a0, %hi(gDisplayListHead) # $a0, 0x8015 -/* 09B444 8009A844 8C840298 */ lw $a0, %lo(gDisplayListHead)($a0) -/* 09B448 8009A848 8FA50020 */ lw $a1, 0x20($sp) -/* 09B44C 8009A84C 8FA6002C */ lw $a2, 0x2c($sp) -/* 09B450 8009A850 8FA70030 */ lw $a3, 0x30($sp) -/* 09B454 8009A854 AFA90010 */ sw $t1, 0x10($sp) -/* 09B458 8009A858 0C0271C2 */ jal func_8009C708 -/* 09B45C 8009A85C AFAA0014 */ sw $t2, 0x14($sp) -/* 09B460 8009A860 3C018015 */ lui $at, %hi(gDisplayListHead) # $at, 0x8015 -/* 09B464 8009A864 AC220298 */ sw $v0, %lo(gDisplayListHead)($at) -/* 09B468 8009A868 8FBF001C */ lw $ra, 0x1c($sp) -.L8009A86C: -/* 09B46C 8009A86C 27BD0028 */ addiu $sp, $sp, 0x28 -/* 09B470 8009A870 03E00008 */ jr $ra -/* 09B474 8009A874 00000000 */ nop diff --git a/asm/non_matchings/code_80091750/func_800A0AD0.s b/asm/non_matchings/code_80091750/func_800A0AD0.s deleted file mode 100644 index 55f254c63..000000000 --- a/asm/non_matchings/code_80091750/func_800A0AD0.s +++ /dev/null @@ -1,46 +0,0 @@ -glabel func_800A0AD0 -/* 0A16D0 800A0AD0 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 0A16D4 800A0AD4 AFBF0014 */ sw $ra, 0x14($sp) -/* 0A16D8 800A0AD8 AFA40018 */ sw $a0, 0x18($sp) -/* 0A16DC 800A0ADC 0C02ABBD */ jal func_800AAEF4 -/* 0A16E0 800A0AE0 240400DA */ li $a0, 218 -/* 0A16E4 800A0AE4 3C038019 */ lui $v1, %hi(gPlayerCountSelection2) # $v1, 0x8019 -/* 0A16E8 800A0AE8 8063EDF0 */ lb $v1, %lo(gPlayerCountSelection2)($v1) -/* 0A16EC 800A0AEC 24010001 */ li $at, 1 -/* 0A16F0 800A0AF0 00404825 */ move $t1, $v0 -/* 0A16F4 800A0AF4 1061001E */ beq $v1, $at, .L800A0B70 -/* 0A16F8 800A0AF8 24010002 */ li $at, 2 -/* 0A16FC 800A0AFC 1061001C */ beq $v1, $at, .L800A0B70 -/* 0A1700 800A0B00 3C088015 */ lui $t0, %hi(gDisplayListHead) # $t0, 0x8015 -/* 0A1704 800A0B04 25080298 */ addiu $t0, %lo(gDisplayListHead) # addiu $t0, $t0, 0x298 -/* 0A1708 800A0B08 8D030000 */ lw $v1, ($t0) -/* 0A170C 800A0B0C 3C0FFA00 */ lui $t7, 0xfa00 -/* 0A1710 800A0B10 3C01FF00 */ lui $at, 0xff00 -/* 0A1714 800A0B14 246E0008 */ addiu $t6, $v1, 8 -/* 0A1718 800A0B18 AD0E0000 */ sw $t6, ($t0) -/* 0A171C 800A0B1C AC6F0000 */ sw $t7, ($v1) -/* 0A1720 800A0B20 8D380020 */ lw $t8, 0x20($t1) -/* 0A1724 800A0B24 3C07800F */ lui $a3, %hi(D_800E86C0) # $a3, 0x800f -/* 0A1728 800A0B28 3C050200 */ lui $a1, %hi(D_02001874) # $a1, 0x200 -/* 0A172C 800A0B2C 331900FF */ andi $t9, $t8, 0xff -/* 0A1730 800A0B30 00195400 */ sll $t2, $t9, 0x10 -/* 0A1734 800A0B34 01415825 */ or $t3, $t2, $at -/* 0A1738 800A0B38 356C00FF */ ori $t4, $t3, 0xff -/* 0A173C 800A0B3C AC6C0004 */ sw $t4, 4($v1) -/* 0A1740 800A0B40 80E786C0 */ lb $a3, %lo(D_800E86C0)($a3) -/* 0A1744 800A0B44 8D040000 */ lw $a0, ($t0) -/* 0A1748 800A0B48 24A51874 */ addiu $a1, %lo(D_02001874) # addiu $a1, $a1, 0x1874 -/* 0A174C 800A0B4C 00076880 */ sll $t5, $a3, 2 -/* 0A1750 800A0B50 01A76821 */ addu $t5, $t5, $a3 -/* 0A1754 800A0B54 000D6840 */ sll $t5, $t5, 1 -/* 0A1758 800A0B58 25A7007C */ addiu $a3, $t5, 0x7c -/* 0A175C 800A0B5C 0C026E9D */ jal func_8009BA74 -/* 0A1760 800A0B60 24060024 */ li $a2, 36 -/* 0A1764 800A0B64 3C088015 */ lui $t0, %hi(gDisplayListHead) # $t0, 0x8015 -/* 0A1768 800A0B68 25080298 */ addiu $t0, %lo(gDisplayListHead) # addiu $t0, $t0, 0x298 -/* 0A176C 800A0B6C AD020000 */ sw $v0, ($t0) -.L800A0B70: -/* 0A1770 800A0B70 8FBF0014 */ lw $ra, 0x14($sp) -/* 0A1774 800A0B74 27BD0018 */ addiu $sp, $sp, 0x18 -/* 0A1778 800A0B78 03E00008 */ jr $ra -/* 0A177C 800A0B7C 00000000 */ nop diff --git a/asm/non_matchings/code_80091750/func_800A0DFC.s b/asm/non_matchings/code_80091750/func_800A0DFC.s index a78e6eeab..3e3a0987d 100644 --- a/asm/non_matchings/code_80091750/func_800A0DFC.s +++ b/asm/non_matchings/code_80091750/func_800A0DFC.s @@ -5,11 +5,11 @@ glabel func_800A0DFC /* 0A1A08 800A0E08 AFB00018 */ sw $s0, 0x18($sp) /* 0A1A0C 800A0E0C AFB20020 */ sw $s2, 0x20($sp) /* 0A1A10 800A0E10 AFB1001C */ sw $s1, 0x1c($sp) -/* 0A1A14 800A0E14 3C108019 */ lui $s0, %hi(D_8018EB80) # $s0, 0x8019 +/* 0A1A14 800A0E14 3C108019 */ lui $s0, %hi(gControllerPakNumPagesFree) # $s0, 0x8019 /* 0A1A18 800A0E18 3C138015 */ lui $s3, %hi(gDisplayListHead) # $s3, 0x8015 /* 0A1A1C 800A0E1C 3C14800E */ lui $s4, %hi(D_800E7D0C) # $s4, 0x800e /* 0A1A20 800A0E20 AFBF002C */ sw $ra, 0x2c($sp) -/* 0A1A24 800A0E24 8E10EB80 */ lw $s0, %lo(D_8018EB80)($s0) +/* 0A1A24 800A0E24 8E10EB80 */ lw $s0, %lo(gControllerPakNumPagesFree)($s0) /* 0A1A28 800A0E28 24110110 */ li $s1, 272 /* 0A1A2C 800A0E2C 26947D0C */ addiu $s4, %lo(D_800E7D0C) # addiu $s4, $s4, 0x7d0c /* 0A1A30 800A0E30 26730298 */ addiu $s3, %lo(gDisplayListHead) # addiu $s3, $s3, 0x298 diff --git a/asm/non_matchings/code_80091750/func_800A0EB8.s b/asm/non_matchings/code_80091750/func_800A0EB8.s index 52cc46421..b702e32b8 100644 --- a/asm/non_matchings/code_80091750/func_800A0EB8.s +++ b/asm/non_matchings/code_80091750/func_800A0EB8.s @@ -7,10 +7,10 @@ glabel func_800A0EB8 /* 0A1ACC 800A0ECC 240400DA */ li $a0, 218 /* 0A1AD0 800A0ED0 8FA4001C */ lw $a0, 0x1c($sp) /* 0A1AD4 800A0ED4 00405825 */ move $t3, $v0 -/* 0A1AD8 800A0ED8 3C0E8019 */ lui $t6, %hi(gPlayerCountSelection2) # $t6, 0x8019 +/* 0A1AD8 800A0ED8 3C0E8019 */ lui $t6, %hi(gMenuState) # $t6, 0x8019 /* 0A1ADC 800A0EDC 14800009 */ bnez $a0, .L800A0F04 -/* 0A1AE0 800A0EE0 3C028019 */ lui $v0, %hi(gPlayerCountSelection2) # $v0, 0x8019 -/* 0A1AE4 800A0EE4 81CEEDF0 */ lb $t6, %lo(gPlayerCountSelection2)($t6) +/* 0A1AE0 800A0EE0 3C028019 */ lui $v0, %hi(gMenuState) # $v0, 0x8019 +/* 0A1AE4 800A0EE4 81CEEDF0 */ lb $t6, %lo(gMenuState)($t6) /* 0A1AE8 800A0EE8 24010002 */ li $at, 2 /* 0A1AEC 800A0EEC 15C10003 */ bne $t6, $at, .L800A0EFC /* 0A1AF0 800A0EF0 00000000 */ nop @@ -20,7 +20,7 @@ glabel func_800A0EB8 /* 0A1AFC 800A0EFC 1000000A */ b .L800A0F28 /* 0A1B00 800A0F00 00004825 */ move $t1, $zero .L800A0F04: -/* 0A1B04 800A0F04 8042EDF0 */ lb $v0, %lo(gPlayerCountSelection2)($v0) +/* 0A1B04 800A0F04 8042EDF0 */ lb $v0, %lo(gMenuState)($v0) /* 0A1B08 800A0F08 24010003 */ li $at, 3 /* 0A1B0C 800A0F0C 00047840 */ sll $t7, $a0, 1 /* 0A1B10 800A0F10 10410003 */ beq $v0, $at, .L800A0F20 diff --git a/asm/non_matchings/code_80091750/func_800A954C.s b/asm/non_matchings/code_80091750/func_800A954C.s deleted file mode 100644 index 7334155f8..000000000 --- a/asm/non_matchings/code_80091750/func_800A954C.s +++ /dev/null @@ -1,123 +0,0 @@ -glabel func_800A954C -/* 0AA14C 800A954C 8C8E0004 */ lw $t6, 4($a0) -/* 0AA150 800A9550 55C00033 */ bnel $t6, $zero, .L800A9620 -/* 0AA154 800A9554 8C82001C */ lw $v0, 0x1c($a0) -/* 0AA158 800A9558 8C82001C */ lw $v0, 0x1c($a0) -/* 0AA15C 800A955C 240F000C */ li $t7, 12 -/* 0AA160 800A9560 3C0142FE */ li $at, 0x42FE0000 # 127.000000 -/* 0AA164 800A9564 01E2C023 */ subu $t8, $t7, $v0 -/* 0AA168 800A9568 44982000 */ mtc1 $t8, $f4 -/* 0AA16C 800A956C 44814000 */ mtc1 $at, $f8 -/* 0AA170 800A9570 3C014140 */ li $at, 0x41400000 # 12.000000 -/* 0AA174 800A9574 468021A0 */ cvt.s.w $f6, $f4 -/* 0AA178 800A9578 44818000 */ mtc1 $at, $f16 -/* 0AA17C 800A957C 3C014300 */ li $at, 0x43000000 # 128.000000 -/* 0AA180 800A9580 44812000 */ mtc1 $at, $f4 -/* 0AA184 800A9584 24080001 */ li $t0, 1 -/* 0AA188 800A9588 3C014F00 */ li $at, 0x4F000000 # 2147483648.000000 -/* 0AA18C 800A958C 46083282 */ mul.s $f10, $f6, $f8 -/* 0AA190 800A9590 46105483 */ div.s $f18, $f10, $f16 -/* 0AA194 800A9594 46049180 */ add.s $f6, $f18, $f4 -/* 0AA198 800A9598 4459F800 */ cfc1 $t9, $31 -/* 0AA19C 800A959C 44C8F800 */ ctc1 $t0, $31 -/* 0AA1A0 800A95A0 00000000 */ nop -/* 0AA1A4 800A95A4 46003224 */ cvt.w.s $f8, $f6 -/* 0AA1A8 800A95A8 4448F800 */ cfc1 $t0, $31 -/* 0AA1AC 800A95AC 00000000 */ nop -/* 0AA1B0 800A95B0 31080078 */ andi $t0, $t0, 0x78 -/* 0AA1B4 800A95B4 51000013 */ beql $t0, $zero, .L800A9604 -/* 0AA1B8 800A95B8 44084000 */ mfc1 $t0, $f8 -/* 0AA1BC 800A95BC 44814000 */ mtc1 $at, $f8 -/* 0AA1C0 800A95C0 24080001 */ li $t0, 1 -/* 0AA1C4 800A95C4 46083201 */ sub.s $f8, $f6, $f8 -/* 0AA1C8 800A95C8 44C8F800 */ ctc1 $t0, $31 -/* 0AA1CC 800A95CC 00000000 */ nop -/* 0AA1D0 800A95D0 46004224 */ cvt.w.s $f8, $f8 -/* 0AA1D4 800A95D4 4448F800 */ cfc1 $t0, $31 -/* 0AA1D8 800A95D8 00000000 */ nop -/* 0AA1DC 800A95DC 31080078 */ andi $t0, $t0, 0x78 -/* 0AA1E0 800A95E0 15000005 */ bnez $t0, .L800A95F8 -/* 0AA1E4 800A95E4 00000000 */ nop -/* 0AA1E8 800A95E8 44084000 */ mfc1 $t0, $f8 -/* 0AA1EC 800A95EC 3C018000 */ lui $at, 0x8000 -/* 0AA1F0 800A95F0 10000007 */ b .L800A9610 -/* 0AA1F4 800A95F4 01014025 */ or $t0, $t0, $at -.L800A95F8: -/* 0AA1F8 800A95F8 10000005 */ b .L800A9610 -/* 0AA1FC 800A95FC 2408FFFF */ li $t0, -1 -/* 0AA200 800A9600 44084000 */ mfc1 $t0, $f8 -.L800A9604: -/* 0AA204 800A9604 00000000 */ nop -/* 0AA208 800A9608 0500FFFB */ bltz $t0, .L800A95F8 -/* 0AA20C 800A960C 00000000 */ nop -.L800A9610: -/* 0AA210 800A9610 44D9F800 */ ctc1 $t9, $31 -/* 0AA214 800A9614 10000034 */ b .L800A96E8 -/* 0AA218 800A9618 AC880020 */ sw $t0, 0x20($a0) -/* 0AA21C 800A961C 8C82001C */ lw $v0, 0x1c($a0) -.L800A9620: -/* 0AA220 800A9620 3C01800F */ lui $at, %hi(D_800F24C0) -/* 0AA224 800A9624 D42424C0 */ ldc1 $f4, %lo(D_800F24C0)($at) -/* 0AA228 800A9628 44825000 */ mtc1 $v0, $f10 -/* 0AA22C 800A962C 3C014028 */ li $at, 0x40280000 # 2.625000 -/* 0AA230 800A9630 44814800 */ mtc1 $at, $f9 -/* 0AA234 800A9634 46805420 */ cvt.s.w $f16, $f10 -/* 0AA238 800A9638 44804000 */ mtc1 $zero, $f8 -/* 0AA23C 800A963C 3C014060 */ li $at, 0x40600000 # 3.500000 -/* 0AA240 800A9640 44818800 */ mtc1 $at, $f17 -/* 0AA244 800A9644 240A0001 */ li $t2, 1 -/* 0AA248 800A9648 3C0141E0 */ li $at, 0x41E00000 # 28.000000 -/* 0AA24C 800A964C 460084A1 */ cvt.d.s $f18, $f16 -/* 0AA250 800A9650 44808000 */ mtc1 $zero, $f16 -/* 0AA254 800A9654 46249182 */ mul.d $f6, $f18, $f4 -/* 0AA258 800A9658 46283283 */ div.d $f10, $f6, $f8 -/* 0AA25C 800A965C 46305480 */ add.d $f18, $f10, $f16 -/* 0AA260 800A9660 4449F800 */ cfc1 $t1, $31 -/* 0AA264 800A9664 44CAF800 */ ctc1 $t2, $31 -/* 0AA268 800A9668 00000000 */ nop -/* 0AA26C 800A966C 46209124 */ cvt.w.d $f4, $f18 -/* 0AA270 800A9670 444AF800 */ cfc1 $t2, $31 -/* 0AA274 800A9674 00000000 */ nop -/* 0AA278 800A9678 314A0078 */ andi $t2, $t2, 0x78 -/* 0AA27C 800A967C 51400014 */ beql $t2, $zero, .L800A96D0 -/* 0AA280 800A9680 440A2000 */ mfc1 $t2, $f4 -/* 0AA284 800A9684 44812800 */ mtc1 $at, $f5 -/* 0AA288 800A9688 44802000 */ mtc1 $zero, $f4 -/* 0AA28C 800A968C 240A0001 */ li $t2, 1 -/* 0AA290 800A9690 46249101 */ sub.d $f4, $f18, $f4 -/* 0AA294 800A9694 44CAF800 */ ctc1 $t2, $31 -/* 0AA298 800A9698 00000000 */ nop -/* 0AA29C 800A969C 46202124 */ cvt.w.d $f4, $f4 -/* 0AA2A0 800A96A0 444AF800 */ cfc1 $t2, $31 -/* 0AA2A4 800A96A4 00000000 */ nop -/* 0AA2A8 800A96A8 314A0078 */ andi $t2, $t2, 0x78 -/* 0AA2AC 800A96AC 15400005 */ bnez $t2, .L800A96C4 -/* 0AA2B0 800A96B0 00000000 */ nop -/* 0AA2B4 800A96B4 440A2000 */ mfc1 $t2, $f4 -/* 0AA2B8 800A96B8 3C018000 */ lui $at, 0x8000 -/* 0AA2BC 800A96BC 10000007 */ b .L800A96DC -/* 0AA2C0 800A96C0 01415025 */ or $t2, $t2, $at -.L800A96C4: -/* 0AA2C4 800A96C4 10000005 */ b .L800A96DC -/* 0AA2C8 800A96C8 240AFFFF */ li $t2, -1 -/* 0AA2CC 800A96CC 440A2000 */ mfc1 $t2, $f4 -.L800A96D0: -/* 0AA2D0 800A96D0 00000000 */ nop -/* 0AA2D4 800A96D4 0540FFFB */ bltz $t2, .L800A96C4 -/* 0AA2D8 800A96D8 00000000 */ nop -.L800A96DC: -/* 0AA2DC 800A96DC 44C9F800 */ ctc1 $t1, $31 -/* 0AA2E0 800A96E0 AC8A0020 */ sw $t2, 0x20($a0) -/* 0AA2E4 800A96E4 00000000 */ nop -.L800A96E8: -/* 0AA2E8 800A96E8 244B0001 */ addiu $t3, $v0, 1 -/* 0AA2EC 800A96EC 2961000C */ slti $at, $t3, 0xc -/* 0AA2F0 800A96F0 14200005 */ bnez $at, .L800A9708 -/* 0AA2F4 800A96F4 AC8B001C */ sw $t3, 0x1c($a0) -/* 0AA2F8 800A96F8 8C8D0004 */ lw $t5, 4($a0) -/* 0AA2FC 800A96FC AC80001C */ sw $zero, 0x1c($a0) -/* 0AA300 800A9700 39AE0001 */ xori $t6, $t5, 1 -/* 0AA304 800A9704 AC8E0004 */ sw $t6, 4($a0) -.L800A9708: -/* 0AA308 800A9708 03E00008 */ jr $ra -/* 0AA30C 800A970C 00000000 */ nop diff --git a/asm/non_matchings/code_80091750/func_800A9710.s b/asm/non_matchings/code_80091750/func_800A9710.s index 832964fc1..8c3179b20 100644 --- a/asm/non_matchings/code_80091750/func_800A9710.s +++ b/asm/non_matchings/code_80091750/func_800A9710.s @@ -1,6 +1,6 @@ glabel func_800A9710 -/* 0AA310 800A9710 3C0E8019 */ lui $t6, %hi(gPlayerCountSelection2) # $t6, 0x8019 -/* 0AA314 800A9714 81CEEDF0 */ lb $t6, %lo(gPlayerCountSelection2)($t6) +/* 0AA310 800A9710 3C0E8019 */ lui $t6, %hi(gMenuState) # $t6, 0x8019 +/* 0AA314 800A9714 81CEEDF0 */ lb $t6, %lo(gMenuState)($t6) /* 0AA318 800A9718 27BDFFE8 */ addiu $sp, $sp, -0x18 /* 0AA31C 800A971C AFBF0014 */ sw $ra, 0x14($sp) /* 0AA320 800A9720 25CFFFFD */ addiu $t7, $t6, -3 diff --git a/asm/non_matchings/code_80091750/func_800AA2EC.s b/asm/non_matchings/code_80091750/func_800AA2EC.s index cec22668c..b0e8ddfff 100644 --- a/asm/non_matchings/code_80091750/func_800AA2EC.s +++ b/asm/non_matchings/code_80091750/func_800AA2EC.s @@ -154,12 +154,12 @@ glabel L800AA334 /* 0AB120 800AA520 AD190004 */ sw $t9, 4($t0) .L800AA524: /* 0AB124 800AA524 3C048019 */ lui $a0, %hi(D_8018E868) # $a0, 0x8019 -/* 0AB128 800AA528 3C058019 */ lui $a1, %hi(D_8018EB80) # $a1, 0x8019 -/* 0AB12C 800AA52C 24A5EB80 */ addiu $a1, %lo(D_8018EB80) # addiu $a1, $a1, -0x1480 +/* 0AB128 800AA528 3C058019 */ lui $a1, %hi(gControllerPakNumPagesFree) # $a1, 0x8019 +/* 0AB12C 800AA52C 24A5EB80 */ addiu $a1, %lo(gControllerPakNumPagesFree) # addiu $a1, $a1, -0x1480 /* 0AB130 800AA530 0C033B48 */ jal osPfsFreeBlocks /* 0AB134 800AA534 2484E868 */ addiu $a0, %lo(D_8018E868) # addiu $a0, $a0, -0x1798 -/* 0AB138 800AA538 3C038019 */ lui $v1, %hi(D_8018EB80) # $v1, 0x8019 -/* 0AB13C 800AA53C 2463EB80 */ addiu $v1, %lo(D_8018EB80) # addiu $v1, $v1, -0x1480 +/* 0AB138 800AA538 3C038019 */ lui $v1, %hi(gControllerPakNumPagesFree) # $v1, 0x8019 +/* 0AB13C 800AA53C 2463EB80 */ addiu $v1, %lo(gControllerPakNumPagesFree) # addiu $v1, $v1, -0x1480 /* 0AB140 800AA540 10400004 */ beqz $v0, .L800AA554 /* 0AB144 800AA544 8FA80028 */ lw $t0, 0x28($sp) /* 0AB148 800AA548 240A0003 */ li $t2, 3 @@ -174,8 +174,8 @@ glabel L800AA334 /* 0AB164 800AA564 3C0E8019 */ lui $t6, %hi(D_8018EB78) # $t6, 0x8019 /* 0AB168 800AA568 8DCEEB78 */ lw $t6, %lo(D_8018EB78)($t6) /* 0AB16C 800AA56C 8DADEB7C */ lw $t5, %lo(D_8018EB7C)($t5) -/* 0AB170 800AA570 3C038019 */ lui $v1, %hi(D_8018EB80) # $v1, 0x8019 -/* 0AB174 800AA574 2463EB80 */ addiu $v1, %lo(D_8018EB80) # addiu $v1, $v1, -0x1480 +/* 0AB170 800AA570 3C038019 */ lui $v1, %hi(gControllerPakNumPagesFree) # $v1, 0x8019 +/* 0AB174 800AA574 2463EB80 */ addiu $v1, %lo(gControllerPakNumPagesFree) # addiu $v1, $v1, -0x1480 /* 0AB178 800AA578 01AE082A */ slt $at, $t5, $t6 /* 0AB17C 800AA57C 14200004 */ bnez $at, .L800AA590 /* 0AB180 800AA580 8FB80028 */ lw $t8, 0x28($sp) diff --git a/asm/non_matchings/code_80091750/func_800AD2E8.s b/asm/non_matchings/code_80091750/func_800AD2E8.s index 98443d9c1..cc5af1666 100644 --- a/asm/non_matchings/code_80091750/func_800AD2E8.s +++ b/asm/non_matchings/code_80091750/func_800AD2E8.s @@ -362,14 +362,14 @@ glabel L800AD764 /* 0AE414 800AD814 3C044900 */ lui $a0, (0x4900FF07 >> 16) # lui $a0, 0x4900 /* 0AE418 800AD818 0319082A */ slt $at, $t8, $t9 /* 0AE41C 800AD81C 14200006 */ bnez $at, .L800AD838 -/* 0AE420 800AD820 3C098019 */ lui $t1, %hi(D_8018EB80) # $t1, 0x8019 +/* 0AE420 800AD820 3C098019 */ lui $t1, %hi(gControllerPakNumPagesFree) # $t1, 0x8019 /* 0AE424 800AD824 AE080004 */ sw $t0, 4($s0) /* 0AE428 800AD828 0C032384 */ jal play_sound2 /* 0AE42C 800AD82C 3484FF07 */ ori $a0, (0x4900FF07 & 0xFFFF) # ori $a0, $a0, 0xff07 /* 0AE430 800AD830 100001C1 */ b .L800ADF38 /* 0AE434 800AD834 8FBF0024 */ lw $ra, 0x24($sp) .L800AD838: -/* 0AE438 800AD838 8D29EB80 */ lw $t1, %lo(D_8018EB80)($t1) +/* 0AE438 800AD838 8D29EB80 */ lw $t1, %lo(gControllerPakNumPagesFree)($t1) /* 0AE43C 800AD83C 3C044900 */ lui $a0, (0x4900FF07 >> 16) # lui $a0, 0x4900 /* 0AE440 800AD840 240B000E */ li $t3, 14 /* 0AE444 800AD844 29210079 */ slti $at, $t1, 0x79 diff --git a/asm/non_matchings/code_80091750/func_800AE218.s b/asm/non_matchings/code_80091750/func_800AE218.s index 069830981..21a1132d3 100644 --- a/asm/non_matchings/code_80091750/func_800AE218.s +++ b/asm/non_matchings/code_80091750/func_800AE218.s @@ -298,14 +298,14 @@ glabel L800AE59C /* 0AF24C 800AE64C 3C044900 */ lui $a0, (0x4900FF07 >> 16) # lui $a0, 0x4900 /* 0AF250 800AE650 0109082A */ slt $at, $t0, $t1 /* 0AF254 800AE654 14200006 */ bnez $at, .L800AE670 -/* 0AF258 800AE658 3C0B8019 */ lui $t3, %hi(D_8018EB80) # $t3, 0x8019 +/* 0AF258 800AE658 3C0B8019 */ lui $t3, %hi(gControllerPakNumPagesFree) # $t3, 0x8019 /* 0AF25C 800AE65C AE0A0004 */ sw $t2, 4($s0) /* 0AF260 800AE660 0C032384 */ jal play_sound2 /* 0AF264 800AE664 3484FF07 */ ori $a0, (0x4900FF07 & 0xFFFF) # ori $a0, $a0, 0xff07 /* 0AF268 800AE668 10000176 */ b .L800AEC44 /* 0AF26C 800AE66C 8FBF0024 */ lw $ra, 0x24($sp) .L800AE670: -/* 0AF270 800AE670 8D6BEB80 */ lw $t3, %lo(D_8018EB80)($t3) +/* 0AF270 800AE670 8D6BEB80 */ lw $t3, %lo(gControllerPakNumPagesFree)($t3) /* 0AF274 800AE674 3C044900 */ lui $a0, (0x4900FF07 >> 16) # lui $a0, 0x4900 /* 0AF278 800AE678 240D0018 */ li $t5, 24 /* 0AF27C 800AE67C 29610079 */ slti $at, $t3, 0x79 diff --git a/asm/non_matchings/code_80091750/segmented_to_virtual.s b/asm/non_matchings/code_80091750/segmented_to_virtual.s deleted file mode 100644 index 665d384e3..000000000 --- a/asm/non_matchings/code_80091750/segmented_to_virtual.s +++ /dev/null @@ -1,13 +0,0 @@ -glabel segmented_to_virtual -/* 099D24 80099124 00047602 */ srl $t6, $a0, 0x18 -/* 099D28 80099128 000E7880 */ sll $t7, $t6, 2 -/* 099D2C 8009912C 3C188015 */ lui $t8, %hi(gSegmentTable) -/* 099D30 80099130 030FC021 */ addu $t8, $t8, $t7 -/* 099D34 80099134 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff -/* 099D38 80099138 8F180258 */ lw $t8, %lo(gSegmentTable)($t8) -/* 099D3C 8009913C 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff -/* 099D40 80099140 0081C824 */ and $t9, $a0, $at -/* 099D44 80099144 3C018000 */ lui $at, 0x8000 -/* 099D48 80099148 03191021 */ addu $v0, $t8, $t9 -/* 099D4C 8009914C 03E00008 */ jr $ra -/* 099D50 80099150 00411021 */ addu $v0, $v0, $at diff --git a/asm/non_matchings/code_80091750/segmented_to_virtual_dupe.s b/asm/non_matchings/code_80091750/segmented_to_virtual_dupe.s deleted file mode 100644 index f203be0c5..000000000 --- a/asm/non_matchings/code_80091750/segmented_to_virtual_dupe.s +++ /dev/null @@ -1,13 +0,0 @@ -glabel segmented_to_virtual_dupe -/* 099D54 80099154 00047602 */ srl $t6, $a0, 0x18 -/* 099D58 80099158 000E7880 */ sll $t7, $t6, 2 -/* 099D5C 8009915C 3C188015 */ lui $t8, %hi(gSegmentTable) -/* 099D60 80099160 030FC021 */ addu $t8, $t8, $t7 -/* 099D64 80099164 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff -/* 099D68 80099168 8F180258 */ lw $t8, %lo(gSegmentTable)($t8) -/* 099D6C 8009916C 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff -/* 099D70 80099170 0081C824 */ and $t9, $a0, $at -/* 099D74 80099174 3C018000 */ lui $at, 0x8000 -/* 099D78 80099178 03191021 */ addu $v0, $t8, $t9 -/* 099D7C 8009917C 03E00008 */ jr $ra -/* 099D80 80099180 00411021 */ addu $v0, $v0, $at diff --git a/asm/non_matchings/code_800AF9B0/func_800B1C90.s b/asm/non_matchings/code_800AF9B0/func_800B1C90.s index 94e338f59..ae3da3152 100644 --- a/asm/non_matchings/code_800AF9B0/func_800B1C90.s +++ b/asm/non_matchings/code_800AF9B0/func_800B1C90.s @@ -9,8 +9,8 @@ glabel func_800B1C90 /* 0B28AC 800B1CAC A7B80036 */ sh $t8, 0x36($sp) /* 0B28B0 800B1CB0 1440010C */ bnez $v0, .L800B20E4 /* 0B28B4 800B1CB4 97A30036 */ lhu $v1, 0x36($sp) -/* 0B28B8 800B1CB8 3C098019 */ lui $t1, %hi(gPlayerCountSelection2) # $t1, 0x8019 -/* 0B28BC 800B1CBC 2529EDF0 */ addiu $t1, %lo(gPlayerCountSelection2) # addiu $t1, $t1, -0x1210 +/* 0B28B8 800B1CB8 3C098019 */ lui $t1, %hi(gMenuState) # $t1, 0x8019 +/* 0B28BC 800B1CBC 2529EDF0 */ addiu $t1, %lo(gMenuState) # addiu $t1, $t1, -0x1210 /* 0B28C0 800B1CC0 81390000 */ lb $t9, ($t1) /* 0B28C4 800B1CC4 272AFFFF */ addiu $t2, $t9, -1 /* 0B28C8 800B1CC8 2D41000A */ sltiu $at, $t2, 0xa @@ -68,8 +68,8 @@ glabel L800B1D84 /* 0B2984 800B1D84 306A9000 */ andi $t2, $v1, 0x9000 /* 0B2988 800B1D88 11400015 */ beqz $t2, .L800B1DE0 /* 0B298C 800B1D8C 00601025 */ move $v0, $v1 -/* 0B2990 800B1D90 3C02800F */ lui $v0, %hi(D_800E86C0) # $v0, 0x800f -/* 0B2994 800B1D94 244286C0 */ addiu $v0, %lo(D_800E86C0) # addiu $v0, $v0, -0x7940 +/* 0B2990 800B1D90 3C02800F */ lui $v0, %hi(gControllerPakSelectedTableRow) # $v0, 0x800f +/* 0B2994 800B1D94 244286C0 */ addiu $v0, %lo(gControllerPakSelectedTableRow) # addiu $v0, $v0, -0x7940 /* 0B2998 800B1D98 804B0000 */ lb $t3, ($v0) /* 0B299C 800B1D9C 3C08800F */ lui $t0, %hi(D_800E86C6) # 0x800f /* 0B29A0 800B1DA0 3C0D8019 */ lui $t5, %hi(D_8018EB38) # 0x8019 @@ -108,8 +108,8 @@ glabel L800B1D84 /* 0B2A1C 800B1E1C 3C03800F */ lui $v1, %hi(D_800E86D0) # $v1, 0x800f /* 0B2A20 800B1E20 246386D0 */ addiu $v1, %lo(D_800E86D0) # addiu $v1, $v1, -0x7930 /* 0B2A24 800B1E24 806B0000 */ lb $t3, ($v1) -/* 0B2A28 800B1E28 3C02800F */ lui $v0, %hi(D_800E86C0) # $v0, 0x800f -/* 0B2A2C 800B1E2C 244286C0 */ addiu $v0, %lo(D_800E86C0) # addiu $v0, $v0, -0x7940 +/* 0B2A28 800B1E28 3C02800F */ lui $v0, %hi(gControllerPakSelectedTableRow) # $v0, 0x800f +/* 0B2A2C 800B1E2C 244286C0 */ addiu $v0, %lo(gControllerPakSelectedTableRow) # addiu $v0, $v0, -0x7940 /* 0B2A30 800B1E30 556000AD */ bnel $t3, $zero, .L800B20E8 /* 0B2A34 800B1E34 8FBF001C */ lw $ra, 0x1c($sp) /* 0B2A38 800B1E38 804C0000 */ lb $t4, ($v0) @@ -144,8 +144,8 @@ glabel L800B1D84 /* 0B2AA4 800B1EA4 3C03800F */ lui $v1, %hi(D_800E86D0) # $v1, 0x800f /* 0B2AA8 800B1EA8 246386D0 */ addiu $v1, %lo(D_800E86D0) # addiu $v1, $v1, -0x7930 /* 0B2AAC 800B1EAC 806B0000 */ lb $t3, ($v1) -/* 0B2AB0 800B1EB0 3C02800F */ lui $v0, %hi(D_800E86C0) # $v0, 0x800f -/* 0B2AB4 800B1EB4 244286C0 */ addiu $v0, %lo(D_800E86C0) # addiu $v0, $v0, -0x7940 +/* 0B2AB0 800B1EB0 3C02800F */ lui $v0, %hi(gControllerPakSelectedTableRow) # $v0, 0x800f +/* 0B2AB4 800B1EB4 244286C0 */ addiu $v0, %lo(gControllerPakSelectedTableRow) # addiu $v0, $v0, -0x7940 /* 0B2AB8 800B1EB8 5560008B */ bnel $t3, $zero, .L800B20E8 /* 0B2ABC 800B1EBC 8FBF001C */ lw $ra, 0x1c($sp) /* 0B2AC0 800B1EC0 804C0000 */ lb $t4, ($v0) @@ -233,8 +233,8 @@ glabel L800B1FE8 /* 0B2BEC 800B1FEC 1000003D */ b .L800B20E4 /* 0B2BF0 800B1FF0 A12D0000 */ sb $t5, ($t1) glabel L800B1FF4 -/* 0B2BF4 800B1FF4 3C02800F */ lui $v0, %hi(D_800E86C0) # $v0, 0x800f -/* 0B2BF8 800B1FF8 244286C0 */ addiu $v0, %lo(D_800E86C0) # addiu $v0, $v0, -0x7940 +/* 0B2BF4 800B1FF4 3C02800F */ lui $v0, %hi(gControllerPakSelectedTableRow) # $v0, 0x800f +/* 0B2BF8 800B1FF8 244286C0 */ addiu $v0, %lo(gControllerPakSelectedTableRow) # addiu $v0, $v0, -0x7940 /* 0B2BFC 800B1FFC 804E0000 */ lb $t6, ($v0) /* 0B2C00 800B2000 3C08800F */ lui $t0, %hi(D_800E86C6) # 0x800f /* 0B2C04 800B2004 3C188019 */ lui $t8, %hi(D_8018E938) # $t8, 0x8019 @@ -254,8 +254,8 @@ glabel L800B1FF4 /* 0B2C3C 800B203C AFA8002C */ sw $t0, 0x2c($sp) /* 0B2C40 800B2040 0C033E90 */ jal osPfsDeleteFile /* 0B2C44 800B2044 2484E868 */ addiu $a0, %lo(D_8018E868) # addiu $a0, $a0, -0x1798 -/* 0B2C48 800B2048 3C098019 */ lui $t1, %hi(gPlayerCountSelection2) # $t1, 0x8019 -/* 0B2C4C 800B204C 2529EDF0 */ addiu $t1, %lo(gPlayerCountSelection2) # addiu $t1, $t1, -0x1210 +/* 0B2C48 800B2048 3C098019 */ lui $t1, %hi(gMenuState) # $t1, 0x8019 +/* 0B2C4C 800B204C 2529EDF0 */ addiu $t1, %lo(gMenuState) # addiu $t1, $t1, -0x1210 /* 0B2C50 800B2050 8FA30020 */ lw $v1, 0x20($sp) /* 0B2C54 800B2054 1040000A */ beqz $v0, .L800B2080 /* 0B2C58 800B2058 8FA8002C */ lw $t0, 0x2c($sp) @@ -275,14 +275,14 @@ glabel L800B1FF4 /* 0B2C8C 800B208C 240BFFFF */ li $t3, -1 /* 0B2C90 800B2090 AC2BEB38 */ sw $t3, %lo(D_8018EB38)($at) # -0x14c8($at) /* 0B2C94 800B2094 8C6E0000 */ lw $t6, ($v1) -/* 0B2C98 800B2098 3C0D8019 */ lui $t5, %hi(D_8018EB80) # $t5, 0x8019 -/* 0B2C9C 800B209C 8DADEB80 */ lw $t5, %lo(D_8018EB80)($t5) +/* 0B2C98 800B2098 3C0D8019 */ lui $t5, %hi(gControllerPakNumPagesFree) # $t5, 0x8019 +/* 0B2C9C 800B209C 8DADEB80 */ lw $t5, %lo(gControllerPakNumPagesFree)($t5) /* 0B2CA0 800B20A0 25CF00FF */ addiu $t7, $t6, 0xff /* 0B2CA4 800B20A4 000FC202 */ srl $t8, $t7, 8 /* 0B2CA8 800B20A8 331900FF */ andi $t9, $t8, 0xff -/* 0B2CAC 800B20AC 3C018019 */ lui $at, %hi(D_8018EB80) # $at, 0x8019 +/* 0B2CAC 800B20AC 3C018019 */ lui $at, %hi(gControllerPakNumPagesFree) # $at, 0x8019 /* 0B2CB0 800B20B0 01B95021 */ addu $t2, $t5, $t9 -/* 0B2CB4 800B20B4 AC2AEB80 */ sw $t2, %lo(D_8018EB80)($at) +/* 0B2CB4 800B20B4 AC2AEB80 */ sw $t2, %lo(gControllerPakNumPagesFree)($at) /* 0B2CB8 800B20B8 240B0005 */ li $t3, 5 /* 0B2CBC 800B20BC 10000009 */ b .L800B20E4 /* 0B2CC0 800B20C0 A12B0000 */ sb $t3, ($t1) diff --git a/asm/non_matchings/code_800AF9B0/func_800B3F74.s b/asm/non_matchings/code_800AF9B0/func_800B3F74.s index e5d0a220d..0f16e0aa9 100644 --- a/asm/non_matchings/code_800AF9B0/func_800B3F74.s +++ b/asm/non_matchings/code_800AF9B0/func_800B3F74.s @@ -60,8 +60,8 @@ glabel L800B4040 /* 0B4C4C 800B404C 10000111 */ b .L800B4494 /* 0B4C50 800B4050 00000000 */ nop glabel L800B4054 -/* 0B4C54 800B4054 3C018019 */ lui $at, %hi(gPlayerCountSelection2) # $at, 0x8019 -/* 0B4C58 800B4058 A023EDF0 */ sb $v1, %lo(gPlayerCountSelection2)($at) +/* 0B4C54 800B4054 3C018019 */ lui $at, %hi(gMenuState) # $at, 0x8019 +/* 0B4C58 800B4058 A023EDF0 */ sb $v1, %lo(gMenuState)($at) /* 0B4C5C 800B405C 00002025 */ move $a0, $zero /* 0B4C60 800B4060 0C032802 */ jal func_800CA008 /* 0B4C64 800B4064 00002825 */ move $a1, $zero diff --git a/asm/non_matchings/code_800AF9B0/func_800B5B94.s b/asm/non_matchings/code_800AF9B0/func_800B5B94.s index 15fded8cb..118ce9457 100644 --- a/asm/non_matchings/code_800AF9B0/func_800B5B94.s +++ b/asm/non_matchings/code_800AF9B0/func_800B5B94.s @@ -108,13 +108,13 @@ glabel func_800B5B94 /* 0B6914 800B5D14 1000001F */ b .L800B5D94 /* 0B6918 800B5D18 24020002 */ li $v0, 2 .L800B5D1C: -/* 0B691C 800B5D1C 3C058019 */ lui $a1, %hi(D_8018EB80) # $a1, 0x8019 -/* 0B6920 800B5D20 24A5EB80 */ addiu $a1, %lo(D_8018EB80) # addiu $a1, $a1, -0x1480 +/* 0B691C 800B5D1C 3C058019 */ lui $a1, %hi(gControllerPakNumPagesFree) # $a1, 0x8019 +/* 0B6920 800B5D20 24A5EB80 */ addiu $a1, %lo(gControllerPakNumPagesFree) # addiu $a1, $a1, -0x1480 /* 0B6924 800B5D24 0C033B48 */ jal osPfsFreeBlocks /* 0B6928 800B5D28 2484E868 */ addiu $a0, %lo(D_8018E868) # addiu $a0, $a0, -0x1798 -/* 0B692C 800B5D2C 3C038019 */ lui $v1, %hi(D_8018EB80) # $v1, 0x8019 +/* 0B692C 800B5D2C 3C038019 */ lui $v1, %hi(gControllerPakNumPagesFree) # $v1, 0x8019 /* 0B6930 800B5D30 10400003 */ beqz $v0, .L800B5D40 -/* 0B6934 800B5D34 2463EB80 */ addiu $v1, %lo(D_8018EB80) # addiu $v1, $v1, -0x1480 +/* 0B6934 800B5D34 2463EB80 */ addiu $v1, %lo(gControllerPakNumPagesFree) # addiu $v1, $v1, -0x1480 /* 0B6938 800B5D38 10000016 */ b .L800B5D94 /* 0B693C 800B5D3C 24020002 */ li $v0, 2 .L800B5D40: @@ -126,8 +126,8 @@ glabel func_800B5B94 /* 0B6950 800B5D50 3C0C8019 */ lui $t4, %hi(D_8018EB78) # $t4, 0x8019 /* 0B6954 800B5D54 8D8CEB78 */ lw $t4, %lo(D_8018EB78)($t4) /* 0B6958 800B5D58 8D6BEB7C */ lw $t3, %lo(D_8018EB7C)($t3) -/* 0B695C 800B5D5C 3C038019 */ lui $v1, %hi(D_8018EB80) # $v1, 0x8019 -/* 0B6960 800B5D60 2463EB80 */ addiu $v1, %lo(D_8018EB80) # addiu $v1, $v1, -0x1480 +/* 0B695C 800B5D5C 3C038019 */ lui $v1, %hi(gControllerPakNumPagesFree) # $v1, 0x8019 +/* 0B6960 800B5D60 2463EB80 */ addiu $v1, %lo(gControllerPakNumPagesFree) # addiu $v1, $v1, -0x1480 /* 0B6964 800B5D64 016C082A */ slt $at, $t3, $t4 /* 0B6968 800B5D68 54200004 */ bnel $at, $zero, .L800B5D7C /* 0B696C 800B5D6C 8C6D0000 */ lw $t5, ($v1) diff --git a/asm/non_matchings/code_800AF9B0/func_800B5F30.s b/asm/non_matchings/code_800AF9B0/func_800B5F30.s index 69dcd33ab..326dc100c 100644 --- a/asm/non_matchings/code_800AF9B0/func_800B5F30.s +++ b/asm/non_matchings/code_800AF9B0/func_800B5F30.s @@ -32,13 +32,13 @@ glabel func_800B5F30 /* 0B6BA4 800B5FA4 10000017 */ b .L800B6004 /* 0B6BA8 800B5FA8 2402FFFE */ li $v0, -2 .L800B5FAC: -/* 0B6BAC 800B5FAC 3C058019 */ lui $a1, %hi(D_8018EB80) # $a1, 0x8019 -/* 0B6BB0 800B5FB0 24A5EB80 */ addiu $a1, %lo(D_8018EB80) # addiu $a1, $a1, -0x1480 +/* 0B6BAC 800B5FAC 3C058019 */ lui $a1, %hi(gControllerPakNumPagesFree) # $a1, 0x8019 +/* 0B6BB0 800B5FB0 24A5EB80 */ addiu $a1, %lo(gControllerPakNumPagesFree) # addiu $a1, $a1, -0x1480 /* 0B6BB4 800B5FB4 0C033B48 */ jal osPfsFreeBlocks /* 0B6BB8 800B5FB8 2484E868 */ addiu $a0, %lo(D_8018E868) # addiu $a0, $a0, -0x1798 -/* 0B6BBC 800B5FBC 3C038019 */ lui $v1, %hi(D_8018EB80) # $v1, 0x8019 +/* 0B6BBC 800B5FBC 3C038019 */ lui $v1, %hi(gControllerPakNumPagesFree) # $v1, 0x8019 /* 0B6BC0 800B5FC0 10400005 */ beqz $v0, .L800B5FD8 -/* 0B6BC4 800B5FC4 2463EB80 */ addiu $v1, %lo(D_8018EB80) # addiu $v1, $v1, -0x1480 +/* 0B6BC4 800B5FC4 2463EB80 */ addiu $v1, %lo(gControllerPakNumPagesFree) # addiu $v1, $v1, -0x1480 /* 0B6BC8 800B5FC8 3C01800F */ lui $at, %hi(D_800E86F8) # $at, 0x800f /* 0B6BCC 800B5FCC A02086F8 */ sb $zero, %lo(D_800E86F8)($at) /* 0B6BD0 800B5FD0 1000000C */ b .L800B6004 diff --git a/asm/non_matchings/code_800AF9B0/func_800B6A68.s b/asm/non_matchings/code_800AF9B0/func_800B6A68.s index 8143ebda4..0395c5249 100644 --- a/asm/non_matchings/code_800AF9B0/func_800B6A68.s +++ b/asm/non_matchings/code_800AF9B0/func_800B6A68.s @@ -78,16 +78,16 @@ glabel func_800B6A68 /* 0B778C 800B6B8C 3C198019 */ lui $t9, %hi(D_8018EB78) # $t9, 0x8019 /* 0B7790 800B6B90 8F39EB78 */ lw $t9, %lo(D_8018EB78)($t9) /* 0B7794 800B6B94 8F18EB7C */ lw $t8, %lo(D_8018EB7C)($t8) -/* 0B7798 800B6B98 3C058019 */ lui $a1, %hi(D_8018EB80) # $a1, 0x8019 -/* 0B779C 800B6B9C 24A5EB80 */ addiu $a1, %lo(D_8018EB80) # addiu $a1, $a1, -0x1480 +/* 0B7798 800B6B98 3C058019 */ lui $a1, %hi(gControllerPakNumPagesFree) # $a1, 0x8019 +/* 0B779C 800B6B9C 24A5EB80 */ addiu $a1, %lo(gControllerPakNumPagesFree) # addiu $a1, $a1, -0x1480 /* 0B77A0 800B6BA0 0319082A */ slt $at, $t8, $t9 /* 0B77A4 800B6BA4 1020000D */ beqz $at, .L800B6BDC /* 0B77A8 800B6BA8 3C048019 */ lui $a0, %hi(D_8018E868) # $a0, 0x8019 /* 0B77AC 800B6BAC 0C033B48 */ jal osPfsFreeBlocks /* 0B77B0 800B6BB0 2484E868 */ addiu $a0, %lo(D_8018E868) # addiu $a0, $a0, -0x1798 -/* 0B77B4 800B6BB4 3C058019 */ lui $a1, %hi(D_8018EB80) # $a1, 0x8019 +/* 0B77B4 800B6BB4 3C058019 */ lui $a1, %hi(gControllerPakNumPagesFree) # $a1, 0x8019 /* 0B77B8 800B6BB8 14400008 */ bnez $v0, .L800B6BDC -/* 0B77BC 800B6BBC 24A5EB80 */ addiu $a1, %lo(D_8018EB80) # addiu $a1, $a1, -0x1480 +/* 0B77BC 800B6BBC 24A5EB80 */ addiu $a1, %lo(gControllerPakNumPagesFree) # addiu $a1, $a1, -0x1480 /* 0B77C0 800B6BC0 8CA80000 */ lw $t0, ($a1) /* 0B77C4 800B6BC4 00084A03 */ sra $t1, $t0, 8 /* 0B77C8 800B6BC8 29210079 */ slti $at, $t1, 0x79 diff --git a/data/data_0DD0A0_2.s b/data/data_0DD0A0_2.s index db5ac4cb8..fdd0ace99 100644 --- a/data/data_0DD0A0_2.s +++ b/data/data_0DD0A0_2.s @@ -2306,7 +2306,7 @@ glabel D_800E86B0 glabel gNextDemoId .byte 0x00, 0x00, 0x00, 0x00 -glabel D_800E86C0 +glabel gControllerPakSelectedTableRow .byte 0x00, 0x00, 0x00, 0x00 glabel D_800E86C4 diff --git a/include/common_structs.h b/include/common_structs.h index b84e7b587..693e8fc94 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -391,4 +391,67 @@ typedef struct { f32* unk_00[5]; } struct_D_800E261C; +typedef struct { + /* 0x00 */ s32 type; // id maybe? + /* 0x04 */ s32 unk4; // sound mode, maybe some other stuff + /* 0x08 */ s32 unk8; // This is used but I can't tell what for + /* 0x0C */ s32 column; + /* 0x10 */ s32 row; + /* 0x14 */ u8 priority; // priority/depth/z-level. Higher values are drawn on top of lower values + // If equal, later entries in D_8018D9E0 are on top + /* 0x15 */ u8 visible; // active? If 1 its displayed, if 0 its not + // These seem to be generic space available for use by the struct, no 1 purpose for any given member + /* 0x16 */ s16 unk16; // Potentially unused + /* 0x18 */ s32 D_8018DEE0_index; // Index in D_8018DEE0, an array of some other struct type + /* 0x1C */ s32 unk1C; // Multi use. Sometimes cup selection, sometimes course index. + /* 0x20 */ s32 unk20; // Multi use, hard to tell what for though. Sometimes a random number, sometimes GP points + /* 0x24 */ s32 unk24; // Multi use, x scaling for some things, rotation multiplier for the question box in some menus, probably some other things +} struct_8018D9E0_entry; // size = 0x28 + +// Top byte is used as an index to gSegmentTable +// The rest of the bytes are used as an offset +typedef u32 segment_address_t; + +// Every Mk64_Texture must be followed by either another Mk64_Texture or an Mk64_Texture sized block of zero's +typedef struct { + /* 0x00 */ s16 type; + /* 0x02 */ s16 unused1; + /* 0x04 */ segment_address_t textureData; // After converting to a virtual address, this should point actual texture data (i.e. something in texture_data_2.s) + /* 0x08 */ s16 width; + /* 0x0A */ s16 height; + /* 0x0C */ s16 dX; + /* 0x0D */ s16 dY; + /* 0x10 */ s16 size; // This size is NOT equal to width*height. Its likely the size of the compressed texture + /* 0x12 */ s16 unused2; +} Mk64_Texture; // size = 0x14 + +/** + * A series of Mk64_Textures can be chained back-to-back in memroy to create an easily accessible group + * This group must still be ended by an Mk64_Texture sized block of zero's + * See D_020015CC in data_segment2.s for an example + */ +typedef Mk64_Texture *Mk64_Texture_Group; + +// Every Mk64_Animation_Part must be followed by either another Mk64_Animation_Part or an Mk64_Animation_Part sized block of zero's +typedef struct { + /* 0x00 */ segment_address_t mk64Texture; // After converting to a virtual address, this should point to an Mk64_Texture + /* 0x04 */ s32 frame_length; +} Mk64_Animation_Part; // size = 0x8 + +/** + * A series of Mk64_Animation_Parts can be chained back-to-back to create an easily accesssible "animation" + * This "animation" must still be ended an Mk64_Animation_Part sized block of zero's + * See D_02006718 in data_segment2.s for an example + */ +typedef Mk64_Animation_Part *Mk64_Animation; + +typedef struct { + /* 0x00 */ Mk64_Animation textureSequence; + /* 0x04 */ s32 sequenceIndex; // Index in textureSequence that the animation is currently on + /* 0x08 */ s32 frameCountDown; // Frames left for the given animation part + /* 0x0C */ u32 visible; // visbile if 0x80000000, otherwise invisbile AND paused + /* 0x10 */ s32 D_8018E118_index; // Don't know what D_8018E118 tracks + /* 0x14 */ s32 unk14; // Flip flops between 0 and 1, use unknown +} struct_8018DEE0_entry; // size = 0x18 + #endif diff --git a/include/variables.h b/include/variables.h index 11ae08d14..669c40176 100644 --- a/include/variables.h +++ b/include/variables.h @@ -7,6 +7,8 @@ extern s32 gCCSelection; extern s8 gCharacterIdByGPOverallRank[8]; // D_8018D9D0 +extern s32 gControllerPakNumPagesFree; // D_8018EB80 +extern s8 gControllerPakSelectedTableRow; // D_800E86C0 extern f32 gCourseCompletionPercentByPlayerId[8]; // D_801644D0 extern f32 gCourseCompletionPercentByRank[8]; // D_80162FD8 extern s8 gCupCourseSelection; // D_8018EE0B @@ -23,6 +25,7 @@ extern s8 gHumanPlayerCount; extern f32 gKartFrictionTable[]; extern f32 gKartBoundingBoxTable[]; extern f32 gKartGravityTable[]; +extern s8 gMenuState; // D_8018EDF0 extern s32 gModeSelection; // Indicates the ID of the next title screen demo that will be played extern u8 gNextDemoId; // D_800E86BC @@ -31,11 +34,14 @@ extern u8 gPerCupIndexByCourseId[NUM_COURSES]; // D_800EFD50 extern s32 gPlayerCountSelection1; extern u8 gSaveDataSoundMode; // D_8018ED14 extern u8 gSaveDataSoundModeBackup; // D_8018ED8C +extern u32 gSegmentTable[16]; // D_80150258 extern u8 gSoundMode; // D_8018EDF2 extern char *gSoundModeNames[NUM_SOUND_MODES]; // D_800E7710 // Indexed by Player ID. Track time in seconds since player has last crossed the finish line extern f32 gTimePlayerLastTouchedFinishLine[8]; // D_8015F898 +extern struct_8018D9E0_entry D_8018D9E0[32]; // D_8018D9E0 +extern struct_8018DEE0_entry D_8018DEE0[16]; // D_8018DEE0 extern struct_D_802874D8 D_802874D8; extern s16 D_801650D0[4][8]; extern s16 D_80165110[4][8]; diff --git a/src/code_80005FD0.c b/src/code_80005FD0.c index 36d579da5..db9051062 100644 --- a/src/code_80005FD0.c +++ b/src/code_80005FD0.c @@ -2790,7 +2790,7 @@ s32 func_8000B7E4(s32, u16); // extern ? func_8002E4C4(void *, u16 *, f32 *, u16 *); // extern ? func_8003680C(void *, s16, void *, s32, void *); // extern s32 func_802B5224(void *, ? *, void *, ? *); // extern -?32 *segmented_to_virtual_dupe(void *, s16); // extern +void *segmented_to_virtual_dupe(segment_address_t); // extern ? set_places(); // extern extern ? D_0D009418; extern ? D_0D009568; @@ -3117,16 +3117,16 @@ block_63: temp_v1_3 = (arg0 * 0x10) + &D_801634F8; sp30 = temp_v1_3; temp_t0_2 = sp38 + &D_80163210; - *temp_t0_2 = *segmented_to_virtual_dupe((gCurrentCourseId * 0x10) + (gCCSelection * 4) + &D_0D0096B8, sp34 + &D_801631E0); + *temp_t0_2 = *segmented_to_virtual_dupe((gCurrentCourseId * 0x10) + (gCCSelection * 4) + &D_0D0096B8); temp_v1_3->unk4 = -0.5f; phi_t0_2 = temp_t0_2; } else if (*(D_801645E0 + (D_80162FCE * 2)) > 0) { temp_t0_3 = sp38 + &D_80163210; - *temp_t0_3 = *segmented_to_virtual_dupe((gCurrentCourseId * 0x10) + (gCCSelection * 4) + &D_0D009418, sp34 + &D_801631E0); + *temp_t0_3 = *segmented_to_virtual_dupe((gCurrentCourseId * 0x10) + (gCCSelection * 4) + &D_0D009418); phi_t0_2 = temp_t0_3; } else { temp_t0_4 = sp38 + &D_80163210; - *temp_t0_4 = *segmented_to_virtual_dupe((gCurrentCourseId * 0x10) + (gCCSelection * 4) + &D_0D009568, sp34 + &D_801631E0); + *temp_t0_4 = *segmented_to_virtual_dupe((gCurrentCourseId * 0x10) + (gCCSelection * 4) + &D_0D009568); phi_t0_2 = temp_t0_4; } sp3C = phi_t0_2; @@ -3346,12 +3346,12 @@ block_63: if ((*sp28 == 1) || (temp_v0_23 = *sp2C, (temp_v0_23 == 1)) || (temp_v0_23 == -1) || ((sp40->unkBC & 0x1000000C) != 0)) { sp20 = temp_t0_6; temp_v1_11 = sp38 + &D_80163028; - *temp_v1_11 = *segmented_to_virtual_dupe((gCurrentCourseId * 0x10) + (gCCSelection * 4) + &D_0D009418, phi_a1_3); + *temp_v1_11 = *segmented_to_virtual_dupe((gCurrentCourseId * 0x10) + (gCCSelection * 4) + &D_0D009418); phi_v1_3 = temp_v1_11; } else { sp20 = temp_t0_6; temp_v1_10 = sp38 + &D_80163028; - *temp_v1_10 = *segmented_to_virtual_dupe((gCurrentCourseId * 0x10) + (gCCSelection * 4) + &D_0D009568, phi_a1_3); + *temp_v1_10 = *segmented_to_virtual_dupe((gCurrentCourseId * 0x10) + (gCCSelection * 4) + &D_0D009568); phi_v1_3 = temp_v1_10; } temp_f0_5 = *(sp38 + &D_80163068); @@ -6290,7 +6290,7 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000F2DC.s") ? func_80011A5C(); // extern ? func_80011AB8(s32, s32); // extern ? func_8001AB00(? *, s16, s16 *, s16); // extern -f32 *segmented_to_virtual_dupe(void *); // extern +void *segmented_to_virtual_dupe(segment_address_t); // extern extern ? D_0D009418; extern ? D_800DCAA0; extern f32 D_800ED050; @@ -6813,7 +6813,7 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000F628.s") //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 s16 func_80011014(s16 *, u16 *, s32, s32); // extern s16 process_path_data(s16 *, u16 *); // extern -u16 *segmented_to_virtual_dupe(s32, s16); // extern +void *segmented_to_virtual_dupe(segment_address_t); // extern extern ? D_800DC8D0; extern ? D_800DCA4C; extern ? D_801645C8; @@ -6840,12 +6840,12 @@ void func_800100F0(s32 arg0) { if (*(&D_800DCA4C + (temp_v0 * 4)) >= 0) { sp30 = (&D_80164550)[arg0]; if (temp_v0 != 0x14) { - phi_v0 = process_path_data(sp30, segmented_to_virtual_dupe(*(&D_800DC8D0 + ((temp_v0 * 0x10) + temp_t9)), 1)); + phi_v0 = process_path_data(sp30, segmented_to_virtual_dupe(*(&D_800DC8D0 + ((temp_v0 * 0x10) + temp_t9)))); phi_at = &D_801645C8 + (arg0 * 2); goto block_9; } sp1A = 1; - temp_v0_2 = segmented_to_virtual_dupe(*(&gCoursePathTable + ((temp_v0 * 0x10) + temp_t9)), 1); + temp_v0_2 = segmented_to_virtual_dupe(*(&gCoursePathTable + ((temp_v0 * 0x10) + temp_t9))); sp2C = temp_v0_2; phi_a0 = temp_v0_2; phi_v1 = 0; @@ -7824,7 +7824,7 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001168C.s") #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 segmented_to_virtual_dupe(s32); // extern +void *segmented_to_virtual_dupe(segment_address_t); // extern extern s32 D_800DC720; extern ? D_80162EB8; extern ? D_80162F08; diff --git a/src/code_80091750.c b/src/code_80091750.c index 86cd7db91..b055e2c02 100644 --- a/src/code_80091750.c +++ b/src/code_80091750.c @@ -319,7 +319,7 @@ extern ? D_8018E938; extern ? D_8018EB38; extern s32 D_8018EB78; extern s32 D_8018EB7C; -extern s32 D_8018EB80; +extern s32 gControllerPakNumPagesFree; extern u8 gControllerBits; extern ? gControllerStatuses; extern OSMesgQueue gSIEventMesgQueue; @@ -357,10 +357,10 @@ extern OSMesgQueue gSIEventMesgQueue; phi_s0 = temp_s0; phi_s1 = temp_s1; } while (temp_s0 != 0x10); - if (osPfsFreeBlocks(&D_8018E868, &D_8018EB80) != 0) { + if (osPfsFreeBlocks(&D_8018E868, &gControllerPakNumPagesFree) != 0) { return 0; } - D_8018EB80 = D_8018EB80 >> 8; + gControllerPakNumPagesFree = gControllerPakNumPagesFree >> 8; return 1; } return 0; @@ -556,7 +556,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_80092258.s") #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 segmented_to_virtual_dupe(s32, s32 *, s32 *, s32); // extern +void *segmented_to_virtual_dupe(segment_address_t); // extern extern s32 D_800E84C0; extern ? D_800E84CC; extern s32 gGlobalTimer; @@ -595,7 +595,7 @@ void func_80092290(s32 arg0, s32 *arg1, s32 *arg2, s32 arg3) { temp_s4 = (((arg0 * 4) + ((gGlobalTimer % 2) * 2)) - 6) * 0x10; phi_s0 = &D_800E84C0; do { - temp_v0 = segmented_to_virtual_dupe(*phi_s0, phi_a1, phi_a2, phi_a3); + temp_v0 = segmented_to_virtual_dupe(*phi_s0); temp_a0 = *arg2; temp_a2 = temp_v0 + temp_s4; temp_a1 = 0x100 - temp_a0; @@ -1050,7 +1050,7 @@ UNUSED void func_800930E4(s32 arg0, s32 arg1, s32 *arg2) { } void func_80099184(s32); -s32 segmented_to_virtual(u32*); +void *segmented_to_virtual(segment_address_t); Gfx *func_8009BEF0(Gfx*, s32, f32, f32, s32, f32,f32); void print_text1(s32, s32, char*, s32, f32, f32, s32); void print_text2(s32, s32, char*, s32, f32, f32, s32); @@ -4163,125 +4163,88 @@ void *func_800987D0(void *arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4, s32 arg5 GLOBAL_ASM("asm/non_matchings/code_80091750/func_800987D0.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void swap_values(s32 *, s32 *); // extern -extern ? D_02008030; -extern ? D_02008058; +extern Gfx D_02008030[]; +extern Gfx D_02008058[]; -void *func_80098C18(void *arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, u32 arg7, s32 arg8) { - s32 temp_a0; - void *temp_a1; - void *temp_v1; - - arg5 &= 0xFF; - arg6 &= 0xFF; - arg7 &= 0xFF; - arg8 &= 0xFF; - if (arg3 < arg1) { - swap_values(&arg1, &arg3); +Gfx *func_80098C18(Gfx *displayListHead, s32 ulx, s32 uly, s32 lrx, s32 lry, s32 red, s32 green, u32 blue, s32 alpha) { + red &= 0xFF; + green &= 0xFF; + blue &= 0xFF; + alpha &= 0xFF; + if (lrx < ulx) { + swap_values(&ulx, &lrx); } - if (arg4 < arg2) { - swap_values(&arg2, &arg4); + if (lry < uly) { + swap_values(&uly, &lry); } - if ((arg1 >= 0x140) || (arg2 >= 0xF0)) { - return arg0; + if ((ulx >= 0x140) || (uly >= 0xF0)) { + return displayListHead; } - if (arg1 < 0) { - arg1 = 0; + if (ulx < 0) { + ulx = 0; } - if (arg2 < 0) { - arg2 = 0; + if (uly < 0) { + uly = 0; } - if ((arg3 < 0) || (arg4 < 0)) { - return arg0; + if ((lrx < 0) || (lry < 0)) { + return displayListHead; } - if (arg3 >= 0x140) { - arg3 = 0x13F; + if (lrx >= 0x140) { + lrx = 0x13F; } - if (arg4 >= 0xF0) { - arg4 = 0xEF; + if (lry >= 0xF0) { + lry = 0xEF; } - arg0->unk4 = &D_02008030; - arg0->unk0 = 0x6000000; - arg0->unk8 = 0xF7000000; - temp_a0 = ((arg5 << 8) & 0xF800) | ((arg6 * 8) & 0x7C0) | ((arg7 >> 2) & 0x3E) | (arg8 & 1); - arg0->unkC = (temp_a0 << 0x10) | temp_a0; - temp_a1 = arg0 + 8 + 8; - temp_a1->unk0 = ((arg3 & 0x3FF) << 0xE) | 0xF6000000 | ((arg4 & 0x3FF) * 4); - temp_v1 = temp_a1 + 8; - temp_a1->unk4 = ((arg1 & 0x3FF) << 0xE) | ((arg2 & 0x3FF) * 4); - temp_v1->unk4 = &D_02008058; - temp_v1->unk0 = 0x6000000; - return temp_v1 + 8; + gSPDisplayList(displayListHead++, D_02008030); + gDPSetFillColor(displayListHead++, (GPACK_RGBA5551(red, green, blue, alpha) << 0x10 | GPACK_RGBA5551(red, green, blue, alpha))); + gDPFillRectangle(displayListHead++, ulx, uly, lrx, lry); + gSPDisplayList(displayListHead++, D_02008058); + return displayListHead; } -#else -GLOBAL_ASM("asm/non_matchings/code_80091750/func_80098C18.s") -#endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void swap_values(s32, s32); -extern ? D_02008008; +extern Gfx D_02008008[]; +Gfx *draw_box(Gfx *displayListHead, s32 ulx, s32 uly, s32 lrx, s32 lry, s32 red, s32 green, s32 blue, s32 alpha) { + Gfx *temp_a0; + Gfx *temp_v1; -void *draw_box(void *arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7, s32 arg8) { - void *temp_a0; - void *temp_v1; - - arg5 &= 0xFF; - arg6 &= 0xFF; - arg7 &= 0xFF; - arg8 &= 0xFF; - if (arg3 < arg1) { - swap_values(&arg1, &arg3); + red &= 0xFF; + green &= 0xFF; + blue &= 0xFF; + alpha &= 0xFF; + if (lrx < ulx) { + swap_values(&ulx, &lrx); } - if (arg4 < arg2) { - swap_values(&arg2, &arg4); + if (lry < uly) { + swap_values(&uly, &lry); } - if ((arg1 >= 0x140) || (arg2 >= 0xF0)) { - return arg0; + if ((ulx >= 0x140) || (uly >= 0xF0)) { + return displayListHead; } - if (arg1 < 0) { - arg1 = 0; + if (ulx < 0) { + ulx = 0; } - if (arg2 < 0) { - arg2 = 0; + if (uly < 0) { + uly = 0; } - if ((arg3 < 0) || (arg4 < 0)) { - return arg0; + if ((lrx < 0) || (lry < 0)) { + return displayListHead; } - if (arg3 >= 0x141) { - arg3 = 0x140; + if (lrx >= 0x141) { + lrx = 0x140; } - if (arg4 >= 0xF1) { - arg4 = 0xF0; + if (lry >= 0xF1) { + lry = 0xF0; } - arg0->unk4 = &D_02008008; - arg0->unk0 = 0x6000000; - arg0->unk8 = 0xFA000000; - arg0->unkC = (arg5 << 0x18) | ((arg6 & 0xFF) << 0x10) | ((arg7 & 0xFF) << 8) | (arg8 & 0xFF); - temp_a0 = arg0 + 8 + 8; - temp_a0->unk0 = ((arg3 & 0x3FF) << 0xE) | 0xF6000000 | ((arg4 & 0x3FF) * 4); - temp_v1 = temp_a0 + 8; - temp_a0->unk4 = ((arg1 & 0x3FF) << 0xE) | ((arg2 & 0x3FF) * 4); - temp_v1->unk0 = 0xE7000000; - temp_v1->unk4 = 0; - return temp_v1 + 8; + gSPDisplayList(displayListHead++, D_02008008); + gDPSetPrimColor(displayListHead++, 0, 0, red, green, blue, alpha); + gDPFillRectangle(displayListHead++, ulx, uly, lrx, lry); + gDPPipeSync(displayListHead++); + return displayListHead; } -#else -GLOBAL_ASM("asm/non_matchings/code_80091750/draw_box.s") -#endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80098C18(s32, s32, s32, s32, s32); // extern - -void func_80098FC8(s32 arg4) { - func_80098C18(arg4, 0, 0, 0, 0xFF); +Gfx *func_80098FC8(Gfx *displayListHead, s32 ulx, s32 uly, s32 lrx, s32 lry) { + return func_80098C18(displayListHead, ulx, uly, lrx, lry, 0, 0, 0, 0xFF); } -#else -GLOBAL_ASM("asm/non_matchings/code_80091750/func_80098FC8.s") -#endif #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 @@ -4330,32 +4293,18 @@ void func_80099110(void) { GLOBAL_ASM("asm/non_matchings/code_80091750/func_80099110.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern ? gSegmentTable; - -s32 segmented_to_virtual(u32 arg0) { - return *(&gSegmentTable + ((arg0 >> 0x18) * 4)) + (arg0 & 0xFFFFFF) + 0x80000000; +void *segmented_to_virtual(segment_address_t arg0) { + return gSegmentTable[arg0 >> 0x18] + (arg0 & 0xFFFFFF) + 0x80000000; } -#else -GLOBAL_ASM("asm/non_matchings/code_80091750/segmented_to_virtual.s") -#endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern ? gSegmentTable; - -s32 segmented_to_virtual_dupe(u32 arg0) { - return *(&gSegmentTable + ((arg0 >> 0x18) * 4)) + (arg0 & 0xFFFFFF) + 0x80000000; +void *segmented_to_virtual_dupe(segment_address_t arg0) { + return gSegmentTable[arg0 >> 0x18] + (arg0 & 0xFFFFFF) + 0x80000000; } -#else -GLOBAL_ASM("asm/non_matchings/code_80091750/segmented_to_virtual_dupe.s") -#endif #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 ? dma_copy_base_729a30(s32, s32, u8 *); // extern -void *segmented_to_virtual(); // extern +void *segmented_to_virtual(segment_address_t); // extern extern s32 D_8018D9B0; extern u8 *D_8018D9B4; extern s32 D_8018E110; @@ -4441,7 +4390,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009969C.s") //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 ? dma_copy_base_729a30(s32, s32, u8 *); // extern ? dma_copy_base_7fa3c0(s32, s32, u8 *); // extern -void *segmented_to_virtual(); // extern +void *segmented_to_virtual(segment_address_t); // extern ? tkmk00decode(u8 *, s32, s32, ?); // extern extern s32 D_8018D9B0; extern u8 *D_8018D9B4; @@ -4464,7 +4413,7 @@ void func_800996BC(s32 arg1) { s32 phi_a1_3; ? phi_v0_2; - temp_v0 = segmented_to_virtual(); + temp_v0 = segmented_to_virtual(arg0); phi_s0 = temp_v0; if (temp_v0->unk4 != 0) { do { @@ -4552,7 +4501,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800996BC.s") #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 ? dma_copy_base_729a30(s32, s32, u8 *); // extern -void *segmented_to_virtual(); // extern +void *segmented_to_virtual(segment_address_t); // extern extern u8 *D_8018D9B4; void func_80099958(s32 arg1, s32 arg2) { @@ -4566,7 +4515,7 @@ void func_80099958(s32 arg1, s32 arg2) { s32 phi_a0; s32 phi_a1_2; - temp_v0 = segmented_to_virtual(); + temp_v0 = segmented_to_virtual(arg0); temp_t6 = temp_v0->unk4; phi_s0 = temp_v0; phi_a0 = temp_t6; @@ -4615,7 +4564,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_80099A70.s") #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 segmented_to_virtual(); // extern +void *segmented_to_virtual(segment_address_t); // extern extern s32 D_8018E060; void func_80099A94(s32 arg1) { @@ -4634,7 +4583,7 @@ void func_80099A94(s32 arg1) { } while (phi_v1->unk8 != 0); } sp1C = phi_v1_2; - phi_v1_2->unk0 = segmented_to_virtual(); + phi_v1_2->unk0 = segmented_to_virtual(arg0); phi_v1_2->unk4 = arg1; } #else @@ -4765,7 +4714,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_80099E54.s") #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 segmented_to_virtual(); // extern +void *segmented_to_virtual(segment_address_t); // extern extern s32 D_8018E0E8; void func_80099E60(s32 arg1, s32 arg2) { @@ -4784,7 +4733,7 @@ void func_80099E60(s32 arg1, s32 arg2) { } while (phi_v1->unk8 != 0); } sp1C = phi_v1_2; - phi_v1_2->unk0 = segmented_to_virtual(); + phi_v1_2->unk0 = segmented_to_virtual(arg0); phi_v1_2->unk4 = arg1; phi_v1_2->unk6 = arg2; } @@ -4921,7 +4870,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009A344.s") #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 ? func_8009969C(s32, s32, s32 *); // extern -s32 *segmented_to_virtual_dupe(); // extern +void *segmented_to_virtual_dupe(segment_address_t); // extern extern ? D_8018DEE0; extern s32 D_8018E758; @@ -4940,7 +4889,7 @@ s32 func_8009A374(s32 *arg0) { s32 phi_a1_2; s32 *phi_a2; - temp_v0 = segmented_to_virtual_dupe(); + temp_v0 = segmented_to_virtual_dupe(arg0); temp_a2 = temp_v0; phi_a1 = 0; phi_a1_2 = 0; @@ -4997,7 +4946,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009A374.s") #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 ? func_80099958(s32, s32, ?, s32); // extern -s32 *segmented_to_virtual_dupe(); // extern +void *segmented_to_virtual_dupe(segment_address_t); // extern extern ? D_8018DEE0; extern s32 D_8018E758; @@ -5015,7 +4964,7 @@ s32 func_8009A478(s32 arg1) { ? *phi_v1; s32 phi_a3_2; - temp_v0 = segmented_to_virtual_dupe(); + temp_v0 = segmented_to_virtual_dupe(arg0); temp_s0 = temp_v0; phi_a3 = 0; phi_a3_2 = 0; @@ -5066,151 +5015,132 @@ block_5: GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009A478.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80099A94(s32, s32); // extern -s32 segmented_to_virtual(s32, s32); // extern -s32 segmented_to_virtual_dupe(?); // extern -extern ? D_8018DEE0; +#ifdef NON_MATCHING +void func_80099A94(Mk64_Texture *, s32); /* extern */ -void func_8009A594(s32 arg0, s32 arg1, ? arg2) { - s32 temp_v0; - s32 temp_v0_2; - void *temp_s0; +// Non-matching due to the argument registers to an addu command being swapped. +void func_8009A594(s32 arg0, s32 arg1, segment_address_t arg2) { + Mk64_Animation temp_v0; + struct_8018DEE0_entry *temp_s0; + Mk64_Texture *temp_v0_2; + s32 thing = arg1; temp_v0 = segmented_to_virtual_dupe(arg2); - temp_s0 = (arg0 * 0x18) + &D_8018DEE0; - temp_s0->unk0 = temp_v0; - temp_s0->unk4 = arg1; - temp_s0->unk8 = ((arg1 * 8) + temp_v0)->unk4; - temp_v0_2 = segmented_to_virtual(*(temp_v0 + (arg1 * 8)), arg1); + temp_s0 = &D_8018DEE0[arg0]; + temp_s0->textureSequence = temp_v0; + temp_s0->sequenceIndex = arg1; + temp_s0->frameCountDown = temp_v0[arg1].frame_length; + temp_v0_2 = segmented_to_virtual(temp_v0[thing].mk64Texture); if (temp_s0->unk14 != 0) { - func_80099A94(temp_v0_2, temp_s0->unk10); + func_80099A94(temp_v0_2, temp_s0->D_8018E118_index); temp_s0->unk14 = 0; - return; + } else { + func_80099A94(temp_v0_2, temp_s0->D_8018E118_index + 1); + temp_s0->unk14 = 1; } - func_80099A94(temp_v0_2, temp_s0->unk10 + 1); - temp_s0->unk14 = 1; } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009A594.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80099E60(s32, s32, s32); // extern -s32 segmented_to_virtual(s32, s32); // extern -s32 segmented_to_virtual_dupe(?); // extern -extern ? D_8018DEE0; - -void func_8009A640(s32 arg0, s32 arg1, s32 arg2, ? arg3) { - void *sp1C; - s32 temp_a0; - s32 temp_a2; - s32 temp_v0; - void *temp_v1; +#ifdef NON_MATCHING +// Non-matching due to the argument registers to an addu command being swapped. +// Also some stack mangement around the segmented_to_virtual call is wrong +extern void func_80099E60(Mk64_Texture *, s32, s32); +void func_8009A640(s32 arg0, s32 arg1, s32 arg2, segment_address_t arg3) { + Mk64_Animation temp_v0; + Mk64_Texture *temp_a0; + s32 thing = arg1; temp_v0 = segmented_to_virtual_dupe(arg3); - temp_v1 = (arg0 * 0x18) + &D_8018DEE0; - temp_v1->unk0 = temp_v0; - temp_v1->unk4 = arg1; - temp_v1->unk8 = ((arg1 * 8) + temp_v0)->unk4; - sp1C = temp_v1; - temp_a0 = segmented_to_virtual(*(temp_v0 + (arg1 * 8)), arg1); - temp_a2 = temp_v1->unk14 ^ 1; - temp_v1->unk14 = temp_a2; - func_80099E60(temp_a0, arg2, temp_a2); + D_8018DEE0[arg0].textureSequence = temp_v0; + D_8018DEE0[arg0].sequenceIndex = arg1; + D_8018DEE0[arg0].frameCountDown = temp_v0[arg1].frame_length; + temp_a0 = segmented_to_virtual(temp_v0[thing].mk64Texture); + D_8018DEE0[arg0].unk14 ^= 1; + func_80099E60(temp_a0, arg2, D_8018DEE0[arg0].unk14); } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009A640.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_8009A878(void *); // extern -s32 func_8009C434(s32, void *, s32, s32, s32); // extern -extern ? D_8018DEE0; -extern s32 gDisplayListHead; +//generated by mips_to_c commit dacbf209f1bb5d4acaecaf1fefff331d60ffd80c +extern ? D_8018E060; + +UNUSED void func_8009A6D4(void) { + struct_8018DEE0_entry *temp_s0; + struct_8018DEE0_entry *phi_s0; + + phi_s0 = D_8018DEE0; + do { + if ((phi_s0->visible & 0x80000000) != 0) { + func_8009A878(phi_s0); + gDisplayListHead = func_8009C434((s32) gDisplayListHead, phi_s0, 0, 0, 0); + } + temp_s0 = phi_s0 + 0x18; + phi_s0 = temp_s0; + } while (temp_s0 != &D_8018E060); + func_80099AEC(); +} +#else +GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009A6D4.s") +#endif + +segment_address_t func_8009A878(struct_8018DEE0_entry *); // extern +s32 func_8009C434(s32, struct_8018DEE0_entry *, s32, s32, s32); // extern void func_8009A76C(s32 arg0, s32 arg1, s32 arg2, s32 arg3) { - void *sp20; - void *temp_t8; - - temp_t8 = (arg0 * 0x18) + &D_8018DEE0; - sp20 = temp_t8; - if (temp_t8->unkC & 0x80000000) { - func_8009A878(temp_t8); - gDisplayListHead = func_8009C434(gDisplayListHead, sp20, arg1, arg2, arg3); + struct_8018DEE0_entry *temp = &D_8018DEE0[arg0]; + if (temp->visible & 0x80000000) { + func_8009A878(temp); + gDisplayListHead = func_8009C434(gDisplayListHead, temp, arg1, arg2, arg3); } } -#else -GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009A76C.s") -#endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_8009A944(void *, s32); // extern -s32 func_8009C708(s32, void *, s32, s32, s32, s32); // extern -extern ? D_8018DEE0; -extern s32 gDisplayListHead; +void func_8009A944(struct_8018DEE0_entry *, s32); // extern +s32 func_8009C708(s32, struct_8018DEE0_entry *, s32, s32, s32, s32); // extern void func_8009A7EC(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { - void *sp20; - void *temp_t8; - - temp_t8 = (arg0 * 0x18) + &D_8018DEE0; - sp20 = temp_t8; - if (temp_t8->unkC & 0x80000000) { - func_8009A944(temp_t8, arg3); - gDisplayListHead = func_8009C708(gDisplayListHead, sp20, arg1, arg2, arg3, arg4); + struct_8018DEE0_entry *temp = &D_8018DEE0[arg0]; + if (temp->visible & 0x80000000) { + func_8009A944(temp, arg3); + gDisplayListHead = func_8009C708(gDisplayListHead, temp, arg1, arg2, arg3, arg4); } } -#else -GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009A7EC.s") -#endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -? func_80099A94(s32, s32); // extern -s32 segmented_to_virtual(s32); // extern +void func_80099A94(Mk64_Texture *, s32); /* extern */ -s32 func_8009A878(void *arg0) { - s32 *temp_v0; - s32 temp_t1; - s32 temp_t3; - s32 temp_t8; - s32 temp_v0_2; - s32 temp_v1; - s32 *phi_v0; +segment_address_t func_8009A878(struct_8018DEE0_entry *arg0) { + Mk64_Animation_Part *temp_v0; + Mk64_Animation_Part *temp_v1; + Mk64_Texture *temp_v0_2; - temp_v1 = arg0->unk0; - if (arg0->unk4 < 0) { - arg0->unk4 = 0; - arg0->unk8 = 0; + temp_v1 = arg0->textureSequence; + if (arg0->sequenceIndex < 0) { + arg0->sequenceIndex = 0; + arg0->frameCountDown = 0; } - temp_t8 = arg0->unk8 - 1; - arg0->unk8 = temp_t8; - if (temp_t8 <= 0) { - temp_t1 = arg0->unk4 + 1; - temp_t3 = temp_t1 * 8; - arg0->unk4 = temp_t1; - temp_v0 = temp_v1 + temp_t3; - phi_v0 = temp_v0; - if (*temp_v0 == 0) { - arg0->unk4 = 0; - phi_v0 = temp_v1 + (0 * 8); + arg0->frameCountDown--; + if (arg0->frameCountDown <= 0) { + arg0->sequenceIndex++; + temp_v0 = &temp_v1[arg0->sequenceIndex]; + if (temp_v0->mk64Texture == 0) { + arg0->sequenceIndex = 0; + temp_v0 = &temp_v1[0]; } - arg0->unk8 = phi_v0->unk4; - temp_v0_2 = segmented_to_virtual(phi_v0->unk0); + arg0->frameCountDown = temp_v0->frame_length; + temp_v0_2 = segmented_to_virtual(temp_v0->mk64Texture); if (arg0->unk14 != 0) { - func_80099A94(temp_v0_2, arg0->unk10); + func_80099A94(temp_v0_2, arg0->D_8018E118_index); arg0->unk14 = 0; } else { - func_80099A94(temp_v0_2, arg0->unk10 + 1); + func_80099A94(temp_v0_2, arg0->D_8018E118_index + 1); arg0->unk14 = 1; } } - return *(arg0->unk0 + (arg0->unk4 * 8)); + return arg0->textureSequence[arg0->sequenceIndex].mk64Texture; } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009A878.s") @@ -5219,7 +5149,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009A878.s") #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 ? func_80099E60(s32, s32, s32, void *); // extern -s32 segmented_to_virtual(s32, void *); // extern +void *segmented_to_virtual(segment_address_t); // extern s32 func_8009A944(void *arg0, s32 arg1) { s32 *temp_v0; @@ -5254,7 +5184,7 @@ s32 func_8009A944(void *arg0, s32 arg1) { } temp_a3->unk8 = phi_v0->unk4; arg0 = temp_a3; - temp_a0 = segmented_to_virtual(phi_v0->unk0, temp_a3); + temp_a0 = segmented_to_virtual(phi_v0->unk0); temp_a2 = arg0->unk14 ^ 1; arg0->unk14 = temp_a2; func_80099E60(temp_a0, arg1, temp_a2, arg0); @@ -5501,7 +5431,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009B938.s") #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 segmented_to_virtual(); // extern +void *segmented_to_virtual(segment_address_t); // extern extern s32 D_8018E75C; extern s32 D_8018E760; extern ? D_8018E768; @@ -5537,7 +5467,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009B998.s") #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *segmented_to_virtual(?); // extern +void *segmented_to_virtual(segment_address_t); // extern extern ? D_8018E768; extern ? D_8018E7A8; @@ -5582,7 +5512,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009B9D0.s") //generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 void *func_80095E10(void *, s8, ?, ?, s32, s32, s32, s32, s32, s32, s32, s32, s32); /* extern */ void *func_800987D0(void *, ?, ?, u16, s32, s32, s32, s32, s32, s32); /* extern */ -void *segmented_to_virtual(s32); /* extern */ +void *segmented_to_virtual(segment_address_t); /* extern */ static ? D_02007708; /* unable to generate initializer */ static ? D_02007728; /* unable to generate initializer */ static ? D_02007748; /* unable to generate initializer */ @@ -5678,7 +5608,7 @@ void *func_80097A14(void *, ?, ?, ?, s32, s32, s32, s32, s32, s32, s32); // exte void *func_80097AE4(void *, ?, s32, s32, s32, s32); // extern void *func_80097E58(void *, ?, ?, ?, s32, s32, s32, s32, s32, s32, s32, s32); // extern s32 func_8009B8C4(s32); // extern -void *segmented_to_virtual(?); // extern +void *segmented_to_virtual(segment_address_t); // extern extern ? D_02007708; extern ? D_02007728; @@ -5767,7 +5697,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009BC9C.s") //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 void *func_80095BD0(void *, s32, f32, f32, s32, s32, f32, f32); // extern s32 func_8009B8C4(s32); // extern -void *segmented_to_virtual(?); // extern +void *segmented_to_virtual(segment_address_t); // extern extern ? D_020077F8; extern ? D_02007818; @@ -5925,7 +5855,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009BEF0.s") //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 void *func_800963F0(void *, s8, ?, ?, f32, f32, s32, s32, s32, s32, s32, s32, s32, s32, s32); // extern s32 func_8009B8C4(s32); // extern -void *segmented_to_virtual(?); // extern +void *segmented_to_virtual(segment_address_t); // extern extern ? D_02007708; extern ? D_02007728; extern ? D_02007768; @@ -6013,7 +5943,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009C204.s") void *func_80095E10(void *, s8, ?, ?, s32, s32, s32, s32, s32, s32, s32, s32, s32); // extern void *func_800963F0(void *, s8, ?, ?, f32, f32, s32, s32, s32, s32, s32, s32, s32, s32, s32); // extern void *func_80097E58(void *, s8, ?, ?, s32, s32, s32, s32, s32, s32, s32, s32); // extern -void *segmented_to_virtual(s32); // extern +void *segmented_to_virtual(segment_address_t); // extern extern ? D_02007708; extern ? D_02007728; extern ? D_02007768; @@ -6109,7 +6039,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009C434.s") #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 void *func_80097E58(void *, s8, ?, ?, s32, s32, s32, s32, u8 *, s32, s32, s32); // extern -void *segmented_to_virtual(s32); // extern +void *segmented_to_virtual(segment_address_t); // extern extern ? D_02007708; extern ? D_02007728; extern ? D_02007748; @@ -7606,8 +7536,8 @@ s32 *func_8009BA74(s32 *, ? *, s32, s32); /* extern */ ? func_800B559C(s32); /* extern */ ? func_800B6708(); /* extern */ s32 random_int(?, s8); /* extern */ -? *segmented_to_virtual(void *, s8); /* extern */ -s32 segmented_to_virtual_dupe(? *, s8, s8, s32); /* extern */ +void *segmented_to_virtual(segment_address_t); /* extern */ +void *segmented_to_virtual_dupe(segment_address_t); /* extern */ extern ? D_801640F4; extern ? D_8018D9E0; extern ? D_8018EE10; @@ -8008,7 +7938,7 @@ loop_3: } sp7C = phi_ra; sp20 = phi_v1; - phi_ra->unk18 = func_8009A478(segmented_to_virtual_dupe(phi_a0, temp_a1, arg3), 0); + phi_ra->unk18 = func_8009A478(segmented_to_virtual_dupe(phi_a0), 0); func_800996BC(segmented_to_virtual(*(&D_800E7D54 + phi_v1)), 0); /* Duplicate return node #87. Try simplifying control flow for better match */ return; @@ -8132,7 +8062,7 @@ loop_3: return; case 0xD6: /* switch 2 */ sp7C = phi_ra; - phi_ra->unk18 = func_8009A374(segmented_to_virtual_dupe(*D_800E7D34, arg3)); + phi_ra->unk18 = func_8009A374(segmented_to_virtual_dupe(*D_800E7D34)); return; case 0xD7: /* switch 2 */ phi_v1_3 = D_800E7D0C; @@ -8150,7 +8080,7 @@ loop_3: case 0xA0: /* switch 2 */ case 0xA1: /* switch 2 */ sp7C = phi_ra; - phi_ra->unk18 = func_8009A374(segmented_to_virtual_dupe(*(&D_800E80A0 + (arg0 * 4)), arg3)); + phi_ra->unk18 = func_8009A374(segmented_to_virtual_dupe(*(&D_800E80A0 + (arg0 * 4)))); return; case 0x5D: /* switch 2 */ phi_ra->unk1C = 0x20; @@ -8165,14 +8095,14 @@ loop_3: case 0x5A: /* switch 2 */ case 0x5B: /* switch 2 */ case 0x5C: /* switch 2 */ - func_800996BC(segmented_to_virtual(*(&D_800E817C + (arg0 * 4)), arg3), 0); + func_800996BC(segmented_to_virtual(*(&D_800E817C + (arg0 * 4))), 0); return; case 0x5F: /* switch 2 */ case 0x60: /* switch 2 */ case 0x61: /* switch 2 */ case 0x62: /* switch 2 */ sp7C = phi_ra; - phi_ra->unk18 = func_8009A374(segmented_to_virtual_dupe(*(&D_800E7E34 + (*(&gCupCourseOrder - 0xBE + (phi_ra->unk0 * 2)) * 4)), arg3)); + phi_ra->unk18 = func_8009A374(segmented_to_virtual_dupe(*(&D_800E7E34 + (*(&gCupCourseOrder - 0xBE + (phi_ra->unk0 * 2)) * 4)))); return; case 0x5E: /* switch 2 */ sp7C = phi_ra; @@ -8196,12 +8126,12 @@ loop_3: return; case 0x68: /* switch 2 */ sp7C = phi_ra; - func_800996BC(segmented_to_virtual(*(&D_800E8294 + (gCCSelection * 4)), arg3), 0); + func_800996BC(segmented_to_virtual(*(&D_800E8294 + (gCCSelection * 4))), 0); phi_ra->unkC = 0x37; phi_ra->unk10 = 0xC3; return; case 0x69: /* switch 2 */ - func_800996BC(segmented_to_virtual(&D_02004A0C, arg3), 0); + func_800996BC(segmented_to_virtual(&D_02004A0C), 0); if (func_800B5B94() == 0) { func_800B6708(); return; @@ -8213,10 +8143,10 @@ loop_3: case 0x79: /* switch 2 */ case 0x7A: /* switch 2 */ case 0x7B: /* switch 2 */ - func_800996BC(segmented_to_virtual(*(&D_800E8114 + (arg0 * 4)), arg3), 0); + func_800996BC(segmented_to_virtual(*(&D_800E8114 + (arg0 * 4))), 0); return; case 0x8C: /* switch 2 */ - func_800996BC(segmented_to_virtual(&D_02004A34, arg3), 0); + func_800996BC(segmented_to_virtual(&D_02004A34), 0); if (func_800B5B94() == 0) { func_800B6708(); return; @@ -8225,7 +8155,7 @@ loop_3: D_8018EE10.unk84 = 0; return; case 0x8D: /* switch 2 */ - func_80099184(segmented_to_virtual(&D_02001FA4, arg3)); + func_80099184(segmented_to_virtual(&D_02001FA4)); return; case 0x7C: /* switch 2 */ case 0x7D: /* switch 2 */ @@ -8245,7 +8175,7 @@ loop_3: case 0x8B: /* switch 2 */ sp7C = phi_ra; temp_v0_5 = phi_ra->unk0 - 0x7C; - func_800996BC(segmented_to_virtual(*(&D_800E7D74 + (*(&gCupCourseOrder + (((temp_v0_5 / 4) * 8) + ((temp_v0_5 % 4) * 2))) * 4)), arg3), -1); + func_800996BC(segmented_to_virtual(*(&D_800E7D74 + (*(&gCupCourseOrder + (((temp_v0_5 / 4) * 8) + ((temp_v0_5 % 4) * 2))) * 4))), -1); temp_v0_6 = phi_ra->unk0 - 0x7C; func_800996BC(segmented_to_virtual(*(&D_800E7DC4 + (*(&gCupCourseOrder + (((temp_v0_6 / 4) * 8) + ((temp_v0_6 % 4) * 2))) * 4))), 0); func_800996BC(segmented_to_virtual(&D_02004A0C), 0); @@ -8290,7 +8220,7 @@ block_63: sp20 = phi_v1_5; sp24 = phi_a2; sp3C = temp_a3; - phi_ra->unk18 = func_8009A478(segmented_to_virtual_dupe(phi_a0_2, temp_a1_2, phi_a2, temp_a3), sp3C); + phi_ra->unk18 = func_8009A478(segmented_to_virtual_dupe(phi_a0_2), sp3C); func_800996BC(segmented_to_virtual(*(&D_800E7D54 + phi_v1_5)), 0); func_80099184(segmented_to_virtual(*(&D_800E7FF0 + phi_a2))); return; @@ -8313,7 +8243,7 @@ block_63: case 0xE6: /* switch 2 */ temp_v0_8 = D_8018EDF7; sp7C = phi_ra; - phi_ra->unk18 = func_8009A374(segmented_to_virtual_dupe(*(&D_800E7E34 + (*(&gCupCourseOrder + (((temp_v0_8 / 4) * 8) + ((temp_v0_8 % 4) * 2))) * 4)), arg3)); + phi_ra->unk18 = func_8009A374(segmented_to_virtual_dupe(*(&D_800E7E34 + (*(&gCupCourseOrder + (((temp_v0_8 / 4) * 8) + ((temp_v0_8 % 4) * 2))) * 4)))); phi_ra->unk1C = D_8018EDF7; func_800996BC(segmented_to_virtual(&D_02004A0C), 0); func_8006EF60(); @@ -8328,7 +8258,7 @@ block_63: phi_ra->unk4 = gSoundMode; return; case 0xF1: /* switch 2 */ - func_800996BC(segmented_to_virtual(&D_02004638, arg3), 0); + func_800996BC(segmented_to_virtual(&D_02004638), 0); return; case 0xBE: /* switch 2 */ D_8018ED90 = 0; @@ -8370,7 +8300,7 @@ block_63: case 0x17: /* switch 3 */ case 0x18: /* switch 3 */ case 0x19: /* switch 3 */ - func_800996BC(segmented_to_virtual(*(&D_800E822C + (arg0 * 4)), arg3), 0); + func_800996BC(segmented_to_virtual(*(&D_800E822C + (arg0 * 4))), 0); return; case 0xB: /* switch 3 */ case 0xC: /* switch 3 */ @@ -8378,7 +8308,7 @@ block_63: case 0xE: /* switch 3 */ temp_v0_10 = (arg0 * 8) + &D_800E8234; sp24 = temp_v0_10; - func_800996BC(segmented_to_virtual(temp_v0_10->unk-58, arg3), 0); + func_800996BC(segmented_to_virtual(temp_v0_10->unk-58), 0); func_80099184(segmented_to_virtual(sp24->unk-54)); return; case 0x2A: /* switch 3 */ @@ -8393,7 +8323,7 @@ block_63: case 0x35: /* switch 3 */ case 0x36: /* switch 3 */ case 0x37: /* switch 3 */ - func_80099184(segmented_to_virtual(*(&D_800E81E4 + (arg0 * 4)), arg3)); + func_80099184(segmented_to_virtual(*(&D_800E81E4 + (arg0 * 4)))); return; case 0x2B: /* switch 3 */ case 0x2C: /* switch 3 */ @@ -8406,7 +8336,7 @@ block_63: sp7C = phi_ra; temp_t7 = arg0 * 4; sp24 = temp_t7; - phi_ra->unk18 = func_8009A374(segmented_to_virtual_dupe(*(&D_800E8274 + temp_t7), temp_t7, arg3)); + phi_ra->unk18 = func_8009A374(segmented_to_virtual_dupe(*(&D_800E8274 + temp_t7))); func_800996BC(segmented_to_virtual(*(&D_800E7CA8 + sp24)), 0); return; default: /* switch 3 */ @@ -8492,7 +8422,7 @@ void *func_8009BC9C(void *, ? *, s32, s32, s32, s32); /* extern */ ? func_800A90D4(s32, void *); /* extern */ s32 func_800B4EB4(?, ?); /* extern */ s32 func_800B555C(s32); /* extern */ -? *segmented_to_virtual(s32, s8, s32); /* extern */ +void *segmented_to_virtual(segment_address_t); /* extern */ ? set_text_color(s32); /* extern */ extern s32 D_800DC540; extern s32 D_800DC548; @@ -8655,7 +8585,7 @@ void func_8009F5E0(void *arg0) { case 0x130: /* switch 2 */ if (arg0->unk4 != 0) { temp_a2 = *(&D_800EFD64 + D_802874F6); - gDisplayListHead = func_8009BA74(gDisplayListHead, segmented_to_virtual(*(&D_800E7D54 + (temp_a2 * 4)), temp_a2), arg0->unkC, arg0->unk10); + gDisplayListHead = func_8009BA74(gDisplayListHead, segmented_to_virtual(*(&D_800E7D54 + (temp_a2 * 4))), arg0->unkC, arg0->unk10); func_8009A7EC(arg0->unk18, arg0->unkC, arg0->unk10, 0, arg0->unk1C); return; } @@ -8682,25 +8612,16 @@ void func_8009F5E0(void *arg0) { func_800A0B80(arg0); return; case 0xD5: /* switch 3 */ - temp_v1_2 = gDisplayListHead; - gDisplayListHead = temp_v1_2 + 8; - temp_v1_2->unk4 = 0xFF; - temp_v1_2->unk0 = 0xFA000000; - temp_v0 = func_8009B9D0(gDisplayListHead, &D_020015A4); - gDisplayListHead = temp_v0; - gDisplayListHead = temp_v0 + 8; - temp_v0->unk4 = 0x320000FF; - temp_v0->unk0 = 0xFA000000; - temp_v0_2 = func_8009B9D0(gDisplayListHead, &D_020015CC); - gDisplayListHead = temp_v0_2; - gDisplayListHead = temp_v0_2 + 8; - temp_v0_2->unk4 = 0x3200FF; - temp_v0_2->unk0 = 0xFA000000; - temp_v0_3 = func_8009B9D0(gDisplayListHead, &D_02001630); - gDisplayListHead = temp_v0_3; - gDisplayListHead = temp_v0_3 + 8; - temp_v0_3->unk4 = 0x323200FF; - temp_v0_3->unk0 = 0xFA000000; + // Sets the text color of the text on the Controller Pak menu + // Also sets the color of the shading at the top and bottom of the menu + // Does not set color of the text in the table itself + gDPSetPrimColor(gDisplayListHead, 0, 0, 0x00, 0x00, 0x00, 0xFF); + gDisplayListHead = func_8009B9D0(gDisplayListHead, &D_020015A4); + gDPSetPrimColor(gDisplayListHead, 0, 0, 0x32, 0x00, 0x00, 0xFF); + gDisplayListHead = func_8009B9D0(gDisplayListHead, &D_020015CC); + gDPSetPrimColor(gDisplayListHead, 0, 0, 0x00, 0x32, 0x00, 0xFF); + gDisplayListHead = func_8009B9D0(gDisplayListHead, &D_02001630); + gDPSetPrimColor(gDisplayListHead, 0, 0, 0x32, 0x32, 0x00, 0xFF); gDisplayListHead = func_8009B9D0(gDisplayListHead, &D_02001658); return; case 0xD6: /* switch 3 */ @@ -8861,7 +8782,7 @@ void func_8009F5E0(void *arg0) { if (arg0->unk4 != 0) { temp_a2_5 = *(&D_800EFD64 + *(&D_800E86A8 + temp_v0_6)); spA8 = temp_v0_6; - gDisplayListHead = func_8009BA74(gDisplayListHead, segmented_to_virtual(*(&D_800E7D54 + (temp_a2_5 * 4)), temp_a2_5), arg0->unkC, arg0->unk10); + gDisplayListHead = func_8009BA74(gDisplayListHead, segmented_to_virtual(*(&D_800E7D54 + (temp_a2_5 * 4))), arg0->unkC, arg0->unk10); func_8009A7EC(arg0->unk18, arg0->unkC, arg0->unk10, spA8, arg0->unk1C); func_800A11D0(arg0, spA8, 0xFF); return; @@ -9038,7 +8959,7 @@ void func_8009F5E0(void *arg0) { } spA8 = 0x12; spAC = phi_a2; - sp9C = segmented_to_virtual(*(&D_800E824C + (temp_t0 * 4)), temp_a1_4, phi_a2); + sp9C = segmented_to_virtual(*(&D_800E824C + (temp_t0 * 4))); phi_a2_2 = phi_a2; block_58: phi_a1 = spA8; @@ -9050,7 +8971,7 @@ block_58: } else { spA8 = 0x16; spAC = temp_a2_7; - sp9C = segmented_to_virtual(*(&D_800E824C + (temp_t0 * 4)), 0x16, temp_a2_7); + sp9C = segmented_to_virtual(*(&D_800E824C + (temp_t0 * 4))); phi_a2_2 = temp_a2_7; goto block_58; } @@ -9062,7 +8983,7 @@ block_58: } else { spA8 = 0x18; spAC = temp_a2_7; - sp9C = segmented_to_virtual(*(&D_800E824C + (temp_t0 * 4)), 0x18, temp_a2_7); + sp9C = segmented_to_virtual(*(&D_800E824C + (temp_t0 * 4))); phi_a2_2 = temp_a2_7; goto block_58; } @@ -9151,7 +9072,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009F5E0.s") #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 s32 func_8009BA74(s32, s32, s32, s32); // extern -s32 segmented_to_virtual(s32, s32); // extern +void *segmented_to_virtual(segment_address_t); // extern extern ? D_800E7AF8; extern s32 gDisplayListHead; @@ -9168,7 +9089,7 @@ void func_800A08D8(s32 arg0, s32 arg1, s32 arg2) { if (temp_t6 >= 0x32) { phi_a3 = 0x2B; } - gDisplayListHead = func_8009BA74(gDisplayListHead, segmented_to_virtual(*(&D_800E7AF8 + (phi_a3 * 4)), phi_a3), arg1, arg2); + gDisplayListHead = func_8009BA74(gDisplayListHead, segmented_to_virtual(*(&D_800E7AF8 + (phi_a3 * 4))), arg1, arg2); } } } @@ -9217,62 +9138,42 @@ s32 func_800A095C(s8 *arg0, s32 arg1, s32 arg2, ? arg3) { GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A095C.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *func_8009BA74(void *, ? *, ?, s32); // extern -extern ? D_0200157C; -extern s8 D_800E86D0; -extern void *gDisplayListHead; +#ifdef NON_MATCHING +// Non-matching due to the constants 9 and 0xA being saved to the wrong registers +// Same functionality, but doesn't match byte for byte :/ +Gfx *func_8009BA74(Gfx *, s32*, s32, s32); // extern +extern s32 D_0200157C; +extern s8 D_800E86D0[20]; -void func_800A09E0(void *arg0) { - s32 temp_s0; - void *temp_v1; - s32 phi_s0; - - temp_v1 = gDisplayListHead; - gDisplayListHead = temp_v1 + 8; - temp_v1->unk0 = 0xED000000; - temp_v1->unk4 = 0x4FC308; - phi_s0 = 0; - do { - if ((D_800E86D0 != 0) || ((phi_s0 != 0) && (phi_s0 != 8))) { - gDisplayListHead = func_8009BA74(gDisplayListHead, &D_0200157C, 0x20, (phi_s0 * 0xA) + arg0->unk10); +void func_800A09E0(struct_8018D9E0_entry *arg0) { + s32 table_row, x = 0x20, y; + gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, 0, 319, 194); + for(table_row = 0; table_row < 9; table_row++) + { + if ((D_800E86D0[0] != 0) || ((table_row != 0) && (table_row != 8))) + { + y = (table_row * 0xA) + arg0->row; + gDisplayListHead = func_8009BA74(gDisplayListHead, &D_0200157C, x, y); } - temp_s0 = phi_s0 + 1; - phi_s0 = temp_s0; - } while (temp_s0 != 9); + } } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A09E0.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void *func_8009BA74(void *, ? *, ?, s32); // extern -void *func_800AAEF4(?); // extern -extern ? D_02001874; -extern s8 D_800E86C0; -extern void *gDisplayListHead; -extern s8 gPlayerCountSelection2; +struct_8018D9E0_entry *func_800AAEF4(s32); // extern +extern s32 D_02001874; -void func_800A0AD0(s32 arg0) { - s8 temp_v1; - void *temp_t1; - void *temp_v1_2; - - temp_v1 = gPlayerCountSelection2; +void func_800A0AD0(struct_8018D9E0_entry *unused) { + struct_8018D9E0_entry *temp_t1; + // Find struct_8018D9E0_entry with a type/id of 0xDA temp_t1 = func_800AAEF4(0xDA); - if ((temp_v1 != 1) && (temp_v1 != 2)) { - temp_v1_2 = gDisplayListHead; - gDisplayListHead = temp_v1_2 + 8; - temp_v1_2->unk0 = 0xFA000000; - temp_v1_2->unk4 = ((temp_t1->unk20 & 0xFF) << 0x10) | 0xFF000000 | 0xFF; - gDisplayListHead = func_8009BA74(gDisplayListHead, &D_02001874, 0x24, (D_800E86C0 * 0xA) + 0x7C); + if ((gMenuState != 1) && (gMenuState != 2)) + { + gDPSetPrimColor(gDisplayListHead++, 0, 0, 0xFF, temp_t1->unk20, 0x00, 0xFF); + gDisplayListHead = func_8009BA74(gDisplayListHead, &D_02001874, 0x24, (gControllerPakSelectedTableRow * 0xA) + 0x7C); } } -#else -GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A0AD0.s") -#endif #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 @@ -9352,9 +9253,9 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A0B80.s") #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 s32 func_8009BA74(s32, s32, s32, ?); // extern -s32 segmented_to_virtual(s32); // extern +void *segmented_to_virtual(segment_address_t); // extern extern ? D_800E7D0C; -extern s32 D_8018EB80; +extern s32 gControllerPakNumPagesFree; extern s32 gDisplayListHead; void func_800A0DFC(void) { @@ -9362,7 +9263,7 @@ void func_800A0DFC(void) { s32 phi_s0; s32 phi_s1; - phi_s0 = D_8018EB80; + phi_s0 = gControllerPakNumPagesFree; phi_s1 = 0x110; do { temp_lo = phi_s0 / 0xA; @@ -9382,7 +9283,7 @@ void *func_800AAEF4(?); // extern extern ? D_0200184C; extern ? D_800E7278; extern void *gDisplayListHead; -extern s8 gPlayerCountSelection2; +extern s8 gMenuState; void func_800A0EB8(s32 arg0, s32 arg1) { s8 temp_v0; @@ -9393,14 +9294,14 @@ void func_800A0EB8(s32 arg0, s32 arg1) { temp_t3 = func_800AAEF4(0xDA); if (arg1 == 0) { - if (gPlayerCountSelection2 == 2) { + if (gMenuState == 2) { phi_t1 = 1; } else { phi_t1 = 0; } goto block_7; } - temp_v0 = gPlayerCountSelection2; + temp_v0 = gMenuState; if ((temp_v0 == 3) || (temp_v0 == 4)) { phi_t1 = ((arg1 * 2) + temp_v0) - 3; block_7: @@ -9465,7 +9366,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A10CC.s") #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 void *func_8009BA74(void *, s32, s32, s32); // extern -s32 segmented_to_virtual(s32, s32); // extern +void *segmented_to_virtual(segment_address_t); // extern extern ? D_800E74A8; extern ? D_800E82B4; extern void *gDisplayListHead; @@ -9486,7 +9387,7 @@ void func_800A11D0(void *arg0, s32 arg1, s32 arg2) { gDisplayListHead = temp_v0_2 + 8; temp_v0_2->unk0 = 0xFB000000; temp_v0_2->unk4 = (temp_a3 << 0x18) | (temp_a3 << 0x10) | (temp_a3 << 8); - gDisplayListHead = func_8009BA74(gDisplayListHead, segmented_to_virtual(*(&D_800E82B4 + (arg1 * 4)), temp_a3), arg0->unkC, arg0->unk10); + gDisplayListHead = func_8009BA74(gDisplayListHead, segmented_to_virtual(*(&D_800E82B4 + (arg1 * 4))), arg0->unkC, arg0->unk10); } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A11D0.s") @@ -9593,7 +9494,7 @@ s32 draw_box(s32, s32, s32, s32, s32, s32, s32, s32, s32); // extern s32 func_800959A0(s32, s32, s32, s32, s32); // extern s32 func_8009C204(s32, s32, s32, s32, s32); // extern s32 func_800B639C(s32); // extern -s32 segmented_to_virtual(? *, s32); // extern +void *segmented_to_virtual(segment_address_t); // extern extern ? D_02004A0C; extern ? D_800E7D74; extern ? D_800E7DC4; @@ -9613,7 +9514,7 @@ void func_800A15EC(void *arg0) { temp_v0 = arg0->unk0 - 0x7C; temp_a1 = *(&gCupCourseOrder + (((temp_v0 / 4) * 8) + ((temp_v0 % 4) * 2))) * 4; sp44 = temp_a1; - temp_v0_2 = func_8009C204(gDisplayListHead, segmented_to_virtual(*(&D_800E7D74 + temp_a1), temp_a1), arg0->unkC, arg0->unk10, 2); + temp_v0_2 = func_8009C204(gDisplayListHead, segmented_to_virtual(*(&D_800E7D74 + temp_a1)), arg0->unkC, arg0->unk10, 2); gDisplayListHead = temp_v0_2; temp_v1 = arg0->unk10; temp_s1 = arg0->unkC; @@ -9633,7 +9534,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A15EC.s") #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 void *func_8009BA74(void *, s32, s32, s32); // extern -s32 segmented_to_virtual(? *, void *, s32, s32); // extern +void *segmented_to_virtual(segment_address_t); // extern extern ? D_02001FA4; extern ? D_800E74D0; extern void *gDisplayListHead; @@ -9655,7 +9556,7 @@ void func_800A1780(void *arg0) { gDisplayListHead = temp_t0 + 8; temp_t0->unk0 = 0xFA000000; temp_t0->unk4 = ((((temp_v1->unk0 * temp_a2) + (temp_a1->unk0 * temp_v0)) / 0x100) << 0x18) | (((((temp_v1->unk2 * temp_a2) + (temp_a1->unk2 * temp_v0)) / 0x100) & 0xFF) << 0x10) | (((((temp_v1->unk4 * temp_a2) + (temp_a1->unk4 * temp_v0)) / 0x100) & 0xFF) << 8) | ((((temp_v1->unk6 * temp_a2) + (temp_a1->unk6 * temp_v0)) / 0x100) & 0xFF); - gDisplayListHead = func_8009BA74(gDisplayListHead, segmented_to_virtual(&D_02001FA4, temp_a1, temp_a2, temp_a3), arg0->unkC, arg0->unk10); + gDisplayListHead = func_8009BA74(gDisplayListHead, segmented_to_virtual(&D_02001FA4), arg0->unkC, arg0->unk10); } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A1780.s") @@ -13504,7 +13405,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A8270.s") //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 s32 func_800959A0(s32, s32, s32, s32, s32); // extern s32 func_80098C18(s32, s32, s32, s32, s32, s32, s32, s32, s32); // extern -void *segmented_to_virtual(? *, s32, void *); // extern +void *segmented_to_virtual(segment_address_t); // extern extern ? D_0200487C; extern ? D_02004B74; extern ? D_02004E80; @@ -13564,7 +13465,7 @@ block_12: sp34 = (temp_v0_4 << 5) / 0x40; sp30 = phi_a1; arg0 = temp_a3; - temp_v0_5 = segmented_to_virtual(phi_a0, phi_a1, temp_a3); + temp_v0_5 = segmented_to_virtual(phi_a0); temp_t0 = arg0->unkC + temp_v0_5->unkC; temp_a2 = arg0->unk10 + temp_v0_5->unkE; if (phi_a1 != 0) { @@ -13865,7 +13766,7 @@ s32 func_80098FC8(s32, s32, s16, s32, s32); // extern s32 func_8009BA74(s32, ?, ?, ?); // extern s32 func_8009C204(s32, s32, s32, s16, s32); // extern s32 func_800B639C(s32); // extern -s32 segmented_to_virtual(? *); // extern +void *segmented_to_virtual(segment_address_t); // extern extern ? D_02004A0C; extern ? D_800E7168; extern s8 D_8018EDEC; @@ -14178,28 +14079,24 @@ void func_800A94C8(void *arg0, s32 arg1, s32 arg2) { GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A94C8.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 extern f64 D_800F24C0; -void func_800A954C(void *arg0) { - s32 temp_t3; - +void func_800A954C(struct_8018D9E0_entry *arg0) { + // Cycle lasts 26 (0x1A) frames if (arg0->unk4 == 0) { - arg0->unk20 = (((0xC - arg0->unk1C) * 127.0f) / 12.0f) + 128.0f; + // Move highlight from yellow to red + arg0->unk20 = (s32) (u32) ((((f32) (0xC - arg0->unk1C) * 127.0f) / 12.0f) + 128.0f); } else { - arg0->unk20 = ((arg0->unk1C * D_800F24C0) / 12.0) + 128.0; + // Move highlight from red to yellow + arg0->unk20 = (s32) (u32) ((((f64) (f32) arg0->unk1C * D_800F24C0) / 12.0) + 128.0); } - temp_t3 = arg0->unk1C + 1; - arg0->unk1C = temp_t3; - if (temp_t3 >= 0xC) { + arg0->unk1C++; + if (arg0->unk1C >= 0xC) { + // Every 13 (0xC) frames reverse direction arg0->unk1C = 0; - arg0->unk4 = arg0->unk4 ^ 1; + arg0->unk4 ^= 1; } } -#else -GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A954C.s") -#endif #ifdef MIPS_TO_C //generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 @@ -14210,8 +14107,7 @@ void func_800A9710(void *arg0) { s8 temp_t6; s32 phi_v0; - temp_t6 = gPlayerCountSelection2; - switch (temp_t6) { + switch (gMenuState) { case 3: case 4: phi_v0 = 1; @@ -14870,11 +14766,11 @@ block_22: arg0->unk4 = 3; return; } - if (osPfsFreeBlocks(&D_8018E868, &D_8018EB80) != 0) { + if (osPfsFreeBlocks(&D_8018E868, &gControllerPakNumPagesFree) != 0) { arg0->unk4 = 3; return; } - D_8018EB80 = D_8018EB80 >> 8; + gControllerPakNumPagesFree = gControllerPakNumPagesFree >> 8; goto block_32; } block_32: @@ -14882,7 +14778,7 @@ block_32: arg0->unk4 = 5; return; } - if (D_8018EB80 >= 0x79) { + if (gControllerPakNumPagesFree >= 0x79) { arg0->unk4 = 1; return; } @@ -14952,19 +14848,19 @@ void func_800AA69C(void *arg0) { case 0: if ((*(&D_8018EDE8 + temp_v0) != 0) && (phi_a0 != 0)) { arg0->unk8 = 1; - func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E8380 + (temp_a1 * 4)), temp_a1)); + func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E8380 + (temp_a1 * 4)))); return; } sp30 = temp_a1; temp_v0_2 = random_int(0xC8, temp_a1); if (temp_v0_2 >= 0xC6) { arg0->unk8 = 4; - func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E83E0 + (temp_a1 * 4)), temp_a1)); + func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E83E0 + (temp_a1 * 4)))); return; } if (temp_v0_2 >= 0xC5) { arg0->unk8 = 5; - func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E8400 + (temp_a1 * 4)), temp_a1)); + func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E8400 + (temp_a1 * 4)))); return; } default: @@ -14973,14 +14869,14 @@ void func_800AA69C(void *arg0) { temp_v1_2 = temp_a1 * 4; if (*(&D_8018DEE4 + (arg0->unk18 * 0x18)) >= *(&D_800E8440 + temp_v1_2)) { arg0->unk8 = 2; - func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E83A0 + temp_v1_2), temp_a1)); + func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E83A0 + temp_v1_2))); return; } if ((*(&D_8018EDE8 + temp_v0) == 0) && (phi_a0 != 0)) { arg0->unk8 = 3; sp24 = temp_v1_2; temp_a0_2 = arg0->unk18; - func_8009A594(temp_a0_2, *(&D_800E8460 + temp_v1_2) - *(&D_8018DEE4 + (temp_a0_2 * 0x18)), segmented_to_virtual_dupe(*(&D_800E83C0 + temp_v1_2), temp_a1)); + func_8009A594(temp_a0_2, *(&D_800E8460 + temp_v1_2) - *(&D_8018DEE4 + (temp_a0_2 * 0x18)), segmented_to_virtual_dupe(*(&D_800E83C0 + temp_v1_2))); return; } /* Duplicate return node #33. Try simplifying control flow for better match */ @@ -14988,7 +14884,7 @@ void func_800AA69C(void *arg0) { case 2: if ((*(&D_8018EDE8 + temp_v0) == 0) && (phi_a0 != 0)) { arg0->unk8 = 3; - func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E83C0 + (temp_a1 * 4)), temp_a1)); + func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E83C0 + (temp_a1 * 4)))); return; } /* Duplicate return node #33. Try simplifying control flow for better match */ @@ -14998,14 +14894,14 @@ void func_800AA69C(void *arg0) { temp_a3 = temp_v1_3 + &D_800E8460; if (*(&D_8018DEE4 + (arg0->unk18 * 0x18)) >= *temp_a3) { arg0->unk8 = 0; - func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E8360 + temp_v1_3), temp_a1)); + func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E8360 + temp_v1_3))); return; } if ((*(&D_8018EDE8 + temp_v0) != 0) && (phi_a0 != 0)) { arg0->unk8 = 1; sp20 = temp_a3; temp_a0_3 = arg0->unk18; - func_8009A594(temp_a0_3, *temp_a3 - *(&D_8018DEE4 + (temp_a0_3 * 0x18)), segmented_to_virtual_dupe(*(&D_800E8380 + temp_v1_3), temp_a1), temp_a3); + func_8009A594(temp_a0_3, *temp_a3 - *(&D_8018DEE4 + (temp_a0_3 * 0x18)), segmented_to_virtual_dupe(*(&D_800E8380 + temp_v1_3)), temp_a3); return; } /* Duplicate return node #33. Try simplifying control flow for better match */ @@ -15014,7 +14910,7 @@ void func_800AA69C(void *arg0) { case 5: if ((*(&D_8018EDE8 + temp_v0) != 0) && (phi_a0 != 0)) { arg0->unk8 = 1; - func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E8380 + (temp_a1 * 4)), temp_a1)); + func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E8380 + (temp_a1 * 4)))); return; } if (temp_v1 == 4) { @@ -15028,7 +14924,7 @@ void func_800AA69C(void *arg0) { } if (*(&D_8018DEE4 + (arg0->unk18 * 0x18)) >= phi_v0) { arg0->unk8 = 0; - func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E8360 + phi_v1), temp_a1)); + func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E8360 + phi_v1))); } /* Duplicate return node #33. Try simplifying control flow for better match */ return; @@ -15179,7 +15075,7 @@ void func_800AAC18(void *arg0) { temp_a3_2->unk8 = 2; temp_a3_2->unk10 = temp_t0->unk2; arg0 = temp_a3_2; - func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E8340 + (temp_a1 * 4)), temp_a1, 2, temp_a3_2), arg0); + func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E8340 + (temp_a1 * 4))), arg0); return; } default: @@ -15556,7 +15452,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AB260.s") #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 ? func_8009A594(s32, ?, s32, void *); // extern -s32 segmented_to_virtual_dupe(s32, void *); // extern +void *segmented_to_virtual_dupe(segment_address_t); // extern extern ? D_800E7E34; extern s8 gCupSelection; extern ? gCupCourseOrder; @@ -15572,7 +15468,7 @@ void func_800AB290(void *arg0) { arg0->unk1C = temp_v0; temp_t2 = *(&gCupCourseOrder - 0xBE + ((gCupSelection * 8) + (arg0->unk0 * 2))); arg0 = temp_a3; - func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E7E34 + (temp_t2 * 4)), temp_a3), arg0); + func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E7E34 + (temp_t2 * 4))), arg0); } } #else @@ -15841,7 +15737,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AB904.s") ? func_8009A594(s32, ?, s32); // extern ? func_800A91D8(void *, s16, s16); // extern s32 func_800B54C0(s8, s32); // extern -s32 segmented_to_virtual_dupe(s32); // extern +void *segmented_to_virtual_dupe(segment_address_t); // extern extern ? D_800E7268; extern ? D_800E7E20; extern s8 D_8018EDEC; @@ -16829,7 +16725,7 @@ block_11: } if ((phi_v1 == 0) && (temp_t7_2 = arg0->unk20 + 1, arg0->unk20 = temp_t7_2, ((temp_t7_2 < 0x1F) == 0)) && (sp34 = temp_a1, sp38 = temp_a2, ((func_800AAEF4(0xB0, temp_a1, temp_a2)->unk4 < 2) == 0))) { sp38 = temp_a2; - func_8009A640(arg0->unk18, 0, temp_a2, segmented_to_virtual_dupe(*(&D_800E8380 + (temp_a1 * 4)), temp_a1, temp_a2)); + func_8009A640(arg0->unk18, 0, temp_a2, segmented_to_virtual_dupe(*(&D_800E8380 + (temp_a1 * 4)))); arg0->unk4 = 3; temp_a0 = temp_a2 & 0xFF; sp24 = temp_a0; @@ -16843,7 +16739,7 @@ block_11: temp_v0_4 = temp_a1 * 4; if (*(&D_8018DEE4 + (arg0->unk18 * 0x18)) >= *(&D_800E8440 + temp_v0_4)) { sp38 = temp_a2; - func_8009A640(arg0->unk18, 0, temp_a2, segmented_to_virtual_dupe(*(&D_800E83A0 + temp_v0_4), temp_a1, temp_a2)); + func_8009A640(arg0->unk18, 0, temp_a2, segmented_to_virtual_dupe(*(&D_800E83A0 + temp_v0_4))); arg0->unk4 = 4; } /* Duplicate return node #18. Try simplifying control flow for better match */ @@ -16938,7 +16834,7 @@ extern s8 D_8018D9D8; extern ? D_8018E868; extern s32 D_8018EB78; extern s32 D_8018EB7C; -extern s32 D_8018EB80; +extern s32 gControllerPakNumPagesFree; extern ? D_8018EB84; extern s8 D_8018EDF5; static u16 D_800E86F0; /* type too large by 2; unable to generate initializer; const */ @@ -17148,7 +17044,7 @@ block_56: play_sound2(0x4900FF07); return; } - if (D_8018EB80 >= 0x79) { + if (gControllerPakNumPagesFree >= 0x79) { arg0->unk4 = 0x13; arg0->unk1C = 0; play_sound2(0x49008001); @@ -17797,7 +17693,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AEC54.s") ? func_8009A594(s32, ?, s32, void *); // extern s32 func_800B5B94(); // extern ? func_800B6708(); // extern -s32 segmented_to_virtual_dupe(s32, void *); // extern +void *segmented_to_virtual_dupe(segment_address_t); // extern extern ? D_800E7E34; extern s8 D_8018EDF7; extern ? D_8018EE10; @@ -17814,7 +17710,7 @@ void func_800AEDBC(void *arg0) { arg0->unk1C = temp_v0; temp_v0_2 = D_8018EDF7; arg0 = temp_a3; - func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E7E34 + (*(&gCupCourseOrder + (((temp_v0_2 / 4) * 8) + ((temp_v0_2 % 4) * 2))) * 4)), temp_a3), arg0); + func_8009A594(arg0->unk18, 0, segmented_to_virtual_dupe(*(&D_800E7E34 + (*(&gCupCourseOrder + (((temp_v0_2 / 4) * 8) + ((temp_v0_2 % 4) * 2))) * 4))), arg0); if (func_800B5B94() == 0) { func_800B6708(); return; @@ -18050,7 +17946,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AF1AC.s") ? func_800C90F4(?, s32); /* extern */ ? func_800CA0A0(); /* extern */ ? func_800CA0B8(? *, ? *); /* extern */ -s32 segmented_to_virtual_dupe(s32, ? *); /* extern */ +void *segmented_to_virtual_dupe(segment_address_t); /* extern */ extern ? D_8018DEE4; extern ? D_802874D8; static ? D_800E7458; /* unable to generate initializer; const */ @@ -18107,7 +18003,7 @@ void func_800AF270(void *arg0) { return; } arg0->unk4 = 3; - func_8009A640(arg0->unk18, 0, sp30, segmented_to_virtual_dupe(*(&D_800E8380 + (temp_v0 * 4)), &D_802874D8)); + func_8009A640(arg0->unk18, 0, sp30, segmented_to_virtual_dupe(*(&D_800E8380 + (temp_v0 * 4)))); func_800CA0B8(); func_800C90F4(0, (sp30 * 0x10) + 0x29008007); func_800CA0A0(); @@ -18118,7 +18014,7 @@ void func_800AF270(void *arg0) { case 3: temp_v1_2 = temp_v0 * 4; if (*(&D_8018DEE4 + (arg0->unk18 * 0x18)) >= *(&D_800E8440 + temp_v1_2)) { - func_8009A640(arg0->unk18, 0, sp30, segmented_to_virtual_dupe(*(&D_800E83A0 + temp_v1_2), &D_802874D8)); + func_8009A640(arg0->unk18, 0, sp30, segmented_to_virtual_dupe(*(&D_800E83A0 + temp_v1_2))); arg0->unk4 = 4; } /* Duplicate return node #12. Try simplifying control flow for better match */ diff --git a/src/code_800AF9B0.c b/src/code_800AF9B0.c index 2570b3d62..1a57d8700 100644 --- a/src/code_800AF9B0.c +++ b/src/code_800AF9B0.c @@ -1449,16 +1449,16 @@ void func_800B1C90(void *arg0, s32 arg1) { sp36 = arg0->unk6 | arg0->unkC; if (func_800B4520() == 0) { - temp_t9 = gPlayerCountSelection2; + temp_t9 = gMenuState; switch (temp_t9) { case 1: if ((sp36 & 0x9000) != 0) { - gPlayerCountSelection2 = 5; + gMenuState = 5; play_sound2(0x49008001); return; } if ((sp36 & 0x300) != 0) { - gPlayerCountSelection2 = 2; + gMenuState = 2; play_sound2(0x49008000); return; } @@ -1472,7 +1472,7 @@ void func_800B1C90(void *arg0, s32 arg1) { return; } if ((sp36 & 0x300) != 0) { - gPlayerCountSelection2 = 1; + gMenuState = 1; play_sound2(0x49008000); return; } @@ -1480,8 +1480,8 @@ void func_800B1C90(void *arg0, s32 arg1) { return; case 5: if ((sp36 & 0x9000) != 0) { - if (*(&D_8018EB38 + ((*(&D_800E86C6 + D_800E86C0) - 1) * 4)) == 0) { - gPlayerCountSelection2 = 4; + if (*(&D_8018EB38 + ((*(&D_800E86C6 + gControllerPakSelectedTableRow) - 1) * 4)) == 0) { + gMenuState = 4; play_sound2(0x49008001); return; } @@ -1490,7 +1490,7 @@ void func_800B1C90(void *arg0, s32 arg1) { } if ((sp36 & 0x4000) != 0) { if (*D_800E86D0 == 0) { - gPlayerCountSelection2 = 1; + gMenuState = 1; play_sound2(0x49008002); return; } @@ -1499,10 +1499,10 @@ void func_800B1C90(void *arg0, s32 arg1) { } if ((sp36 & 0x800) != 0) { if (*D_800E86D0 == 0) { - D_800E86C0 += -1; - if (D_800E86C0 < 0) { - D_800E86C0 = 0; - if (*(&D_800E86C6 + D_800E86C0) != 1) { + gControllerPakSelectedTableRow += -1; + if (gControllerPakSelectedTableRow < 0) { + gControllerPakSelectedTableRow = 0; + if (*(&D_800E86C6 + gControllerPakSelectedTableRow) != 1) { *D_800E86D0 = 2; play_sound2(0x49008000); return; @@ -1517,10 +1517,10 @@ void func_800B1C90(void *arg0, s32 arg1) { return; } if (((sp36 & 0x400) != 0) && (*D_800E86D0 == 0)) { - D_800E86C0 += 1; - if (D_800E86C0 >= 5) { - D_800E86C0 = 4; - if (*(&D_800E86C6 + D_800E86C0) != 0x10) { + gControllerPakSelectedTableRow += 1; + if (gControllerPakSelectedTableRow >= 5) { + gControllerPakSelectedTableRow = 4; + if (*(&D_800E86C6 + gControllerPakSelectedTableRow) != 0x10) { *D_800E86D0 = 1; play_sound2(0x49008000); return; @@ -1535,12 +1535,12 @@ void func_800B1C90(void *arg0, s32 arg1) { return; case 4: if ((sp36 & 0xD000) != 0) { - gPlayerCountSelection2 = 5; + gMenuState = 5; play_sound2(0x49008002); return; } if ((sp36 & 0x300) != 0) { - gPlayerCountSelection2 = 3; + gMenuState = 3; play_sound2(0x49008000); return; } @@ -1548,27 +1548,27 @@ void func_800B1C90(void *arg0, s32 arg1) { return; case 3: if ((sp36 & 0x9000) != 0) { - gPlayerCountSelection2 = 6; + gMenuState = 6; play_sound2(0x49008001); return; } if ((sp36 & 0x4000) != 0) { - gPlayerCountSelection2 = 5; + gMenuState = 5; play_sound2(0x49008002); return; } if ((sp36 & 0x300) != 0) { - gPlayerCountSelection2 = 4; + gMenuState = 4; play_sound2(0x49008000); return; } /* Duplicate return node #49. Try simplifying control flow for better match */ return; case 6: - gPlayerCountSelection2 = 7; + gMenuState = 7; return; case 7: - temp_t0 = *(&D_800E86C6 + D_800E86C0) - 1; + temp_t0 = *(&D_800E86C6 + gControllerPakSelectedTableRow) - 1; temp_v1 = (temp_t0 << 5) + &D_8018E938; sp20 = temp_v1; sp2C = temp_t0; @@ -1576,24 +1576,24 @@ void func_800B1C90(void *arg0, s32 arg1) { if (temp_v0 != 0) { if (temp_v0 != 1) { if (temp_v0 != 2) { - gPlayerCountSelection2 = 8; + gMenuState = 8; return; } - gPlayerCountSelection2 = 0xA; + gMenuState = 0xA; return; } - gPlayerCountSelection2 = 9; + gMenuState = 9; return; } *(&D_8018EB38 + (temp_t0 * 4)) = -1; - D_8018EB80 = D_8018EB80 + (((temp_v1->unk0 + 0xFF) >> 8) & 0xFF); - gPlayerCountSelection2 = 5; + gControllerPakNumPagesFree = gControllerPakNumPagesFree + (((temp_v1->unk0 + 0xFF) >> 8) & 0xFF); + gMenuState = 5; return; case 8: case 9: case 10: if ((sp36 & 0x9000) != 0) { - gPlayerCountSelection2 = 5; + gMenuState = 5; } /* Duplicate return node #49. Try simplifying control flow for better match */ return; @@ -2609,7 +2609,7 @@ void func_800B3F74(u32 arg0) { func_800CA008(0, 0); break; case CONTROLLER_PAK_MENU: - gPlayerCountSelection2 = 1; + gMenuState = 1; func_800CA008(0, 0); break; case START_MENU_FROM_QUIT: @@ -3841,7 +3841,7 @@ extern u8 D_800F2E74; extern OSPfs D_8018E868; extern s32 D_8018EB78; extern s32 D_8018EB7C; -extern s32 D_8018EB80; +extern s32 gControllerPakNumPagesFree; extern s32 D_8018EB84; extern ? gSIEventMesgQueue; @@ -3902,10 +3902,10 @@ block_17: if (osPfsNumFiles(&D_8018E868, &D_8018EB78, &D_8018EB7C) != 0) { return 2; } - if (osPfsFreeBlocks(&D_8018E868, &D_8018EB80) != 0) { + if (osPfsFreeBlocks(&D_8018E868, &gControllerPakNumPagesFree) != 0) { return 2; } - D_8018EB80 = D_8018EB80 >> 8; + gControllerPakNumPagesFree = gControllerPakNumPagesFree >> 8; goto block_27; } block_27: @@ -3913,7 +3913,7 @@ block_27: return 4; } phi_v0_2 = 4; - if (D_8018EB80 >= 0x79) { + if (gControllerPakNumPagesFree >= 0x79) { phi_v0_2 = -1; } return phi_v0_2; @@ -4015,7 +4015,7 @@ extern s8 D_800E86F8; extern OSPfs D_8018E868; extern s32 D_8018EB78; extern s32 D_8018EB7C; -extern s32 D_8018EB80; +extern s32 gControllerPakNumPagesFree; extern ? gSIEventMesgQueue; s32 func_800B5F30(void) { @@ -4030,11 +4030,11 @@ s32 func_800B5F30(void) { D_800E86F8 = 0; return -2; } - if (osPfsFreeBlocks(&D_8018E868, &D_8018EB80) != 0) { + if (osPfsFreeBlocks(&D_8018E868, &gControllerPakNumPagesFree) != 0) { D_800E86F8 = 0; return -3; } - D_8018EB80 = D_8018EB80 >> 8; + gControllerPakNumPagesFree = gControllerPakNumPagesFree >> 8; if (sp1C == 0) { D_800E86F8 = 1; }