From 6df3ee9d57b5b128dd8a5f1819c2ad59c09af42b Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Thu, 19 Mar 2020 18:44:33 +1000 Subject: [PATCH] Attempt to decompile mpGetWeaponSetName --- src/game/game_179060.c | 4 ++-- src/game/mplayer.c | 22 +++++++++++++++++++++- src/include/game/mplayer.h | 4 ++-- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/game/game_179060.c b/src/game/game_179060.c index 44b44f5f4..0fa6953dc 100644 --- a/src/game/game_179060.c +++ b/src/game/game_179060.c @@ -460,7 +460,7 @@ s32 menuhandlerMpWeaponSetDropdown(u32 operation, struct menu_item *item, s32 *v *value = func0f189058(item->param); break; case MENUOP_GETOPTIONTEXT: - return func0f1890a8(*value); + return mpGetWeaponSetName(*value); case MENUOP_SET: func0f1895bc(*value); break; @@ -5942,7 +5942,7 @@ glabel func0f17f088 /* f17f08c: afbf0014 */ sw $ra,0x14($sp) /* f17f090: 0fc62587 */ jal func0f18961c /* f17f094: afa40018 */ sw $a0,0x18($sp) -/* f17f098: 0fc6242a */ jal func0f1890a8 +/* f17f098: 0fc6242a */ jal mpGetWeaponSetName /* f17f09c: 00402025 */ or $a0,$v0,$zero /* f17f0a0: 8fbf0014 */ lw $ra,0x14($sp) /* f17f0a4: 27bd0018 */ addiu $sp,$sp,0x18 diff --git a/src/game/mplayer.c b/src/game/mplayer.c index 701ad99ad..a79429c1d 100644 --- a/src/game/mplayer.c +++ b/src/game/mplayer.c @@ -1932,7 +1932,7 @@ glabel func0f189088 ); GLOBAL_ASM( -glabel func0f1890a8 +glabel mpGetWeaponSetName /* f1890a8: 27bdffe8 */ addiu $sp,$sp,-24 /* f1890ac: afbf0014 */ sw $ra,0x14($sp) /* f1890b0: 0fc623e7 */ jal func0f188f9c @@ -1977,6 +1977,26 @@ glabel func0f1890a8 /* f189138: 00000000 */ sll $zero,$zero,0x0 ); +// regalloc +//char *mpGetWeaponSetName(s32 arg0) +//{ +// s32 index = func0f188f9c(arg0); +// +// if (index < 0 || index >= 14) { +// return langGet(L_MPWEAPONS(41)); // "Custom" +// } +// +// if (index == 13) { +// return langGet(L_MPWEAPONS(42)); // "Random" +// } +// +// if (index == 12) { +// return langGet(L_MPWEAPONS(43)); // "Random Five" +// } +// +// return langGet(g_MpWeaponSets[index].name); +//} + GLOBAL_ASM( glabel func0f18913c /* f18913c: 27bdffb8 */ addiu $sp,$sp,-72 diff --git a/src/include/game/mplayer.h b/src/include/game/mplayer.h index c913a06fd..c4547ef82 100644 --- a/src/include/game/mplayer.h +++ b/src/include/game/mplayer.h @@ -26,10 +26,10 @@ void mpSetWeaponSlot(s32 slot, s32 weapon_id); s32 mpGetWeaponSlot(s32 slot); u32 func0f188e24(void); s32 mpCountWeaponSetThing(s32 weaponsetindex); -u32 func0f188f9c(void); +s32 func0f188f9c(s32 arg0); s32 func0f189058(s32 arg0); u32 func0f189088(void); -s32 func0f1890a8(s32 arg0); +char *mpGetWeaponSetName(s32 arg0); u32 func0f18913c(void); u32 func0f1892dc(void); void func0f1895bc(s32 arg0);