From bef2f72bb4491fcc9525acaff4d05d6ff381263e Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Tue, 31 Dec 2019 10:13:14 +1000 Subject: [PATCH] Decompile optionsGetUnk45 and optionsGetUnk46 --- src/game/game_015470.c | 4 ++-- src/game/game_0b28d0.c | 16 ++++++++-------- src/game/game_0c79f0.c | 4 ++-- src/game/game_0cf150.c | 4 ++-- src/game/game_0d1fe0.c | 2 +- src/game/game_0f09f0.c | 4 ++-- src/game/game_129900.c | 2 +- src/game/game_152710.c | 28 ++++++++-------------------- src/include/game/game_152710.h | 4 ++-- src/include/types.h | 4 ++-- 10 files changed, 30 insertions(+), 42 deletions(-) diff --git a/src/game/game_015470.c b/src/game/game_015470.c index 5ba6fa832..fa4fe88e2 100644 --- a/src/game/game_015470.c +++ b/src/game/game_015470.c @@ -6751,7 +6751,7 @@ glabel func0f01b160 /* f01b308: 3c0f800a */ lui $t7,0x800a /* f01b30c: 8defa248 */ lw $t7,-0x5db8($t7) /* f01b310: afa200d4 */ sw $v0,0xd4($sp) -/* f01b314: 0fc549d2 */ jal func0f152748 +/* f01b314: 0fc549d2 */ jal optionsGetUnk45 /* f01b318: 8de40070 */ lw $a0,0x70($t7) /* f01b31c: 0c005207 */ jal func0001481c /* f01b320: a3a200d3 */ sb $v0,0xd3($sp) @@ -6922,7 +6922,7 @@ glabel func0f01b160 /* f01b568: 00000000 */ sll $zero,$zero,0x0 .L0f01b56c: /* f01b56c: 8d4aa248 */ lw $t2,-0x5db8($t2) -/* f01b570: 0fc549d9 */ jal func0f152764 +/* f01b570: 0fc549d9 */ jal optionsGetUnk46 /* f01b574: 8d440070 */ lw $a0,0x70($t2) /* f01b578: 00028600 */ sll $s0,$v0,0x18 /* f01b57c: 00022e00 */ sll $a1,$v0,0x18 diff --git a/src/game/game_0b28d0.c b/src/game/game_0b28d0.c index b81ab9e88..f2c7af988 100644 --- a/src/game/game_0b28d0.c +++ b/src/game/game_0b28d0.c @@ -8950,7 +8950,7 @@ glabel func0f0ba29c /* f0ba2c0: 26739fc0 */ addiu $s3,$s3,%lo(g_Vars) /* f0ba2c4: 8e6e0288 */ lw $t6,0x288($s3) /* f0ba2c8: e7a00118 */ swc1 $f0,0x118($sp) -/* f0ba2cc: 0fc549d2 */ jal func0f152748 +/* f0ba2cc: 0fc549d2 */ jal optionsGetUnk45 /* f0ba2d0: 8dc40070 */ lw $a0,0x70($t6) /* f0ba2d4: 00022600 */ sll $a0,$v0,0x18 /* f0ba2d8: 00047e03 */ sra $t7,$a0,0x18 @@ -13027,7 +13027,7 @@ glabel func0f0bd904 /* f0bdd8c: 51a00022 */ beqzl $t5,.L0f0bde18 /* f0bdd90: 8e6c0034 */ lw $t4,0x34($s3) /* f0bdd94: 8e6e0288 */ lw $t6,0x288($s3) -/* f0bdd98: 0fc549d2 */ jal func0f152748 +/* f0bdd98: 0fc549d2 */ jal optionsGetUnk45 /* f0bdd9c: 8dc40070 */ lw $a0,0x70($t6) /* f0bdda0: 8fb80330 */ lw $t8,0x330($sp) /* f0bdda4: 00022600 */ sll $a0,$v0,0x18 @@ -13502,13 +13502,13 @@ glabel func0f0bd904 /* f0be47c: 8d240070 */ lw $a0,0x70($t1) /* f0be480: 8e6a0288 */ lw $t2,0x288($s3) /* f0be484: 00408025 */ or $s0,$v0,$zero -/* f0be488: 0fc549d2 */ jal func0f152748 +/* f0be488: 0fc549d2 */ jal optionsGetUnk45 /* f0be48c: 8d440070 */ lw $a0,0x70($t2) /* f0be490: 8e6d0288 */ lw $t5,0x288($s3) /* f0be494: 00029600 */ sll $s2,$v0,0x18 /* f0be498: 00125e03 */ sra $t3,$s2,0x18 /* f0be49c: 01609025 */ or $s2,$t3,$zero -/* f0be4a0: 0fc549d9 */ jal func0f152764 +/* f0be4a0: 0fc549d9 */ jal optionsGetUnk46 /* f0be4a4: 8da40070 */ lw $a0,0x70($t5) /* f0be4a8: 0002ae00 */ sll $s5,$v0,0x18 /* f0be4ac: 00156603 */ sra $t4,$s5,0x18 @@ -14925,7 +14925,7 @@ glabel func0f0bd904 /* f0bf950: 13000047 */ beqz $t8,.L0f0bfa70 /* f0bf954: 00000000 */ sll $zero,$zero,0x0 /* f0bf958: 8e6a0288 */ lw $t2,0x288($s3) -/* f0bf95c: 0fc549d2 */ jal func0f152748 +/* f0bf95c: 0fc549d2 */ jal optionsGetUnk45 /* f0bf960: 8d440070 */ lw $a0,0x70($t2) /* f0bf964: 00028600 */ sll $s0,$v0,0x18 /* f0bf968: 00105e03 */ sra $t3,$s0,0x18 @@ -16309,7 +16309,7 @@ glabel func0f0c07c8 /* f0c0d78: 572c0014 */ bnel $t9,$t4,.L0f0c0dcc /* f0c0d7c: 8e190298 */ lw $t9,0x298($s0) /* f0c0d80: 8e0e0288 */ lw $t6,0x288($s0) -/* f0c0d84: 0fc549d2 */ jal func0f152748 +/* f0c0d84: 0fc549d2 */ jal optionsGetUnk45 /* f0c0d88: 8dc40070 */ lw $a0,0x70($t6) /* f0c0d8c: 00022600 */ sll $a0,$v0,0x18 /* f0c0d90: 00047e03 */ sra $t7,$a0,0x18 @@ -16342,7 +16342,7 @@ glabel func0f0c07c8 .L0f0c0df8: /* f0c0df8: 8e190288 */ lw $t9,0x288($s0) /* f0c0dfc: afb80078 */ sw $t8,0x78($sp) -/* f0c0e00: 0fc549d2 */ jal func0f152748 +/* f0c0e00: 0fc549d2 */ jal optionsGetUnk45 /* f0c0e04: 8f240070 */ lw $a0,0x70($t9) /* f0c0e08: 00022600 */ sll $a0,$v0,0x18 /* f0c0e0c: 00046603 */ sra $t4,$a0,0x18 @@ -16551,7 +16551,7 @@ glabel func0f0c07c8 /* f0c10f4: 8e0f0288 */ lw $t7,0x288($s0) .L0f0c10f8: /* f0c10f8: 8de40070 */ lw $a0,0x70($t7) -/* f0c10fc: 0fc549d2 */ jal func0f152748 +/* f0c10fc: 0fc549d2 */ jal optionsGetUnk45 /* f0c1100: afaa0088 */ sw $t2,0x88($sp) /* f0c1104: 00022600 */ sll $a0,$v0,0x18 /* f0c1108: 00046e03 */ sra $t5,$a0,0x18 diff --git a/src/game/game_0c79f0.c b/src/game/game_0c79f0.c index 046e01b97..d648ffbbe 100644 --- a/src/game/game_0c79f0.c +++ b/src/game/game_0c79f0.c @@ -1456,7 +1456,7 @@ glabel func0f0c8b90 /* f0c8bf4: 24050001 */ addiu $a1,$zero,0x1 /* f0c8bf8: 8e4f0288 */ lw $t7,0x288($s2) /* f0c8bfc: afa201a8 */ sw $v0,0x1a8($sp) -/* f0c8c00: 0fc549d2 */ jal func0f152748 +/* f0c8c00: 0fc549d2 */ jal optionsGetUnk45 /* f0c8c04: 8de40070 */ lw $a0,0x70($t7) /* f0c8c08: 0002ae00 */ sll $s5,$v0,0x18 /* f0c8c0c: 0015c603 */ sra $t8,$s5,0x18 @@ -1688,7 +1688,7 @@ glabel func0f0c8b90 /* f0c8f34: 24010002 */ addiu $at,$zero,0x2 .L0f0c8f38: /* f0c8f38: 8e4d0288 */ lw $t5,0x288($s2) -/* f0c8f3c: 0fc549d9 */ jal func0f152764 +/* f0c8f3c: 0fc549d9 */ jal optionsGetUnk46 /* f0c8f40: 8da40070 */ lw $a0,0x70($t5) /* f0c8f44: 0002a600 */ sll $s4,$v0,0x18 /* f0c8f48: 00022600 */ sll $a0,$v0,0x18 diff --git a/src/game/game_0cf150.c b/src/game/game_0cf150.c index 301701b24..60801e2a8 100644 --- a/src/game/game_0cf150.c +++ b/src/game/game_0cf150.c @@ -1708,7 +1708,7 @@ glabel func0f0d0928 /* f0d0954: 8f190004 */ lw $t9,0x4($t8) /* f0d0958: e7a400e0 */ swc1 $f4,0xe0($sp) /* f0d095c: afb900e4 */ sw $t9,0xe4($sp) -/* f0d0960: 0fc549d2 */ jal func0f152748 +/* f0d0960: 0fc549d2 */ jal optionsGetUnk45 /* f0d0964: 8dc40070 */ lw $a0,0x70($t6) /* f0d0968: 00022600 */ sll $a0,$v0,0x18 /* f0d096c: 00047e03 */ sra $t7,$a0,0x18 @@ -1769,7 +1769,7 @@ glabel func0f0d0928 /* f0d0a40: a3bf00c2 */ sb $ra,0xc2($sp) /* f0d0a44: afa200b0 */ sw $v0,0xb0($sp) /* f0d0a48: a7a800bc */ sh $t0,0xbc($sp) -/* f0d0a4c: 0fc549d9 */ jal func0f152764 +/* f0d0a4c: 0fc549d9 */ jal optionsGetUnk46 /* f0d0a50: a3a700c0 */ sb $a3,0xc0($sp) /* f0d0a54: 00021e00 */ sll $v1,$v0,0x18 /* f0d0a58: 00037e03 */ sra $t7,$v1,0x18 diff --git a/src/game/game_0d1fe0.c b/src/game/game_0d1fe0.c index 7d513c965..9efa0a79c 100644 --- a/src/game/game_0d1fe0.c +++ b/src/game/game_0d1fe0.c @@ -523,7 +523,7 @@ glabel func0f0d26ac /* f0d26c8: 8c590288 */ lw $t9,0x288($v0) /* f0d26cc: 8df80004 */ lw $t8,0x4($t7) /* f0d26d0: afb8005c */ sw $t8,0x5c($sp) -/* f0d26d4: 0fc549d2 */ jal func0f152748 +/* f0d26d4: 0fc549d2 */ jal optionsGetUnk45 /* f0d26d8: 8f240070 */ lw $a0,0x70($t9) /* f0d26dc: 3c08800a */ lui $t0,0x800a /* f0d26e0: 8d08a248 */ lw $t0,-0x5db8($t0) diff --git a/src/game/game_0f09f0.c b/src/game/game_0f09f0.c index 24a5fa18e..86b1c9f03 100644 --- a/src/game/game_0f09f0.c +++ b/src/game/game_0f09f0.c @@ -7984,7 +7984,7 @@ glabel func0f0f74a8 /* f0f7500: 3c09800a */ lui $t1,0x800a /* f0f7504: 8d29a248 */ lw $t1,-0x5db8($t1) /* f0f7508: 8d240070 */ lw $a0,0x70($t1) -/* f0f750c: 0fc549d2 */ jal func0f152748 +/* f0f750c: 0fc549d2 */ jal optionsGetUnk45 /* f0f7510: afa60018 */ sw $a2,0x18($sp) /* f0f7514: 8fa60018 */ lw $a2,0x18($sp) /* f0f7518: 3c03800a */ lui $v1,%hi(g_Vars) @@ -8011,7 +8011,7 @@ glabel func0f0f74a8 /* f0f756c: 8fbf0014 */ lw $ra,0x14($sp) .L0f0f7570: /* f0f7570: 8dcea248 */ lw $t6,-0x5db8($t6) -/* f0f7574: 0fc549d9 */ jal func0f152764 +/* f0f7574: 0fc549d9 */ jal optionsGetUnk46 /* f0f7578: 8dc40070 */ lw $a0,0x70($t6) /* f0f757c: 8faf001c */ lw $t7,0x1c($sp) /* f0f7580: a1e20000 */ sb $v0,0x0($t7) diff --git a/src/game/game_129900.c b/src/game/game_129900.c index 32603a1f1..03bf864f3 100644 --- a/src/game/game_129900.c +++ b/src/game/game_129900.c @@ -31289,7 +31289,7 @@ glabel func0f143888 /* f14518c: 00402025 */ or $a0,$v0,$zero /* f145190: 8ed90288 */ lw $t9,0x288($s6) /* f145194: 0040a825 */ or $s5,$v0,$zero -/* f145198: 0fc549d2 */ jal func0f152748 +/* f145198: 0fc549d2 */ jal optionsGetUnk45 /* f14519c: 8f240070 */ lw $a0,0x70($t9) /* f1451a0: 00028600 */ sll $s0,$v0,0x18 /* f1451a4: 00022600 */ sll $a0,$v0,0x18 diff --git a/src/game/game_152710.c b/src/game/game_152710.c index ef1334b62..91e4972b2 100644 --- a/src/game/game_152710.c +++ b/src/game/game_152710.c @@ -17,27 +17,15 @@ void optionsSetControlMode(s32 optionsindex, s32 mode) g_Options[optionsindex].controlmode = mode; } -GLOBAL_ASM( -glabel func0f152748 -/* f152748: 00047080 */ sll $t6,$a0,0x2 -/* f15274c: 01c47021 */ addu $t6,$t6,$a0 -/* f152750: 000e7140 */ sll $t6,$t6,0x5 -/* f152754: 3c02800b */ lui $v0,0x800b -/* f152758: 004e1021 */ addu $v0,$v0,$t6 -/* f15275c: 03e00008 */ jr $ra -/* f152760: 8042c7fd */ lb $v0,-0x3803($v0) -); +s32 optionsGetUnk45(s32 optionsindex) +{ + return g_Options[optionsindex].unk45; +} -GLOBAL_ASM( -glabel func0f152764 -/* f152764: 00047080 */ sll $t6,$a0,0x2 -/* f152768: 01c47021 */ addu $t6,$t6,$a0 -/* f15276c: 000e7140 */ sll $t6,$t6,0x5 -/* f152770: 3c02800b */ lui $v0,0x800b -/* f152774: 004e1021 */ addu $v0,$v0,$t6 -/* f152778: 03e00008 */ jr $ra -/* f15277c: 8042c7fe */ lb $v0,-0x3802($v0) -); +s32 optionsGetUnk46(s32 optionsindex) +{ + return g_Options[optionsindex].unk46; +} s32 optionsGetForwardPitch(s32 optionsindex) { diff --git a/src/include/game/game_152710.h b/src/include/game/game_152710.h index 630b65ec0..05bde4d81 100644 --- a/src/include/game/game_152710.h +++ b/src/include/game/game_152710.h @@ -5,8 +5,8 @@ s32 optionsGetControlMode(s32 optionsindex); void optionsSetControlMode(s32 optionsindex, s32 mode); -u32 func0f152748(void); -u32 func0f152764(void); +s32 optionsGetUnk45(s32 optionsindex); +s32 optionsGetUnk46(s32 optionsindex); s32 optionsGetForwardPitch(s32 optionsindex); s32 optionsGetAutoAim(s32 optionsindex); s32 optionsGetLookAhead(s32 optionsindex); diff --git a/src/include/types.h b/src/include/types.h index 71833d2e9..e22a9cd17 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -3953,8 +3953,8 @@ struct options { /*0x3c*/ u32 unk3c; /*0x40*/ u32 unk40; /*0x44*/ u8 controlmode; - /*0x45*/ u8 unk45; - /*0x46*/ u8 unk46; + /*0x45*/ s8 unk45; + /*0x46*/ s8 unk46; /*0x47*/ u8 unk47; /*0x48*/ u16 booleans; /*0x4c*/ u32 unk4c;