diff --git a/src/game/camdraw.c b/src/game/camdraw.c index 478ef987a..2a28f7d54 100644 --- a/src/game/camdraw.c +++ b/src/game/camdraw.c @@ -8033,10 +8033,10 @@ glabel func0f15015c /* f1506d4: a078009d */ sb $t8,0x9d($v1) /* f1506d8: 00102600 */ sll $a0,$s0,0x18 /* f1506dc: 24090001 */ addiu $t1,$zero,0x1 -/* f1506e0: 3c018007 */ lui $at,%hi(var80075bdc) +/* f1506e0: 3c018007 */ lui $at,%hi(g_SaveLocations+0x1c) /* f1506e4: 00047603 */ sra $t6,$a0,0x18 /* f1506e8: 27aa1044 */ addiu $t2,$sp,0x1044 -/* f1506ec: ac295bdc */ sw $t1,%lo(var80075bdc)($at) +/* f1506ec: ac295bdc */ sw $t1,%lo(g_SaveLocations+0x1c)($at) /* f1506f0: afaa0010 */ sw $t2,0x10($sp) /* f1506f4: 01c02025 */ or $a0,$t6,$zero /* f1506f8: 02402825 */ or $a1,$s2,$zero diff --git a/src/game/game_107fb0.c b/src/game/game_107fb0.c index 05a6ab719..0f310f2d1 100644 --- a/src/game/game_107fb0.c +++ b/src/game/game_107fb0.c @@ -225,22 +225,6 @@ const char var7f1b31b4[] = "YOUR TARGET: %x-%x\n"; const char var7f1b31c8[] = "MyResult: %d\n"; const char var7f1b31d8[] = "COULD NOT DELETE\n"; const char var7f1b31ec[] = "Multiplayer %d was using that file...\n"; -const char var7f1b3214[] = "GAM"; -const char var7f1b3218[] = "MPG"; -const char var7f1b321c[] = "MPP"; -const char var7f1b3220[] = "CAM"; - -const u32 var7f1b3224[] = {0x00000080}; -const u32 var7f1b3228[] = {0x00000040}; -const u32 var7f1b322c[] = {0x00000020}; -const u32 var7f1b3230[] = {0x00000008}; - -const char var7f1b3234[] = "DestPakNo: %d (guid F:%x-%x:P)\n"; -const char var7f1b3254[] = "Copy Memory Alloced\n"; -const char var7f1b326c[] = "COULDNT GET THE RAM!\n"; -const char var7f1b3284[] = "Saving...\n"; -const char var7f1b3290[] = "%s"; -const char var7f1b3294[] = "GETFileNameForThePurposesOfTheFileRenamingChecker: Unknown type %d\n"; s32 menuhandler001084b8(u32 operation, struct menuitem *item, union handlerdata *data) { @@ -965,8 +949,8 @@ glabel func0f108d8c /* f108e08: 03002025 */ or $a0,$t8,$zero .L0f108e0c: /* f108e0c: 3c028007 */ lui $v0,%hi(g_SaveLocations) -/* f108e10: 3c058007 */ lui $a1,%hi(var80075bd0) -/* f108e14: 24a55bd0 */ addiu $a1,$a1,%lo(var80075bd0) +/* f108e10: 3c058007 */ lui $a1,%hi(g_SaveLocations+0x10) +/* f108e14: 24a55bd0 */ addiu $a1,$a1,%lo(g_SaveLocations+0x10) /* f108e18: 24425bc0 */ addiu $v0,$v0,%lo(g_SaveLocations) /* f108e1c: 24040001 */ addiu $a0,$zero,0x1 /* f108e20: 8c430000 */ lw $v1,0x0($v0) @@ -1609,109 +1593,178 @@ glabel pakDeleteFile /* f1097cc: 27bd0028 */ addiu $sp,$sp,0x28 ); -GLOBAL_ASM( -glabel func0f1097d0 -/* f1097d0: 27bdffb8 */ addiu $sp,$sp,-72 -/* f1097d4: 3c0f8007 */ lui $t7,%hi(var8007464c) -/* f1097d8: afbf0014 */ sw $ra,0x14($sp) -/* f1097dc: 25ef464c */ addiu $t7,$t7,%lo(var8007464c) -/* f1097e0: 8de10000 */ lw $at,0x0($t7) -/* f1097e4: 8de80004 */ lw $t0,0x4($t7) -/* f1097e8: 27ae0038 */ addiu $t6,$sp,0x38 -/* f1097ec: adc10000 */ sw $at,0x0($t6) -/* f1097f0: adc80004 */ sw $t0,0x4($t6) -/* f1097f4: 8de8000c */ lw $t0,0xc($t7) -/* f1097f8: 8de10008 */ lw $at,0x8($t7) -/* f1097fc: 3c0a7f1b */ lui $t2,%hi(var7f1b3224) -/* f109800: 254a3224 */ addiu $t2,$t2,%lo(var7f1b3224) -/* f109804: adc8000c */ sw $t0,0xc($t6) -/* f109808: adc10008 */ sw $at,0x8($t6) -/* f10980c: 8d4d0004 */ lw $t5,0x4($t2) -/* f109810: 8d410000 */ lw $at,0x0($t2) -/* f109814: 27a90028 */ addiu $t1,$sp,0x28 -/* f109818: ad2d0004 */ sw $t5,0x4($t1) -/* f10981c: ad210000 */ sw $at,0x0($t1) -/* f109820: 8d410008 */ lw $at,0x8($t2) -/* f109824: 8d4d000c */ lw $t5,0xc($t2) -/* f109828: 3c038007 */ lui $v1,%hi(g_SaveLocations) -/* f10982c: ad210008 */ sw $at,0x8($t1) -/* f109830: ad2d000c */ sw $t5,0xc($t1) -/* f109834: 8c635bc0 */ lw $v1,%lo(g_SaveLocations)($v1) -/* f109838: 0004c8c0 */ sll $t9,$a0,0x3 -/* f10983c: 10600041 */ beqz $v1,.L0f109944 -/* f109840: 00791021 */ addu $v0,$v1,$t9 -/* f109844: 8c5802d8 */ lw $t8,0x2d8($v0) -/* f109848: 3c05800a */ lui $a1,%hi(var800a21e8) -/* f10984c: 24a521e8 */ addiu $a1,$a1,%lo(var800a21e8) -/* f109850: acb80000 */ sw $t8,0x0($a1) -/* f109854: 944e02dc */ lhu $t6,0x2dc($v0) -/* f109858: 3c0f8007 */ lui $t7,%hi(g_MpPlayerNum) -/* f10985c: 3c0c800a */ lui $t4,%hi(g_Menus+0xe1c) -/* f109860: a4ae0004 */ sh $t6,0x4($a1) -/* f109864: 8def1448 */ lw $t7,%lo(g_MpPlayerNum)($t7) -/* f109868: 3c047f1b */ lui $a0,%hi(var7f1b2f3c-0x4) -/* f10986c: 000f40c0 */ sll $t0,$t7,0x3 -/* f109870: 010f4023 */ subu $t0,$t0,$t7 -/* f109874: 00084080 */ sll $t0,$t0,0x2 -/* f109878: 010f4021 */ addu $t0,$t0,$t7 -/* f10987c: 000840c0 */ sll $t0,$t0,0x3 -/* f109880: 010f4023 */ subu $t0,$t0,$t7 -/* f109884: 00084100 */ sll $t0,$t0,0x4 -/* f109888: 01886021 */ addu $t4,$t4,$t0 -/* f10988c: 8d8cee1c */ lw $t4,%lo(g_Menus+0xe1c)($t4) -/* f109890: 000c5880 */ sll $t3,$t4,0x2 -/* f109894: 008b2021 */ addu $a0,$a0,$t3 -/* f109898: 0fc5db69 */ jal align16 -/* f10989c: 8c842f38 */ lw $a0,%lo(var7f1b2f3c-0x4)($a0) -/* f1098a0: 0c004aac */ jal func00012ab0 -/* f1098a4: 00402025 */ or $a0,$v0,$zero -/* f1098a8: 10400013 */ beqz $v0,.L0f1098f8 -/* f1098ac: 00403025 */ or $a2,$v0,$zero -/* f1098b0: 3c098007 */ lui $t1,%hi(g_MpPlayerNum) -/* f1098b4: 8d291448 */ lw $t1,%lo(g_MpPlayerNum)($t1) -/* f1098b8: 3c05800a */ lui $a1,%hi(g_Menus+0xe1c) -/* f1098bc: 3c04800a */ lui $a0,%hi(var800a21e0) -/* f1098c0: 000950c0 */ sll $t2,$t1,0x3 -/* f1098c4: 01495023 */ subu $t2,$t2,$t1 -/* f1098c8: 000a5080 */ sll $t2,$t2,0x2 -/* f1098cc: 01495021 */ addu $t2,$t2,$t1 -/* f1098d0: 000a50c0 */ sll $t2,$t2,0x3 -/* f1098d4: 01495023 */ subu $t2,$t2,$t1 -/* f1098d8: 000a5100 */ sll $t2,$t2,0x4 -/* f1098dc: 00aa2821 */ addu $a1,$a1,$t2 -/* f1098e0: 8ca5ee1c */ lw $a1,%lo(g_Menus+0xe1c)($a1) -/* f1098e4: 248421e0 */ addiu $a0,$a0,%lo(var800a21e0) -/* f1098e8: 0fc42539 */ jal func0f1094e4 -/* f1098ec: 24a50067 */ addiu $a1,$a1,0x67 -/* f1098f0: 10000003 */ b .L0f109900 -/* f1098f4: 00000000 */ nop -.L0f1098f8: -/* f1098f8: 0fc42197 */ jal func0f10865c -/* f1098fc: 24040004 */ addiu $a0,$zero,0x4 -.L0f109900: -/* f109900: 3c198007 */ lui $t9,%hi(g_MpPlayerNum) -/* f109904: 8f391448 */ lw $t9,%lo(g_MpPlayerNum)($t9) -/* f109908: 3c0e800a */ lui $t6,%hi(g_Menus+0xe1c) -/* f10990c: 3c018007 */ lui $at,%hi(g_SaveLocations+0xc) -/* f109910: 0019c0c0 */ sll $t8,$t9,0x3 -/* f109914: 0319c023 */ subu $t8,$t8,$t9 -/* f109918: 0018c080 */ sll $t8,$t8,0x2 -/* f10991c: 0319c021 */ addu $t8,$t8,$t9 -/* f109920: 0018c0c0 */ sll $t8,$t8,0x3 -/* f109924: 0319c023 */ subu $t8,$t8,$t9 -/* f109928: 0018c100 */ sll $t8,$t8,0x4 -/* f10992c: 01d87021 */ addu $t6,$t6,$t8 -/* f109930: 8dceee1c */ lw $t6,%lo(g_Menus+0xe1c)($t6) -/* f109934: 240d0001 */ addiu $t5,$zero,0x1 -/* f109938: 000e7880 */ sll $t7,$t6,0x2 -/* f10993c: 002f0821 */ addu $at,$at,$t7 -/* f109940: ac2d5bcc */ sw $t5,%lo(g_SaveLocations+0xc)($at) -.L0f109944: -/* f109944: 8fbf0014 */ lw $ra,0x14($sp) -/* f109948: 27bd0048 */ addiu $sp,$sp,0x48 -/* f10994c: 03e00008 */ jr $ra -/* f109950: 00000000 */ nop -); +// 1a3c0 +struct menuitem menuitems_1a3c0[] = { + { MENUITEMTYPE_LABEL, 0, 0x00000010, (u32)&func0f108550, 0x00000000, menuhandler001084b8 }, + { 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 }, +}; + +// 1a410 +struct menudialog menudialog_1a410 = { + MENUDIALOGTYPE_DANGER, + L_OPTIONS(320), // "Error" + menuitems_1a3c0, + NULL, + 0x00000080, + NULL, +}; + +// 1a428 +u16 savelocations2[] = { + L_OPTIONS(111), // "Game Pak" + L_OPTIONS(112), // "Controller Pak 1" + L_OPTIONS(113), // "Controller Pak 2" + L_OPTIONS(114), // "Controller Pak 3" + L_OPTIONS(115), // "Controller Pak 4" + 0x0000, +}; + +// 1a434 +u16 iomessages2[] = { + L_OPTIONS(331), // "Error Loading Game" + L_OPTIONS(332), // "Error Saving Game" + L_OPTIONS(333), // "Error Loading Player" + L_OPTIONS(334), // "Error Saving Player" + L_OPTIONS(335), // "Error Loading PerfectHead" + L_OPTIONS(336), // "Error Saving PerfectHead" + L_OPTIONS(337), // "Error Reading File" + L_OPTIONS(338), // "Error Writing File" + L_OPTIONS(339), // "Error" + 0x0000, +}; + +// 1a448 +u16 filetypenames[] = { + L_OPTIONS(103), // "Single Player Agent File" + L_OPTIONS(104), // "Combat Simulator Settings File" + L_OPTIONS(105), // "Combat Simulator Player File" + L_OPTIONS(106), // "PerfectHead Files" +}; + +// 1a450 +struct menuitem menuitems_filesaved[] = { + { MENUITEMTYPE_LABEL, 0, 0x00000010, L_OPTIONS(346), 0x00000000, NULL }, // "File Saved." + { MENUITEMTYPE_SELECTABLE, 0, 0x00000028, L_OPTIONS(347), 0x00000000, NULL }, // "OK" + { MENUITEMTYPE_END, 0, 0x00000000, 0x00000000, 0x00000000, NULL }, +}; + +// 1a48c +struct menudialog menudialog_filesaved = { + MENUDIALOGTYPE_SUCCESS, + L_OPTIONS(345), // "Cool!" + menuitems_filesaved, + NULL, + 0x00000080, + NULL, +}; + +// 1a4a4 +struct menuitem menuitems_saveerror[] = { + { MENUITEMTYPE_LABEL, 0, 0x00000010, (u32)&pakMenuTextLocationName, 0x00000000, menuhandler00108014 }, + { MENUITEMTYPE_LABEL, 0, 0x00000010, L_OPTIONS(348), 0x00000000, NULL }, // "An error occurred while trying to save" + { MENUITEMTYPE_SELECTABLE, 0, 0x00000020, L_OPTIONS(349), 0x00000000, menuhandlerPakErrorTryAgain }, // "Try Again" + { MENUITEMTYPE_SELECTABLE, 0, 0x00000020, L_OPTIONS(350), 0x00000000, menuhandlerSaveElsewhere }, // "Save Elsewhere" + { MENUITEMTYPE_SELECTABLE, 0, 0x00000020, L_OPTIONS(351), 0x00000000, menuhandlerPakCancelSave2 }, // "Cancel" + { MENUITEMTYPE_END, 0, 0x00000000, 0x00000000, 0x00000000, NULL }, +}; + +// 1a51c +struct menudialog menudialog_saveerror = { + MENUDIALOGTYPE_DANGER, + (u32)&func0f10876c, + menuitems_saveerror, + NULL, + 0x000000a0, + NULL, +}; + +// 1a534 +struct menuitem menuitems_savelost[] = { + { MENUITEMTYPE_LABEL, 0, 0x00000010, (u32)&pakMenuTextLocationName, 0x00000000, menuhandler00108014 }, + { MENUITEMTYPE_LABEL, 0, 0x00000010, L_MPWEAPONS(251), 0x00000000, NULL }, // "The saved file has been erased due to corruption or damage." + { MENUITEMTYPE_SELECTABLE, 0, 0x00000020, L_OPTIONS(354), 0x00000000, menuhandlerAcknowledgePakFileLost }, // "Cancel" + { MENUITEMTYPE_END, 0, 0x00000000, 0x00000000, 0x00000000, NULL }, +}; + +// 1a584 +struct menudialog menudialog_savelost = { + MENUDIALOGTYPE_DANGER, + (u32)&func0f10876c, + menuitems_savelost, + NULL, + 0x000000a0, + NULL, +}; + +// 1a59c +struct menuitem menuitems_saveelsewhere[] = { + { MENUITEMTYPE_LABEL, 0, 0x00000010, L_OPTIONS(360), 0x00000000, NULL }, // "Would you like to save your file elsewhere?" + { MENUITEMTYPE_SELECTABLE, 0, 0x00000020, L_OPTIONS(361), 0x00000000, menuhandlerSaveElsewhere }, // "Yes" + { MENUITEMTYPE_SELECTABLE, 0, 0x00000020, L_OPTIONS(362), 0x00000000, menuhandlerPakCancelSave2 }, // "No" + { MENUITEMTYPE_END, 0, 0x00000000, 0x00000000, 0x00000000, NULL }, +}; + +// 1a5ec +struct menudialog g_SaveElsewhereMenuDialog = { + MENUDIALOGTYPE_DANGER, + L_OPTIONS(359), // "Save" + menuitems_saveelsewhere, + NULL, + 0x000000a0, + NULL, +}; + +// 1a604 +struct menuitem menuitems_1a604[] = { + { MENUITEMTYPE_LABEL, 0, 0x00000010, (u32)&pakMenuTextPleaseInsertOriginalPak, 0x00000000, NULL }, + { MENUITEMTYPE_SELECTABLE, 0, 0x00000020, L_OPTIONS(365), 0x00000000, menuhandler00108ecc }, // "OK" + { MENUITEMTYPE_SELECTABLE, 0, 0x00000020, L_OPTIONS(366), 0x00000000, menuhandler00108f08 }, // "Cancel" + { MENUITEMTYPE_END, 0, 0x00000000, 0x00000000, 0x00000000, NULL }, +}; + +// 1a654 +struct menudialog menudialog_1a654 = { + MENUDIALOGTYPE_DANGER, + (u32)&func0f10876c, + menuitems_1a604, + menudialog00108e58, + 0x000000a0, + NULL, +}; + +void func0f1097d0(s32 device) +{ + char *types[] = {"GAM", "MPG", "MPP", "CAM"}; + const u32 sizes[] = {0x80, 0x40, 0x20, 0x08}; + void *thing; + + if (g_SaveLocations.locations[0]) { + var800a21e8.unk00 = g_SaveLocations.locations[0]->unk2d8[device].unk00; + var800a21e8.unk04 = g_SaveLocations.locations[0]->unk2d8[device].unk04; + + thing = func00012ab0(align16(var7f1b2f3c[g_Menus[g_MpPlayerNum].data.pak.unke1c - 1])); + + if (thing) { + func0f1094e4(&var800a21e0, g_Menus[g_MpPlayerNum].data.pak.unke1c + 0x67, thing); + } else { + func0f10865c(4); + } + + g_SaveLocations.unk10[g_Menus[g_MpPlayerNum].data.pak.unke1c - 1] = 1; + } +} + +const char var7f1b3234[] = "DestPakNo: %d (guid F:%x-%x:P)\n"; +const char var7f1b3254[] = "Copy Memory Alloced\n"; +const char var7f1b326c[] = "COULDNT GET THE RAM!\n"; +const char var7f1b3284[] = "Saving...\n"; +const char var7f1b3290[] = "%s"; +const char var7f1b3294[] = "GETFileNameForThePurposesOfTheFileRenamingChecker: Unknown type %d\n"; + +u32 var8007465c = 0x01020304; +u32 var80074660 = 0x00000000; GLOBAL_ASM( glabel func0f109954 @@ -2373,11 +2426,11 @@ char *pakMenuTextSaveLocationSpaces(struct menuitem *item) { s32 spacesfree; - if (g_SaveLocations[g_Menus[g_MpPlayerNum].unke3f] == NULL) { + if (g_SaveLocations.locations[g_Menus[g_MpPlayerNum].unke3f] == NULL) { return NULL; } - spacesfree = g_SaveLocations[g_Menus[g_MpPlayerNum].unke3f]->spacesfree[item->param]; + spacesfree = g_SaveLocations.locations[g_Menus[g_MpPlayerNum].unke3f]->spacesfree[item->param]; if (spacesfree < 0) { return "\n"; @@ -2415,12 +2468,12 @@ const char var7f1b3538[] = ".%02d"; s32 menuhandlerSaveLocation(u32 operation, struct menuitem *item, union handlerdata *data) { - if (g_SaveLocations[g_Menus[g_MpPlayerNum].unke3f] == NULL) { + if (g_SaveLocations.locations[g_Menus[g_MpPlayerNum].unke3f] == NULL) { return 0; } if (operation == MENUOP_CHECKDISABLED) { - if (g_SaveLocations[g_Menus[g_MpPlayerNum].unke3f]->spacesfree[item->param] < 1) { + if (g_SaveLocations.locations[g_Menus[g_MpPlayerNum].unke3f]->spacesfree[item->param] < 1) { return true; } } @@ -3225,7 +3278,7 @@ void func0f10b0c4(u32 arg0) g_Menus[g_MpPlayerNum].data.pak.unke28 = 0; g_Menus[g_MpPlayerNum].data.pak.unke1c = 1; - location = g_SaveLocations[g_Menus[g_MpPlayerNum].unke3f]; + location = g_SaveLocations.locations[g_Menus[g_MpPlayerNum].unke3f]; if (location) { g_Menus[g_MpPlayerNum].data.pak.unke1c = location->filetype + 1; @@ -3724,7 +3777,7 @@ s32 menuhandlerAgentName(u32 operation, struct menuitem *item, union handlerdata { char *name = data->keyboard.string; - if (!g_SaveLocations[0]) { + if (!g_SaveLocations.locations[0]) { return 0; } @@ -4593,154 +4646,6 @@ glabel func0f10c970 /* f10c9bc: 00000000 */ nop ); -// 1a3c0 -struct menuitem menuitems_1a3c0[] = { - { MENUITEMTYPE_LABEL, 0, 0x00000010, (u32)&func0f108550, 0x00000000, menuhandler001084b8 }, - { 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 }, -}; - -// 1a410 -struct menudialog menudialog_1a410 = { - MENUDIALOGTYPE_DANGER, - L_OPTIONS(320), // "Error" - menuitems_1a3c0, - NULL, - 0x00000080, - NULL, -}; - -// 1a428 -u16 savelocations2[] = { - L_OPTIONS(111), // "Game Pak" - L_OPTIONS(112), // "Controller Pak 1" - L_OPTIONS(113), // "Controller Pak 2" - L_OPTIONS(114), // "Controller Pak 3" - L_OPTIONS(115), // "Controller Pak 4" - 0x0000, -}; - -// 1a434 -u16 iomessages2[] = { - L_OPTIONS(331), // "Error Loading Game" - L_OPTIONS(332), // "Error Saving Game" - L_OPTIONS(333), // "Error Loading Player" - L_OPTIONS(334), // "Error Saving Player" - L_OPTIONS(335), // "Error Loading PerfectHead" - L_OPTIONS(336), // "Error Saving PerfectHead" - L_OPTIONS(337), // "Error Reading File" - L_OPTIONS(338), // "Error Writing File" - L_OPTIONS(339), // "Error" - 0x0000, -}; - -// 1a448 -u16 filetypenames[] = { - L_OPTIONS(103), // "Single Player Agent File" - L_OPTIONS(104), // "Combat Simulator Settings File" - L_OPTIONS(105), // "Combat Simulator Player File" - L_OPTIONS(106), // "PerfectHead Files" -}; - -// 1a450 -struct menuitem menuitems_filesaved[] = { - { MENUITEMTYPE_LABEL, 0, 0x00000010, L_OPTIONS(346), 0x00000000, NULL }, // "File Saved." - { MENUITEMTYPE_SELECTABLE, 0, 0x00000028, L_OPTIONS(347), 0x00000000, NULL }, // "OK" - { MENUITEMTYPE_END, 0, 0x00000000, 0x00000000, 0x00000000, NULL }, -}; - -// 1a48c -struct menudialog menudialog_filesaved = { - MENUDIALOGTYPE_SUCCESS, - L_OPTIONS(345), // "Cool!" - menuitems_filesaved, - NULL, - 0x00000080, - NULL, -}; - -// 1a4a4 -struct menuitem menuitems_saveerror[] = { - { MENUITEMTYPE_LABEL, 0, 0x00000010, (u32)&pakMenuTextLocationName, 0x00000000, menuhandler00108014 }, - { MENUITEMTYPE_LABEL, 0, 0x00000010, L_OPTIONS(348), 0x00000000, NULL }, // "An error occurred while trying to save" - { MENUITEMTYPE_SELECTABLE, 0, 0x00000020, L_OPTIONS(349), 0x00000000, menuhandlerPakErrorTryAgain }, // "Try Again" - { MENUITEMTYPE_SELECTABLE, 0, 0x00000020, L_OPTIONS(350), 0x00000000, menuhandlerSaveElsewhere }, // "Save Elsewhere" - { MENUITEMTYPE_SELECTABLE, 0, 0x00000020, L_OPTIONS(351), 0x00000000, menuhandlerPakCancelSave2 }, // "Cancel" - { MENUITEMTYPE_END, 0, 0x00000000, 0x00000000, 0x00000000, NULL }, -}; - -// 1a51c -struct menudialog menudialog_saveerror = { - MENUDIALOGTYPE_DANGER, - (u32)&func0f10876c, - menuitems_saveerror, - NULL, - 0x000000a0, - NULL, -}; - -// 1a534 -struct menuitem menuitems_savelost[] = { - { MENUITEMTYPE_LABEL, 0, 0x00000010, (u32)&pakMenuTextLocationName, 0x00000000, menuhandler00108014 }, - { MENUITEMTYPE_LABEL, 0, 0x00000010, L_MPWEAPONS(251), 0x00000000, NULL }, // "The saved file has been erased due to corruption or damage." - { MENUITEMTYPE_SELECTABLE, 0, 0x00000020, L_OPTIONS(354), 0x00000000, menuhandlerAcknowledgePakFileLost }, // "Cancel" - { MENUITEMTYPE_END, 0, 0x00000000, 0x00000000, 0x00000000, NULL }, -}; - -// 1a584 -struct menudialog menudialog_savelost = { - MENUDIALOGTYPE_DANGER, - (u32)&func0f10876c, - menuitems_savelost, - NULL, - 0x000000a0, - NULL, -}; - -// 1a59c -struct menuitem menuitems_saveelsewhere[] = { - { MENUITEMTYPE_LABEL, 0, 0x00000010, L_OPTIONS(360), 0x00000000, NULL }, // "Would you like to save your file elsewhere?" - { MENUITEMTYPE_SELECTABLE, 0, 0x00000020, L_OPTIONS(361), 0x00000000, menuhandlerSaveElsewhere }, // "Yes" - { MENUITEMTYPE_SELECTABLE, 0, 0x00000020, L_OPTIONS(362), 0x00000000, menuhandlerPakCancelSave2 }, // "No" - { MENUITEMTYPE_END, 0, 0x00000000, 0x00000000, 0x00000000, NULL }, -}; - -// 1a5ec -struct menudialog g_SaveElsewhereMenuDialog = { - MENUDIALOGTYPE_DANGER, - L_OPTIONS(359), // "Save" - menuitems_saveelsewhere, - NULL, - 0x000000a0, - NULL, -}; - -// 1a604 -struct menuitem menuitems_1a604[] = { - { MENUITEMTYPE_LABEL, 0, 0x00000010, (u32)&pakMenuTextPleaseInsertOriginalPak, 0x00000000, NULL }, - { MENUITEMTYPE_SELECTABLE, 0, 0x00000020, L_OPTIONS(365), 0x00000000, menuhandler00108ecc }, // "OK" - { MENUITEMTYPE_SELECTABLE, 0, 0x00000020, L_OPTIONS(366), 0x00000000, menuhandler00108f08 }, // "Cancel" - { MENUITEMTYPE_END, 0, 0x00000000, 0x00000000, 0x00000000, NULL }, -}; - -// 1a654 -struct menudialog menudialog_1a654 = { - MENUDIALOGTYPE_DANGER, - (u32)&func0f10876c, - menuitems_1a604, - menudialog00108e58, - 0x000000a0, - NULL, -}; - -u32 var8007464c = (u32)&var7f1b3214; -u32 var80074650 = (u32)&var7f1b3218; -u32 var80074654 = (u32)&var7f1b321c; -u32 var80074658 = (u32)&var7f1b3220; -u32 var8007465c = 0x01020304; -u32 var80074660 = 0x00000000; - // 1a684 struct menuitem menuitems_changefilename[] = { { MENUITEMTYPE_LABEL, 0, 0x00000010, L_MPWEAPONS(239), 0x00000000, NULL }, // "Enter new file name:" diff --git a/src/game/game_179060.c b/src/game/game_179060.c index 54b5f5986..eaa7c95c5 100644 --- a/src/game/game_179060.c +++ b/src/game/game_179060.c @@ -3460,7 +3460,7 @@ s32 menudialogMpReady(u32 operation, struct menudialog *dialog, union handlerdat { if (operation == MENUOP_OPEN) { if (g_MpPlayers[g_MpPlayerNum].saved && g_MpPlayers[g_MpPlayerNum].unk50) { - func0f1094e4(&g_MpPlayers[g_MpPlayerNum].saved, 3, g_MpPlayerNum); + func0f1094e4(&g_MpPlayers[g_MpPlayerNum].saved, 3, (void *)g_MpPlayerNum); } } diff --git a/src/game/gamefile.c b/src/game/gamefile.c index 132ebd6d4..7c54c92c3 100644 --- a/src/game/gamefile.c +++ b/src/game/gamefile.c @@ -29,12 +29,11 @@ #include "lib/lib_4b170.h" #include "types.h" -struct savelocation *g_SaveLocations[] = {NULL, NULL, NULL, NULL}; +struct var80075bc0 g_SaveLocations = { + NULL, NULL, NULL, NULL, + true, true, true, true, +}; -u32 var80075bd0 = 1; -u32 var80075bd4 = 1; -u32 var80075bd8 = 1; -u32 var80075bdc = 1; u32 var80075be0 = 0; u32 var80075be4 = 0; u32 var80075be8 = 0; @@ -571,8 +570,8 @@ glabel func0f10feac /* f10ff18: 10000001 */ b .L0f10ff20 /* f10ff1c: 24110001 */ addiu $s1,$zero,0x1 .L0f10ff20: -/* f10ff20: 3c018007 */ lui $at,%hi(var80075bd0) -/* f10ff24: ac325bd0 */ sw $s2,%lo(var80075bd0)($at) +/* f10ff20: 3c018007 */ lui $at,%hi(g_SaveLocations+0x10) +/* f10ff24: ac325bd0 */ sw $s2,%lo(g_SaveLocations+0x10)($at) /* f10ff28: 0fc549e0 */ jal optionsGetForwardPitch /* f10ff2c: 02602025 */ or $a0,$s3,$zero /* f10ff30: 3c10800a */ lui $s0,%hi(g_SoloSaveFile+0x14) @@ -1442,9 +1441,9 @@ glabel func0f110bf8 /* f110bfc: afb10018 */ sw $s1,0x18($sp) /* f110c00: afb00014 */ sw $s0,0x14($sp) /* f110c04: 3c108007 */ lui $s0,%hi(g_SaveLocations) -/* f110c08: 3c118007 */ lui $s1,%hi(var80075bd0) +/* f110c08: 3c118007 */ lui $s1,%hi(g_SaveLocations+0x10) /* f110c0c: afbf001c */ sw $ra,0x1c($sp) -/* f110c10: 26315bd0 */ addiu $s1,$s1,%lo(var80075bd0) +/* f110c10: 26315bd0 */ addiu $s1,$s1,%lo(g_SaveLocations+0x10) /* f110c14: 26105bc0 */ addiu $s0,$s0,%lo(g_SaveLocations) /* f110c18: 8e0e0000 */ lw $t6,0x0($s0) .L0f110c1c: @@ -1469,13 +1468,13 @@ glabel func0f110bf8 void func0f110c5c(s32 locationindex, u8 filetype) { - if (g_SaveLocations[locationindex] == NULL) { + if (g_SaveLocations.locations[locationindex] == NULL) { func0f15e5b8(align16(0x310), 1); - g_SaveLocations[locationindex] = func00012ab0(align16(0x310)); + g_SaveLocations.locations[locationindex] = func00012ab0(align16(0x310)); } - g_SaveLocations[locationindex]->unk30c = 1; - g_SaveLocations[locationindex]->filetype = filetype; + g_SaveLocations.locations[locationindex]->unk30c = 1; + g_SaveLocations.locations[locationindex]->filetype = filetype; if (var80062944 == 0) { func0001398c(3); @@ -1598,10 +1597,10 @@ glabel func0f110da8 /* f110e6c: 5420ffe6 */ bnezl $at,.L0f110e08 /* f110e70: 00128e00 */ sll $s1,$s2,0x18 /* f110e74: 3c108007 */ lui $s0,%hi(g_SaveLocations) -/* f110e78: 3c148007 */ lui $s4,%hi(var80075bd0) -/* f110e7c: 3c118007 */ lui $s1,%hi(var80075bd0) -/* f110e80: 26315bd0 */ addiu $s1,$s1,%lo(var80075bd0) -/* f110e84: 26945bd0 */ addiu $s4,$s4,%lo(var80075bd0) +/* f110e78: 3c148007 */ lui $s4,%hi(g_SaveLocations+0x10) +/* f110e7c: 3c118007 */ lui $s1,%hi(g_SaveLocations+0x10) +/* f110e80: 26315bd0 */ addiu $s1,$s1,%lo(g_SaveLocations+0x10) +/* f110e84: 26945bd0 */ addiu $s4,$s4,%lo(g_SaveLocations+0x10) /* f110e88: 26105bc0 */ addiu $s0,$s0,%lo(g_SaveLocations) /* f110e8c: 24120001 */ addiu $s2,$zero,0x1 /* f110e90: 8e040000 */ lw $a0,0x0($s0) @@ -1641,10 +1640,10 @@ glabel func0f110da8 /* f110f04: 0214082b */ sltu $at,$s0,$s4 /* f110f08: 5420ffe2 */ bnezl $at,.L0f110e94 /* f110f0c: 8e040000 */ lw $a0,0x0($s0) -/* f110f10: 3c028007 */ lui $v0,%hi(var80075bd0) +/* f110f10: 3c028007 */ lui $v0,%hi(g_SaveLocations+0x10) /* f110f14: 3c038007 */ lui $v1,%hi(var80075be0) /* f110f18: 24635be0 */ addiu $v1,$v1,%lo(var80075be0) -/* f110f1c: 24425bd0 */ addiu $v0,$v0,%lo(var80075bd0) +/* f110f1c: 24425bd0 */ addiu $v0,$v0,%lo(g_SaveLocations+0x10) .L0f110f20: /* f110f20: 24420004 */ addiu $v0,$v0,0x4 /* f110f24: 1443fffe */ bne $v0,$v1,.L0f110f20 diff --git a/src/game/mplayer.c b/src/game/mplayer.c index c2525386e..737302e95 100644 --- a/src/game/mplayer.c +++ b/src/game/mplayer.c @@ -6754,9 +6754,9 @@ glabel func0f18d9fc /* f18da2c: 0fc35531 */ jal func0f0d54c4 /* f18da30: 27a40020 */ addiu $a0,$sp,0x20 /* f18da34: 240f0001 */ addiu $t7,$zero,0x1 -/* f18da38: 3c018007 */ lui $at,%hi(var80075bd8) +/* f18da38: 3c018007 */ lui $at,%hi(g_SaveLocations+0x18) /* f18da3c: 27b80100 */ addiu $t8,$sp,0x100 -/* f18da40: ac2f5bd8 */ sw $t7,%lo(var80075bd8)($at) +/* f18da40: ac2f5bd8 */ sw $t7,%lo(g_SaveLocations+0x18)($at) /* f18da44: afb80010 */ sw $t8,0x10($sp) /* f18da48: 83a4010f */ lb $a0,0x10f($sp) /* f18da4c: 8fa50110 */ lw $a1,0x110($sp) @@ -7439,10 +7439,10 @@ glabel func0f18e420 /* f18e468: 0fc45a0a */ jal func0f116828 /* f18e46c: afa00014 */ sw $zero,0x14($sp) /* f18e470: 24180001 */ addiu $t8,$zero,0x1 -/* f18e474: 3c018007 */ lui $at,%hi(var80075bd4) +/* f18e474: 3c018007 */ lui $at,%hi(g_SaveLocations+0x14) /* f18e478: 00401825 */ or $v1,$v0,$zero /* f18e47c: 14400009 */ bnez $v0,.L0f18e4a4 -/* f18e480: ac385bd4 */ sw $t8,%lo(var80075bd4)($at) +/* f18e480: ac385bd4 */ sw $t8,%lo(g_SaveLocations+0x14)($at) /* f18e484: 8fb90100 */ lw $t9,0x100($sp) /* f18e488: 97a80112 */ lhu $t0,0x112($sp) /* f18e48c: 3c03800b */ lui $v1,%hi(g_MpSetup) diff --git a/src/gvars/gvars.c b/src/gvars/gvars.c index 0b1aded7c..b8628450f 100644 --- a/src/gvars/gvars.c +++ b/src/gvars/gvars.c @@ -14900,8 +14900,7 @@ u32 g_CheatsEnabledBank0 = 0; u32 g_CheatsEnabledBank1 = 0; u32 var800a21e0 = 0; u32 var800a21e4 = 0; -u32 var800a21e8 = 0; -u32 var800a21ec = 0; +struct savelocation_2d8 var800a21e8 = {0}; u32 var800a21f0 = 0; u32 var800a21f4 = 0; u32 var800a21f8 = 0; diff --git a/src/include/game/data/data_01a3a0.h b/src/include/game/data/data_01a3a0.h index 84a962097..f28095b49 100644 --- a/src/include/game/data/data_01a3a0.h +++ b/src/include/game/data/data_01a3a0.h @@ -33,7 +33,7 @@ extern struct menudialog g_4MbMainMenu; extern struct menudialog menudialog_mpdropout; extern struct menudialog g_MpEditSimulant4MbMenuDialog; extern struct menudialog g_4MbAdvancedSetupMenuDialog; -extern struct savelocation *g_SaveLocations[]; +extern struct var80075bc0 g_SaveLocations; extern u32 var80075bd0; extern u32 var80075be0; extern struct var80075c00 var80075c00[]; diff --git a/src/include/game/game_107fb0.h b/src/include/game/game_107fb0.h index ba0704fbd..7dcf5d3f5 100644 --- a/src/include/game/game_107fb0.h +++ b/src/include/game/game_107fb0.h @@ -22,9 +22,9 @@ u32 func0f108d8c(void); char *pakMenuTextPleaseInsertOriginalPak(struct menuitem *item); void func0f109038(s32 arg0); u32 func0f1091e0(void); -bool func0f1094e4(bool *saved, s32 arg1, u32 arg2); +bool func0f1094e4(bool *saved, s32 arg1, void *arg2); u32 pakDeleteFile(void); -u32 func0f1097d0(void); +void func0f1097d0(s32 device); u32 func0f109954(void); u32 func0f1099a8(void); void func0f109a68(char *name); diff --git a/src/include/gvars/gvars.h b/src/include/gvars/gvars.h index 71164d54c..648708f8f 100644 --- a/src/include/gvars/gvars.h +++ b/src/include/gvars/gvars.h @@ -660,7 +660,7 @@ extern u32 g_CheatsActiveBank1; extern u32 g_CheatsEnabledBank0; extern u32 g_CheatsEnabledBank1; extern u32 var800a21e0; -extern u32 var800a21e8; +extern struct savelocation_2d8 var800a21e8; extern u32 var800a21f0; extern struct savefile_solo g_SoloSaveFile; extern u32 var800a22c0; diff --git a/src/include/types.h b/src/include/types.h index 60c517192..30370c08a 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -4699,14 +4699,16 @@ struct mparena { u16 name; }; +struct savelocation_2d8 { + u32 unk00; + u16 unk04; +}; + struct savelocation { /*0x000*/ struct savelocation00 *unk000; /*0x004*/ u32 unk004; /*0x008*/ u32 unk008; - /*0x00c*/ u32 unk00c; - /*0x010*/ u32 unk010; - /*0x014*/ u32 unk014; - /*0x018*/ u32 unk018; + /*0x00c*/ u32 unk00c[4]; /*0x01c*/ u32 unk01c; /*0x020*/ u32 unk020; /*0x024*/ u32 unk024; @@ -4882,14 +4884,7 @@ struct savelocation { /*0x2cc*/ u32 unk2cc; /*0x2d0*/ u16 unk2d0; /*0x2d2*/ s8 spacesfree[4]; - /*0x2d8*/ u32 unk2d8; - /*0x2dc*/ u32 unk2dc; - /*0x2e0*/ u32 unk2e0; - /*0x2e4*/ u32 unk2e4; - /*0x2e8*/ u32 unk2e8; - /*0x2ec*/ u32 unk2ec; - /*0x2f0*/ u32 unk2f0; - /*0x2f4*/ u32 unk2f4; + /*0x2d8*/ struct savelocation_2d8 unk2d8[4]; /*0x2f8*/ u32 unk2f8; /*0x2fc*/ u32 unk2fc; /*0x300*/ u32 unk300; @@ -4901,6 +4896,11 @@ struct savelocation { /*0x30c*/ u8 unk30c; // inuse? }; +struct var80075bc0 { + struct savelocation *locations[4]; + bool unk10[4]; +}; + struct challenge { /*0x00*/ u16 name; /*0x02*/ s16 confignum;