From 69b74a99abe71b0100ac838e30c497d64e595fd2 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sat, 21 Mar 2020 10:58:21 +1000 Subject: [PATCH] Decompile pakMenuTextFailReason --- src/game/data/data_01a3a0.c | 2 +- src/game/game_107fb0.c | 55 +++++++++++----------------------- src/include/game/game_107fb0.h | 2 +- src/include/types.h | 2 +- 4 files changed, 21 insertions(+), 40 deletions(-) diff --git a/src/game/data/data_01a3a0.c b/src/game/data/data_01a3a0.c index e415309e3..609a6049f 100644 --- a/src/game/data/data_01a3a0.c +++ b/src/game/data/data_01a3a0.c @@ -22,7 +22,7 @@ // 1a3c0 struct menu_item menuitems_1a3c0[] = { { MENUITEMTYPE_LABEL, 0, 0x00000010, (u32)&func0f108550, 0x00000000, menuhandler001084b8 }, - { MENUITEMTYPE_LABEL, 0, 0x00000010, (u32)&func0f108424, 0x00000000, NULL }, + { MENUITEMTYPE_LABEL, 0, 0x00000010, (u32)&pakMenuTextFailReason, 0x00000000, NULL }, { MENUITEMTYPE_SELECTABLE, 0, 0x00000028, L_OPTIONS(321), 0x00000000, NULL }, // "Cancel" { MENUITEMTYPE_END, 0, 0x00000000, 0x00000000, 0x00000000, NULL }, }; diff --git a/src/game/game_107fb0.c b/src/game/game_107fb0.c index 648ff8413..3f4b1acd7 100644 --- a/src/game/game_107fb0.c +++ b/src/game/game_107fb0.c @@ -101,18 +101,6 @@ char *getSaveLocationName(s32 index) return NULL; } -u16 iomessages3[] = { - L_OPTIONS(322), // "The Controller Pak was not found in any controller." - L_OPTIONS(323), // "File was not saved." - L_OPTIONS(324), // "File would not load." - L_OPTIONS(325), // "Could not delete the file." - L_OPTIONS(326), // "Out of memory." - L_OPTIONS(327), // "This player is already loaded for this game." - L_OPTIONS(328), // "has been removed." - L_OPTIONS(329), // "Controller Pak is damaged or incorrectly inserted." - L_OPTIONS(330), // "Game note delete failed." -}; - s32 menuhandler00108014(u32 operation, struct menu_item *item, s32 *value) { if (operation == MENUOP_CHECKHIDDEN) { @@ -384,32 +372,25 @@ glabel func0f1083d0 /* f108420: 00000000 */ sll $zero,$zero,0x0 ); +u16 g_PakFailReasons[] = { + L_OPTIONS(322), // "The Controller Pak was not found in any controller." + L_OPTIONS(323), // "File was not saved." + L_OPTIONS(324), // "File would not load." + L_OPTIONS(325), // "Could not delete the file." + L_OPTIONS(326), // "Out of memory." + L_OPTIONS(327), // "This player is already loaded for this game." + L_OPTIONS(328), // "has been removed." + L_OPTIONS(329), // "Controller Pak is damaged or incorrectly inserted." + L_OPTIONS(330), // "Game note delete failed." +}; + +char *pakMenuTextFailReason(struct menu_item *item) +{ + return langGet(g_PakFailReasons[g_MenuStack[g_MpPlayerNum].unke34]); +} + GLOBAL_ASM( -glabel func0f108424 -/* f108424: 3c0e8007 */ lui $t6,%hi(g_MpPlayerNum) -/* f108428: 8dce1448 */ lw $t6,%lo(g_MpPlayerNum)($t6) -/* f10842c: 3c18800a */ lui $t8,%hi(g_MenuStack+0xe34) -/* f108430: 27bdffe8 */ addiu $sp,$sp,-24 -/* f108434: 000e78c0 */ sll $t7,$t6,0x3 -/* f108438: 01ee7823 */ subu $t7,$t7,$t6 -/* f10843c: 000f7880 */ sll $t7,$t7,0x2 -/* f108440: 01ee7821 */ addu $t7,$t7,$t6 -/* f108444: 000f78c0 */ sll $t7,$t7,0x3 -/* f108448: 01ee7823 */ subu $t7,$t7,$t6 -/* f10844c: 000f7900 */ sll $t7,$t7,0x4 -/* f108450: 030fc021 */ addu $t8,$t8,$t7 -/* f108454: 9718ee34 */ lhu $t8,%lo(g_MenuStack+0xe34)($t8) -/* f108458: afa40018 */ sw $a0,0x18($sp) -/* f10845c: 3c048007 */ lui $a0,%hi(iomessages3) -/* f108460: 0018c840 */ sll $t9,$t8,0x1 -/* f108464: afbf0014 */ sw $ra,0x14($sp) -/* f108468: 00992021 */ addu $a0,$a0,$t9 -/* f10846c: 0fc5b9f1 */ jal langGet -/* f108470: 9484438c */ lhu $a0,%lo(iomessages3)($a0) -/* f108474: 8fbf0014 */ lw $ra,0x14($sp) -/* f108478: 27bd0018 */ addiu $sp,$sp,0x18 -/* f10847c: 03e00008 */ jr $ra -/* f108480: 00000000 */ sll $zero,$zero,0x0 +glabel func0f108484 /* f108484: 27bdffe8 */ addiu $sp,$sp,-24 /* f108488: afa40018 */ sw $a0,0x18($sp) /* f10848c: afbf0014 */ sw $ra,0x14($sp) diff --git a/src/include/game/game_107fb0.h b/src/include/game/game_107fb0.h index e3df4d678..266d7279f 100644 --- a/src/include/game/game_107fb0.h +++ b/src/include/game/game_107fb0.h @@ -10,7 +10,7 @@ u32 func0f1082b0(void); void func0f108324(s32 arg0); u32 func0f1083b0(void); u32 func0f1083d0(void); -u32 func0f108424(void); +char *pakMenuTextFailReason(struct menu_item *item); u32 func0f108550(void); u32 func0f10865c(void); u32 func0f1086b8(void); diff --git a/src/include/types.h b/src/include/types.h index b635cbc5c..b319c352e 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -4283,7 +4283,7 @@ struct menustackitem { /*0xe28*/ u32 unke28; /*0xe2c*/ u32 unke2c; /*0xe30*/ u32 unke30; - /*0xe34*/ u32 unke34; + /*0xe34*/ u16 unke34; // I/O error code /*0xe38*/ u32 unke38; /*0xe3c*/ u8 unke3c_00 : 1; /*0xe3c*/ u8 unke3c_01 : 7;