From 81bd0dbfb4dc87c857b28773a205820b68865f8e Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Wed, 26 Feb 2020 17:58:40 +1000 Subject: [PATCH] Decompile activemenuClose --- src/game/game_01b0a0.c | 8 +++--- src/game/game_0fd660.c | 49 +++++++++------------------------- src/include/game/game_0fd660.h | 4 +-- src/include/types.h | 13 ++++++++- 4 files changed, 30 insertions(+), 44 deletions(-) diff --git a/src/game/game_01b0a0.c b/src/game/game_01b0a0.c index a58e7f7f7..8c8d86a4f 100644 --- a/src/game/game_01b0a0.c +++ b/src/game/game_01b0a0.c @@ -644,7 +644,7 @@ glabel func0f01b160 /* f01b8ec: 15c00005 */ bnez $t6,.L0f01b904 /* f01b8f0: 00000000 */ sll $zero,$zero,0x0 .L0f01b8f4: -/* f01b8f4: 0fc3fc10 */ jal func0f0ff040 +/* f01b8f4: 0fc3fc10 */ jal activemenuClose /* f01b8f8: 00000000 */ sll $zero,$zero,0x0 /* f01b8fc: 100000c1 */ beqz $zero,.L0f01bc04 /* f01b900: 00000000 */ sll $zero,$zero,0x0 @@ -684,7 +684,7 @@ glabel func0f01b160 /* f01b980: 1000002c */ beqz $zero,.L0f01ba34 /* f01b984: a3b800c7 */ sb $t8,0xc7($sp) .L0f01b988: -/* f01b988: 0fc3f7c5 */ jal func0f0fdf14 +/* f01b988: 0fc3f7c5 */ jal activemenuApply /* f01b98c: 00000000 */ sll $zero,$zero,0x0 /* f01b990: 10000029 */ beqz $zero,.L0f01ba38 /* f01b994: 83ad00c7 */ lb $t5,0xc7($sp) @@ -718,7 +718,7 @@ glabel func0f01b160 .L0f01b9f8: /* f01b9f8: 1041000e */ beq $v0,$at,.L0f01ba34 /* f01b9fc: 00402025 */ or $a0,$v0,$zero -/* f01ba00: 0fc3f7c5 */ jal func0f0fdf14 +/* f01ba00: 0fc3f7c5 */ jal activemenuApply /* f01ba04: 00000000 */ sll $zero,$zero,0x0 /* f01ba08: 1000000b */ beqz $zero,.L0f01ba38 /* f01ba0c: 83ad00c7 */ lb $t5,0xc7($sp) @@ -731,7 +731,7 @@ glabel func0f01b160 /* f01ba24: 10000003 */ beqz $zero,.L0f01ba34 /* f01ba28: a3ac00c7 */ sb $t4,0xc7($sp) .L0f01ba2c: -/* f01ba2c: 0fc3f7c5 */ jal func0f0fdf14 +/* f01ba2c: 0fc3f7c5 */ jal activemenuApply /* f01ba30: 00000000 */ sll $zero,$zero,0x0 .L0f01ba34: /* f01ba34: 83ad00c7 */ lb $t5,0xc7($sp) diff --git a/src/game/game_0fd660.c b/src/game/game_0fd660.c index 94bb1880a..445fb8687 100644 --- a/src/game/game_0fd660.c +++ b/src/game/game_0fd660.c @@ -649,7 +649,7 @@ glabel func0f0fde8c ); GLOBAL_ASM( -glabel func0f0fdf14 +glabel activemenuApply /* f0fdf14: 3c03800a */ lui $v1,0x800a /* f0fdf18: 8c6321b8 */ lw $v1,0x21b8($v1) /* f0fdf1c: 3c08800a */ lui $t0,%hi(g_ActiveMenuThings) @@ -1265,7 +1265,7 @@ void activemenuChangeScreen(s32 step) g_ActiveMenuThings[g_ActiveMenuIndex].unk02 = 10; g_ActiveMenuThings[g_ActiveMenuIndex].unk0a = -123; - g_ActiveMenuThings[g_ActiveMenuIndex].unk0e = 4; + g_ActiveMenuThings[g_ActiveMenuIndex].slotnum = 4; g_ActiveMenuThings[g_ActiveMenuIndex].unk14 = 0; g_ActiveMenuThings[g_ActiveMenuIndex].unk10 = 0; g_ActiveMenuThings[g_ActiveMenuIndex].unk18 = 0; @@ -1527,41 +1527,16 @@ glabel var7f1b2cdc /* f0ff03c: 00000000 */ sll $zero,$zero,0x0 ); -GLOBAL_ASM( -glabel func0f0ff040 -/* f0ff040: 3c0e800a */ lui $t6,0x800a -/* f0ff044: 8dce21b8 */ lw $t6,0x21b8($t6) -/* f0ff048: 3c04800a */ lui $a0,0x800a -/* f0ff04c: 27bdffe8 */ addiu $sp,$sp,-24 -/* f0ff050: 000e78c0 */ sll $t7,$t6,0x3 -/* f0ff054: 01ee7823 */ subu $t7,$t7,$t6 -/* f0ff058: 000f78c0 */ sll $t7,$t7,0x3 -/* f0ff05c: 008f2021 */ addu $a0,$a0,$t7 -/* f0ff060: 908420de */ lbu $a0,0x20de($a0) -/* f0ff064: 24010004 */ addiu $at,$zero,0x4 -/* f0ff068: afbf0014 */ sw $ra,0x14($sp) -/* f0ff06c: 10810003 */ beq $a0,$at,.L0f0ff07c -/* f0ff070: 00000000 */ sll $zero,$zero,0x0 -/* f0ff074: 0fc3f7c5 */ jal func0f0fdf14 -/* f0ff078: 00000000 */ sll $zero,$zero,0x0 -.L0f0ff07c: -/* f0ff07c: 3c02800a */ lui $v0,%hi(g_Vars) -/* f0ff080: 24429fc0 */ addiu $v0,$v0,%lo(g_Vars) -/* f0ff084: 8c580284 */ lw $t8,0x284($v0) -/* f0ff088: 2419ffff */ addiu $t9,$zero,-1 -/* f0ff08c: 3c018007 */ lui $at,0x8007 -/* f0ff090: a3000250 */ sb $zero,0x250($t8) -/* f0ff094: 8c480284 */ lw $t0,0x284($v0) -/* f0ff098: 24090001 */ addiu $t1,$zero,0x1 -/* f0ff09c: ad191c40 */ sw $t9,0x1c40($t0) -/* f0ff0a0: 8c4a028c */ lw $t2,0x28c($v0) -/* f0ff0a4: 8fbf0014 */ lw $ra,0x14($sp) -/* f0ff0a8: 27bd0018 */ addiu $sp,$sp,0x18 -/* f0ff0ac: 000a5880 */ sll $t3,$t2,0x2 -/* f0ff0b0: 002b0821 */ addu $at,$at,$t3 -/* f0ff0b4: 03e00008 */ jr $ra -/* f0ff0b8: ac290750 */ sw $t1,0x750($at) -); +void activemenuClose(void) +{ + if (g_ActiveMenuThings[g_ActiveMenuIndex].slotnum != 4) { + activemenuApply(g_ActiveMenuThings[g_ActiveMenuIndex].slotnum); + } + + g_Vars.currentplayer->activemenumode = 0; + g_Vars.currentplayer->unk1c40 = -1; + g_PlayersWithControl[g_Vars.currentplayernum] = 1; +} GLOBAL_ASM( glabel func0f0ff0bc diff --git a/src/include/game/game_0fd660.h b/src/include/game/game_0fd660.h index ecad1d7b4..87c2ca99f 100644 --- a/src/include/game/game_0fd660.h +++ b/src/include/game/game_0fd660.h @@ -7,14 +7,14 @@ void func0f0fd660(void); u32 func0f0fdd00(void); u32 func0f0fdd84(void); s32 func0f0fde8c(void); -u32 func0f0fdf14(void); +void activemenuApply(s32 arg0); void activemenuGetSlotDetails(s32 slot, u32 *flags, char *dst); u32 func0f0fe848(void); u32 func0f0fea14(void); void activemenuChangeScreen(s32 step); u32 func0f0fecd4(void); u32 func0f0fef68(void); -u32 func0f0ff040(void); +void activemenuClose(void); u32 func0f0ff0bc(void); u32 func0f0ff274(void); u32 func0f0ff6f4(void); diff --git a/src/include/types.h b/src/include/types.h index 84e970db8..94b1cd5b5 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -2763,6 +2763,17 @@ struct player { /*0x1c0c*/ u32 coopcanrestart; /*0x1c10*/ u32 foot; /*0x1c14*/ u32 footstepdist; + /*0x1c18*/ u32 unk1c18; + /*0x1c1c*/ u32 unk1c1c; + /*0x1c20*/ u32 unk1c20; + /*0x1c24*/ u32 unk1c24; + /*0x1c28*/ u32 unk1c28; + /*0x1c2c*/ u32 unk1c2c; + /*0x1c30*/ u32 unk1c30; + /*0x1c34*/ u32 unk1c34; + /*0x1c38*/ u32 unk1c38; + /*0x1c3c*/ u32 unk1c3c; + /*0x1c40*/ s32 unk1c40; }; struct ailist { @@ -4828,7 +4839,7 @@ struct activemenuthing { /*0x08*/ u16 unk08; /*0x0a*/ s16 unk0a; /*0x0c*/ u16 unk0c; - /*0x0e*/ u8 unk0e; + /*0x0e*/ u8 slotnum; /*0x10*/ u32 unk10; /*0x14*/ u32 unk14; /*0x18*/ f32 unk18;