Discover fileops and introduce FILEOP constants

This commit is contained in:
Ryan Dwyer 2021-09-13 23:19:17 +10:00
parent 4751fbe618
commit fcecbb557b
10 changed files with 188 additions and 168 deletions

View File

@ -1365,7 +1365,7 @@ void endscreenPrepare(void)
}
}
func0f1094e4(&g_FilemgrLoadedMainFile, 0, 0);
func0f1094e4(&g_FilemgrLoadedMainFile, FILEOP_SAVE_GAME_000, 0);
}
if (g_MenuData.root == MENUROOT_ENDSCREEN) {
@ -1666,7 +1666,7 @@ void soloPushCoopModeEndscreen(void)
}
if (g_Vars.currentplayer == g_Vars.bond) {
func0f1094e4(&g_FilemgrLoadedMainFile, 0, NULL);
func0f1094e4(&g_FilemgrLoadedMainFile, FILEOP_SAVE_GAME_000, NULL);
}
g_MpPlayerNum = prevplayernum;
@ -1806,7 +1806,7 @@ void soloPushAntiModeEndscreen(void)
}
}
func0f1094e4(&g_FilemgrLoadedMainFile, 0, 0);
func0f1094e4(&g_FilemgrLoadedMainFile, FILEOP_SAVE_GAME_000, 0);
} else {
if (g_Vars.anti->aborted == 0 &&
(g_Vars.bond->isdead || g_Vars.bond->aborted || objectiveIsAllComplete() == false)) {

View File

@ -4147,7 +4147,7 @@ s32 menudialog0010559c(s32 operation, struct menudialog *dialog, union handlerda
break;
case MENUOP_CLOSE:
if ((g_Vars.modifiedfiles & MODFILE_SOLO) && g_Vars.coopplayernum < 0 && g_Vars.antiplayernum < 0) {
if (func0f1094e4(&g_FilemgrLoadedMainFile, 1, 0) == 0) {
if (func0f1094e4(&g_FilemgrLoadedMainFile, FILEOP_SAVE_GAME_001, 0) == 0) {
data->dialog1.preventclose = true;
}
@ -4248,7 +4248,7 @@ s32 menuhandlerControlStyle(s32 operation, struct menuitem *item, union handlerd
s32 menuhandler001057ec(s32 operation, struct menuitem *item, union handlerdata *data)
{
if (operation == MENUOP_SET) {
func0f1094e4(&g_FilemgrLoadedMainFile, 2, 0);
func0f1094e4(&g_FilemgrLoadedMainFile, FILEOP_SAVE_GAME_002, 0);
}
return 0;

View File

@ -142,7 +142,7 @@ void filemgrGetSelectName(char *buffer, struct filelistfile *file, u32 filetype)
s32 totalinhours;
switch (filetype) {
case FILETYPE_SOLO:
case FILETYPE_GAME:
case FILETYPE_MPSETUP:
func0f0d564c(file->unk06, tmpbuffer1, false);
break;
@ -375,26 +375,26 @@ char *filemgrMenuTextErrorTitle(struct menuitem *item)
L_OPTIONS_339, // "Error"
};
switch (g_Menus[g_MpPlayerNum].unke42) {
case 100:
case 102:
switch (g_Menus[g_MpPlayerNum].fileop) {
case FILEOP_LOAD_GAME:
case FILEOP_LOAD_MPSETUP:
return langGet(messages[0]);
case 0:
case 1:
case 2:
case 4:
case FILEOP_SAVE_GAME_000:
case FILEOP_SAVE_GAME_001:
case FILEOP_SAVE_GAME_002:
case FILEOP_SAVE_MPSETUP:
return langGet(messages[1]);
case 101:
case FILEOP_LOAD_MPPLAYER:
return langGet(messages[2]);
case 3:
case FILEOP_SAVE_MPPLAYER:
return langGet(messages[3]);
case 104:
case 105:
case 106:
case FILEOP_READ_GAME:
case FILEOP_READ_MPSETUP:
case FILEOP_READ_MPPLAYER:
return langGet(messages[6]);
case 6:
case 7:
case 8:
case FILEOP_WRITE_GAME:
case FILEOP_WRITE_MPSETUP:
case FILEOP_WRITE_MPPLAYER:
return langGet(messages[7]);
}
@ -411,23 +411,23 @@ char *filemgrMenuTextFileType(struct menuitem *item)
L_OPTIONS_106, // "PerfectHead Files"
};
switch (g_Menus[g_MpPlayerNum].unke42) {
case 0:
case 1:
case 2:
case 6:
case 100:
case 104:
switch (g_Menus[g_MpPlayerNum].fileop) {
case FILEOP_SAVE_GAME_000:
case FILEOP_SAVE_GAME_001:
case FILEOP_SAVE_GAME_002:
case FILEOP_WRITE_GAME:
case FILEOP_LOAD_GAME:
case FILEOP_READ_GAME:
return langGet(names[0]);
case 4:
case 7:
case 102:
case 105:
case FILEOP_SAVE_MPSETUP:
case FILEOP_WRITE_MPSETUP:
case FILEOP_LOAD_MPSETUP:
case FILEOP_READ_MPSETUP:
return langGet(names[1]);
case 3:
case 8:
case 101:
case 106:
case FILEOP_SAVE_MPPLAYER:
case FILEOP_WRITE_MPPLAYER:
case FILEOP_LOAD_MPPLAYER:
case FILEOP_READ_MPPLAYER:
return langGet(names[2]);
}
@ -439,41 +439,41 @@ void func0f10898c(void)
{
func0f0f0ca0(-1, false);
switch (g_Menus[g_MpPlayerNum].unke42) {
case 6:
case 7:
case 8:
case 104:
case 105:
case 106:
switch (g_Menus[g_MpPlayerNum].fileop) {
case FILEOP_WRITE_GAME:
case FILEOP_WRITE_MPSETUP:
case FILEOP_WRITE_MPPLAYER:
case FILEOP_READ_GAME:
case FILEOP_READ_MPSETUP:
case FILEOP_READ_MPPLAYER:
func00012cb4(g_Menus[g_MpPlayerNum].unke44, align16(var7f1b2f3c[g_Menus[g_MpPlayerNum].data.filemgr.filetypeplusone - 1]));
break;
case 100:
case 101:
case 102:
case 103:
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case FILEOP_LOAD_GAME:
case FILEOP_LOAD_MPPLAYER:
case FILEOP_LOAD_MPSETUP:
case FILEOP_103:
case FILEOP_SAVE_GAME_000:
case FILEOP_SAVE_GAME_001:
case FILEOP_SAVE_GAME_002:
case FILEOP_SAVE_MPPLAYER:
case FILEOP_SAVE_MPSETUP:
case FILEOP_005:
break;
}
}
void func0f108a80(void)
void filemgrHandleSuccess(void)
{
func0f0f0ca0(-1, false);
switch (g_Menus[g_MpPlayerNum].unke42) {
case 6:
case 7:
case 8:
switch (g_Menus[g_MpPlayerNum].fileop) {
case FILEOP_WRITE_GAME:
case FILEOP_WRITE_MPSETUP:
case FILEOP_WRITE_MPPLAYER:
func00012cb4(g_Menus[g_MpPlayerNum].unke44,
align16(var7f1b2f3c[g_Menus[g_MpPlayerNum].data.filemgr.filetypeplusone - 1]));
break;
case 100:
case FILEOP_LOAD_GAME:
g_Vars.unk00047c = g_Menus[g_MpPlayerNum].unke48;
g_Vars.unk000480 = g_Menus[g_MpPlayerNum].unke4c;
func0f1109c0();
@ -484,22 +484,22 @@ void func0f108a80(void)
func0f0f820c(&g_CiMenuViaPcMenuDialog, MENUROOT_MAINMENU);
}
break;
case 104:
case 105:
case 106:
case FILEOP_READ_GAME:
case FILEOP_READ_MPSETUP:
case FILEOP_READ_MPPLAYER:
func0f1094e4(&var800a21e8,
g_Menus[g_MpPlayerNum].unke42 - 98,
g_Menus[g_MpPlayerNum].fileop - 98,
g_Menus[g_MpPlayerNum].unke44);
break;
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 101:
case 102:
case 103:
case FILEOP_SAVE_GAME_000:
case FILEOP_SAVE_GAME_001:
case FILEOP_SAVE_GAME_002:
case FILEOP_SAVE_MPPLAYER:
case FILEOP_SAVE_MPSETUP:
case FILEOP_005:
case FILEOP_LOAD_MPPLAYER:
case FILEOP_LOAD_MPSETUP:
case FILEOP_103:
break;
}
}
@ -516,28 +516,28 @@ s32 filemgrRetrySaveMenuHandler(s32 operation, struct menuitem *item, union hand
s32 filemgrSaveElsewhereYesMenuHandler(s32 operation, struct menuitem *item, union handlerdata *data)
{
if (operation == MENUOP_SET) {
s32 sp1c;
s32 filetype;
menuCloseDialog();
switch (g_Menus[g_MpPlayerNum].unke42) {
case 0:
case 1:
case 2:
case 6:
sp1c = 0;
switch (g_Menus[g_MpPlayerNum].fileop) {
case FILEOP_SAVE_GAME_000:
case FILEOP_SAVE_GAME_001:
case FILEOP_SAVE_GAME_002:
case FILEOP_WRITE_GAME:
filetype = FILETYPE_GAME;
break;
case 3:
case 8:
sp1c = 2;
case FILEOP_SAVE_MPPLAYER:
case FILEOP_WRITE_MPPLAYER:
filetype = FILETYPE_MPPLAYER;
break;
case 4:
case 7:
sp1c = 1;
case FILEOP_SAVE_MPSETUP:
case FILEOP_WRITE_MPSETUP:
filetype = FILETYPE_MPSETUP;
break;
}
filemgrPushSelectLocationDialog(g_Menus[g_MpPlayerNum].unke42 + 9, sp1c);
filemgrPushSelectLocationDialog(g_Menus[g_MpPlayerNum].fileop + 9, filetype);
}
return 0;
@ -624,7 +624,7 @@ s32 filemgrReinsertedOkMenuHandler(s32 operation, struct menuitem *item, union h
s32 filemgrReinsertedCancelMenuHandler(s32 operation, struct menuitem *item, union handlerdata *data)
{
if (operation == MENUOP_SET) {
if (g_Menus[g_MpPlayerNum].unke42 < 100 && g_Menus[g_MpPlayerNum].unke42 != 1) {
if (FILEOP_IS_SAVE(g_Menus[g_MpPlayerNum].fileop) && g_Menus[g_MpPlayerNum].fileop != FILEOP_SAVE_GAME_001) {
func0f0f3704(&g_FilemgrSaveElsewhereMenuDialog);
} else {
menuPopDialog();
@ -681,11 +681,11 @@ void filemgrRetrySave(s32 context)
if (context == 2) {
func0f0f3704(&g_PakNotOriginalMenuDialog);
}
} else if (fileSave(index, true)) {
} else if (filemgrAttemptOperation(index, true)) {
if (context == 2) {
g_Menus[g_MpPlayerNum].unke3c = index;
if (g_Menus[g_MpPlayerNum].unke42 < 100) {
if (FILEOP_IS_SAVE(g_Menus[g_MpPlayerNum].fileop)) {
filemgrPushErrorDialog(FILEERROR_SAVEFAILED);
} else {
filemgrPushErrorDialog(FILEERROR_LOADFAILED);
@ -693,7 +693,7 @@ void filemgrRetrySave(s32 context)
} else {
func0f108324(g_Menus[g_MpPlayerNum].unke4c);
if (g_Menus[g_MpPlayerNum].unke42 < 100) {
if (FILEOP_IS_SAVE(g_Menus[g_MpPlayerNum].fileop)) {
func0f0f3704(&g_FilemgrSaveErrorMenuDialog);
} else {
#if VERSION >= VERSION_NTSC_1_0
@ -708,65 +708,65 @@ void filemgrRetrySave(s32 context)
}
#if VERSION >= VERSION_NTSC_1_0
bool fileSave(s32 arg0, bool arg1)
bool filemgrAttemptOperation(s32 arg0, bool arg1)
{
s32 errno = 0;
u32 sp40 = (g_Menus[g_MpPlayerNum].isretryingsave & 1) != 0;
bool showfilesaved = (g_Menus[g_MpPlayerNum].isretryingsave & 1) != 0;
const s32 sp30[] = {0x80, 0x40, 0x20, 0x08};
s32 sp2c;
switch (g_Menus[g_MpPlayerNum].unke42) {
case 2:
sp40 = 1;
switch (g_Menus[g_MpPlayerNum].fileop) {
case FILEOP_SAVE_GAME_002:
showfilesaved = true;
// fall through
case 0:
case 1:
case FILEOP_SAVE_GAME_000:
case FILEOP_SAVE_GAME_001:
errno = gamefileSave(arg0,
g_Menus[g_MpPlayerNum].unke48,
g_Menus[g_MpPlayerNum].unke4c);
break;
case 3:
case FILEOP_SAVE_MPPLAYER:
errno = func0f18d9fc(
g_Menus[g_MpPlayerNum].unke44, arg0,
g_Menus[g_MpPlayerNum].unke48,
g_Menus[g_MpPlayerNum].unke4c);
break;
case 4:
case FILEOP_SAVE_MPSETUP:
errno = func0f18e420(arg0,
g_Menus[g_MpPlayerNum].unke48,
g_Menus[g_MpPlayerNum].unke4c);
sp40 = 1;
showfilesaved = true;
break;
case 6:
case 7:
case 8:
case FILEOP_WRITE_GAME:
case FILEOP_WRITE_MPSETUP:
case FILEOP_WRITE_MPPLAYER:
sp2c = 0;
func0f0d5690(g_Menus[g_MpPlayerNum].unke44, g_Menus[g_MpPlayerNum].unke53);
errno = func0f116828(arg0,
g_Menus[g_MpPlayerNum].unke48,
sp30[g_Menus[g_MpPlayerNum].unke42 - 6],
sp30[g_Menus[g_MpPlayerNum].fileop - 6],
g_Menus[g_MpPlayerNum].unke44, &sp2c, 0);
var80075bd0[g_Menus[g_MpPlayerNum].unke42 - 6] = 1;
var80075bd0[g_Menus[g_MpPlayerNum].fileop - 6] = 1;
break;
case 100:
case FILEOP_LOAD_GAME:
errno = gamefileLoad(arg0);
break;
case 101:
case FILEOP_LOAD_MPPLAYER:
errno = func0f18dac0(
g_Menus[g_MpPlayerNum].unke44,
arg0,
g_Menus[g_MpPlayerNum].unke48,
g_Menus[g_MpPlayerNum].unke4c);
break;
case 102:
case FILEOP_LOAD_MPSETUP:
errno = func0f18e4c8(arg0,
g_Menus[g_MpPlayerNum].unke48,
g_Menus[g_MpPlayerNum].unke4c);
break;
case 104:
case 105:
case 106:
case FILEOP_READ_GAME:
case FILEOP_READ_MPSETUP:
case FILEOP_READ_MPPLAYER:
errno = func0f116800(arg0,
g_Menus[g_MpPlayerNum].unke48,
g_Menus[g_MpPlayerNum].unke44, 0);
@ -777,17 +777,17 @@ bool fileSave(s32 arg0, bool arg1)
menuCloseDialog();
}
if (g_Menus[g_MpPlayerNum].unke42 < 100) {
if (FILEOP_IS_SAVE(g_Menus[g_MpPlayerNum].fileop)) {
if (errno == 0) {
func0f108a80();
filemgrHandleSuccess();
}
if (sp40 && errno == 0) {
if (showfilesaved && errno == 0) {
menuPushDialog(&g_FilemgrFileSavedMenuDialog);
}
} else {
if (errno == 0) {
func0f108a80();
filemgrHandleSuccess();
}
}
@ -799,40 +799,40 @@ bool fileSave(s32 arg0, bool arg1)
const s32 var7f1ad258nb[] = {0x80, 0x40, 0x20, 0x08};
GLOBAL_ASM(
glabel fileSave
glabel filemgrAttemptOperation
.late_rodata
glabel var7f1ad3e8nb
.word fileSave+0x1a8
.word filemgrAttemptOperation+0x1a8
glabel var7f1ad3ecnb
.word fileSave+0x1b8
.word filemgrAttemptOperation+0x1b8
glabel var7f1ad3f0nb
.word fileSave+0x1d4
.word filemgrAttemptOperation+0x1d4
glabel var7f1ad3f4nb
.word fileSave+0x210
.word filemgrAttemptOperation+0x210
glabel var7f1ad3f8nb
.word fileSave+0x1ec
.word filemgrAttemptOperation+0x1ec
glabel var7f1ad3fcnb
.word fileSave+0x1ec
.word filemgrAttemptOperation+0x1ec
glabel var7f1ad400nb
.word fileSave+0x1ec
.word filemgrAttemptOperation+0x1ec
glabel var7f1ad404nb
.word fileSave+0x0dc
.word filemgrAttemptOperation+0x0dc
glabel var7f1ad408nb
.word fileSave+0x0dc
.word filemgrAttemptOperation+0x0dc
glabel var7f1ad40cnb
.word fileSave+0x0d4
.word filemgrAttemptOperation+0x0d4
glabel var7f1ad410nb
.word fileSave+0x0f4
.word filemgrAttemptOperation+0x0f4
glabel var7f1ad414nb
.word fileSave+0x110
.word filemgrAttemptOperation+0x110
glabel var7f1ad418nb
.word fileSave+0x210
.word filemgrAttemptOperation+0x210
glabel var7f1ad41cnb
.word fileSave+0x130
.word filemgrAttemptOperation+0x130
glabel var7f1ad420nb
.word fileSave+0x130
.word filemgrAttemptOperation+0x130
glabel var7f1ad424nb
.word fileSave+0x130
.word filemgrAttemptOperation+0x130
.text
/* f104a8c: 3c0e8007 */ lui $t6,0x8007
/* f104a90: 8dce3af0 */ lw $t6,0x3af0($t6)
@ -993,7 +993,7 @@ glabel var7f1ad424nb
/* f104cf0: 00000000 */ sll $zero,$zero,0x0
/* f104cf4: 54c00005 */ bnezl $a2,.NB0f104d0c
/* f104cf8: 8faa0040 */ lw $t2,0x40($sp)
/* f104cfc: 0fc41127 */ jal func0f108a80
/* f104cfc: 0fc41127 */ jal filemgrHandleSuccess
/* f104d00: afa60044 */ sw $a2,0x44($sp)
/* f104d04: 8fa60044 */ lw $a2,0x44($sp)
/* f104d08: 8faa0040 */ lw $t2,0x40($sp)
@ -1010,7 +1010,7 @@ glabel var7f1ad424nb
.NB0f104d30:
/* f104d30: 14c00004 */ bnez $a2,.NB0f104d44
/* f104d34: 00000000 */ sll $zero,$zero,0x0
/* f104d38: 0fc41127 */ jal func0f108a80
/* f104d38: 0fc41127 */ jal filemgrHandleSuccess
/* f104d3c: afa60044 */ sw $a2,0x44($sp)
/* f104d40: 8fa60044 */ lw $a2,0x44($sp)
.NB0f104d44:
@ -1041,12 +1041,12 @@ const char var7f1b31d8[] = "COULD NOT DELETE\n";
const char var7f1b31ec[] = "Multiplayer %d was using that file...\n";
#endif
bool func0f1094e4(struct savelocation_2d8 *arg0, s32 arg1, void *arg2)
bool func0f1094e4(struct savelocation_2d8 *arg0, s32 fileop, void *arg2)
{
s32 value;
if (arg1 != -1) {
g_Menus[g_MpPlayerNum].unke42 = arg1;
if (fileop != -1) {
g_Menus[g_MpPlayerNum].fileop = fileop;
g_Menus[g_MpPlayerNum].unke44 = arg2;
g_Menus[g_MpPlayerNum].isretryingsave = 0;
var800a21f8.unk00 = 0;
@ -1055,7 +1055,7 @@ bool func0f1094e4(struct savelocation_2d8 *arg0, s32 arg1, void *arg2)
g_Menus[g_MpPlayerNum].unke48 = arg0->unk00;
g_Menus[g_MpPlayerNum].unke4c = arg0->unk04;
if (arg1 != -1) {
if (fileop != -1) {
// empty
}
@ -1067,11 +1067,11 @@ bool func0f1094e4(struct savelocation_2d8 *arg0, s32 arg1, void *arg2)
return false;
}
if (fileSave(value, false) != 0) {
if (filemgrAttemptOperation(value, false) != 0) {
g_Menus[g_MpPlayerNum].isretryingsave |= 1;
func0f108324(g_Menus[g_MpPlayerNum].unke4c);
if (g_Menus[g_MpPlayerNum].unke42 < 100) {
if (FILEOP_IS_SAVE(g_Menus[g_MpPlayerNum].fileop)) {
menuPushDialog(&g_FilemgrSaveErrorMenuDialog);
} else {
#if VERSION >= VERSION_NTSC_1_0
@ -1237,7 +1237,7 @@ void func0f109954(s32 arg0)
g_FilemgrLoadedMainFile.unk00 = g_FileLists[0]->unk2d8[arg0].unk00;
g_FilemgrLoadedMainFile.unk04 = g_FileLists[0]->unk2d8[arg0].unk04;
func0f1094e4(&g_FilemgrLoadedMainFile, 0, NULL);
func0f1094e4(&g_FilemgrLoadedMainFile, FILEOP_SAVE_GAME_000, NULL);
}
}
@ -1250,7 +1250,7 @@ void filemgrGetFileName(char *dst, struct filelistfile *file)
localbuffer[0] = '\0';
switch (g_FileLists[g_Menus[g_MpPlayerNum].listnum]->filetype) {
case FILETYPE_SOLO:
case FILETYPE_GAME:
case FILETYPE_MPSETUP:
func0f0d564c(file->unk06, localbuffer, false);
break;
@ -1454,12 +1454,12 @@ void func0f109ec4(void)
struct savelocation_2d8 thing;
thing.unk00 = g_FileLists[g_Menus[g_MpPlayerNum].listnum]->unk2d8[g_Menus[g_MpPlayerNum].device].unk00;
thing.unk04 = g_FileLists[g_Menus[g_MpPlayerNum].listnum]->unk2d8[g_Menus[g_MpPlayerNum].device].unk04;
func0f1094e4(&thing, 3, (void *)g_MpPlayerNum);
func0f1094e4(&thing, FILEOP_SAVE_MPPLAYER, (void *)g_MpPlayerNum);
} else if (g_Menus[g_MpPlayerNum].unke3e == 7) {
struct savelocation_2d8 thing;
thing.unk00 = g_FileLists[g_Menus[g_MpPlayerNum].listnum]->unk2d8[g_Menus[g_MpPlayerNum].device].unk00;
thing.unk04 = g_FileLists[g_Menus[g_MpPlayerNum].listnum]->unk2d8[g_Menus[g_MpPlayerNum].device].unk04;
func0f1094e4(&thing, 4, NULL);
func0f1094e4(&thing, FILEOP_SAVE_MPSETUP, NULL);
} else if (g_Menus[g_MpPlayerNum].unke3e >= 9) {
struct savelocation_2d8 thing;
thing.unk00 = g_FileLists[g_Menus[g_MpPlayerNum].listnum]->unk2d8[g_Menus[g_MpPlayerNum].device].unk00;
@ -1888,10 +1888,10 @@ s32 filemgrDeleteFilesForSaveMenuHandler(s32 operation, struct menuitem *item, u
return 0;
}
void filemgrPushSelectLocationDialog(s32 arg0, u32 arg1)
void filemgrPushSelectLocationDialog(s32 arg0, u32 filetype)
{
g_Menus[g_MpPlayerNum].unke3e = arg0;
g_Menus[g_MpPlayerNum].listnum = func0f110cf8(arg1);
g_Menus[g_MpPlayerNum].listnum = func0f110cf8(filetype);
#if VERSION >= VERSION_NTSC_1_0
func0f110da8();
@ -2145,7 +2145,7 @@ s32 filemgrCopyOrDeleteListMenuDialog(s32 operation, struct menudialog *dialog,
if (g_Menus[g_MpPlayerNum].data.filemgr.isdeletingforsave == true) {
g_Menus[g_MpPlayerNum].data.filemgr.isdeletingforsave = false;
} else {
func0f110c5c(0, FILETYPE_SOLO);
func0f110c5c(0, FILETYPE_GAME);
g_Menus[g_MpPlayerNum].data.filemgr.filetypeplusone = 0;
}
}
@ -2557,7 +2557,7 @@ s32 filemgrAgentNameKeyboardMenuHandler(s32 operation, struct menuitem *item, un
strcpy(g_GameFile.name, name);
break;
case MENUOP_SET:
filemgrPushSelectLocationDialog(0, 0);
filemgrPushSelectLocationDialog(0, FILETYPE_GAME);
g_Menus[g_MpPlayerNum].data.filemgr.unke2c = 1;
break;
}
@ -2764,7 +2764,7 @@ s32 filemgrChooseAgentListMenuHandler(s32 operation, struct menuitem *item, unio
if (file) {
g_FilemgrLoadedMainFile.unk00 = file->unk00;
g_FilemgrLoadedMainFile.unk04 = file->unk04;
func0f1094e4(&g_FilemgrLoadedMainFile, 100, 0);
func0f1094e4(&g_FilemgrLoadedMainFile, FILEOP_LOAD_GAME, 0);
}
}
break;
@ -2796,7 +2796,7 @@ s32 filemgrMainMenuDialog(s32 operation, struct menudialog *dialog, union handle
case MENUOP_OPEN:
g_Menus[g_MpPlayerNum].data.filemgr.filetypeplusone = 0;
func0f110c5c(0, FILETYPE_SOLO);
func0f110c5c(0, FILETYPE_GAME);
mpSetDefaultSetup();
// Set MP player names to "Player 1" through 4 if blank
@ -3039,12 +3039,12 @@ struct menudialog g_PakChoosePakMenuDialog = {
struct menuitem g_FilemgrOperationsMenuItems[] = {
{ MENUITEMTYPE_LABEL, 0, 0x00004010, L_OPTIONS_100, 0x00000000, NULL }, // "Copy:"
{ MENUITEMTYPE_SELECTABLE, FILETYPE_SOLO, 0x00000000, L_OPTIONS_103, 0x00000000, filemgrOpenCopyFileMenuHandler }, // "Single Player Agent File"
{ MENUITEMTYPE_SELECTABLE, FILETYPE_GAME, 0x00000000, L_OPTIONS_103, 0x00000000, filemgrOpenCopyFileMenuHandler }, // "Single Player Agent File"
{ MENUITEMTYPE_SELECTABLE, FILETYPE_MPSETUP , 0x00000000, L_OPTIONS_104, 0x00000000, filemgrOpenCopyFileMenuHandler }, // "Combat Simulator Settings File"
{ MENUITEMTYPE_SELECTABLE, FILETYPE_MPPLAYER, 0x00000000, L_OPTIONS_105, 0x00000000, filemgrOpenCopyFileMenuHandler }, // "Combat Simulator Player File"
{ MENUITEMTYPE_SEPARATOR, 0, 0x00000000, 0x00000000, 0x00000000, NULL },
{ MENUITEMTYPE_LABEL, 0, 0x00004010, L_OPTIONS_101, 0x00000000, NULL }, // "Delete:"
{ MENUITEMTYPE_SELECTABLE, FILETYPE_SOLO, 0x00000000, L_OPTIONS_103, 0x00000000, filemgrOpenDeleteFileMenuHandler }, // "Single Player Agent File"
{ MENUITEMTYPE_SELECTABLE, FILETYPE_GAME, 0x00000000, L_OPTIONS_103, 0x00000000, filemgrOpenDeleteFileMenuHandler }, // "Single Player Agent File"
{ MENUITEMTYPE_SELECTABLE, FILETYPE_MPSETUP, 0x00000000, L_OPTIONS_104, 0x00000000, filemgrOpenDeleteFileMenuHandler }, // "Combat Simulator Settings File"
{ MENUITEMTYPE_SELECTABLE, FILETYPE_MPPLAYER, 0x00000000, L_OPTIONS_105, 0x00000000, filemgrOpenDeleteFileMenuHandler }, // "Combat Simulator Player File"
{ MENUITEMTYPE_SEPARATOR, 0, 0x00000000, 0x00000000, 0x00000000, NULL },

View File

@ -536,7 +536,7 @@ s32 mpConfirmPlayerNameHandler(s32 operation, struct menuitem *item, union handl
}
break;
case MENUOP_SET:
filemgrPushSelectLocationDialog(6, 2);
filemgrPushSelectLocationDialog(6, FILETYPE_MPPLAYER);
break;
}

View File

@ -546,13 +546,13 @@ s32 menuhandlerMpConfirmSaveChr(s32 operation, struct menuitem *item, union hand
{
if (operation == MENUOP_SET) {
menuPopDialog();
filemgrPushSelectLocationDialog(6, 2);
filemgrPushSelectLocationDialog(6, FILETYPE_MPPLAYER);
}
return 0;
}
s32 menuhandlerMpPlayerName(s32 operation, struct menuitem *item, union handlerdata *data)
s32 menuhandlerMpSetupName(s32 operation, struct menuitem *item, union handlerdata *data)
{
char *name = data->keyboard.string;
@ -564,7 +564,7 @@ s32 menuhandlerMpPlayerName(s32 operation, struct menuitem *item, union handlerd
strcpy(g_MpSetup.name, name);
break;
case MENUOP_SET:
filemgrPushSelectLocationDialog(7, 1);
filemgrPushSelectLocationDialog(7, FILETYPE_MPSETUP);
break;
}
@ -575,7 +575,7 @@ s32 menuhandlerMpSaveSetupOverwrite(s32 operation, struct menuitem *item, union
{
if (operation == MENUOP_SET) {
menuPopDialog();
func0f1094e4(&g_MpSetup.unk20, 4, NULL);
func0f1094e4(&g_MpSetup.unk20, FILEOP_SAVE_MPSETUP, NULL);
}
return 0;
@ -2338,7 +2338,7 @@ struct menudialog g_MpSavePlayerMenuDialog = {
struct menuitem g_MpSaveSetupNameMenuItems[] = {
{ MENUITEMTYPE_LABEL, 0, 0x00000010, L_MPMENU_189, 0x00000000, NULL }, // "Enter a name for your game setup file:"
{ MENUITEMTYPE_KEYBOARD, 0, 0x00000000, 0x00000000, 0x00000000, menuhandlerMpPlayerName },
{ MENUITEMTYPE_KEYBOARD, 0, 0x00000000, 0x00000000, 0x00000000, menuhandlerMpSetupName },
{ MENUITEMTYPE_END, 0, 0x00000000, 0x00000000, 0x00000000, NULL },
};
@ -4521,7 +4521,7 @@ s32 menudialogMpReady(s32 operation, struct menudialog *dialog, union handlerdat
{
if (operation == MENUOP_OPEN) {
if (g_MpPlayers[g_MpPlayerNum].unk4c.unk00 && g_MpPlayers[g_MpPlayerNum].unk4c.unk04) {
func0f1094e4(&g_MpPlayers[g_MpPlayerNum].unk4c, 3, (void *)g_MpPlayerNum);
func0f1094e4(&g_MpPlayers[g_MpPlayerNum].unk4c, FILEOP_SAVE_MPPLAYER, (void *)g_MpPlayerNum);
}
}
@ -7408,7 +7408,7 @@ s32 menuhandlerMpSavePlayer(s32 operation, struct menuitem *item, union handlerd
{
if (operation == MENUOP_SET) {
if (g_MpPlayers[g_MpPlayerNum].unk4c.unk00 == false) {
filemgrPushSelectLocationDialog(6, 2);
filemgrPushSelectLocationDialog(6, FILETYPE_MPPLAYER);
} else {
menuPushDialog(&g_MpSavePlayerMenuDialog);
}

View File

@ -6426,7 +6426,7 @@ glabel var7f1b94e4
// case FRMENUTYPE_COMPLETED:
// sndStart(var80095200, SFX_TRAINING_COMPLETE, NULL, -1, -1, -1, -1, -1);
// func0f0f85e0(&g_FrCompletedMenuDialog, MENUROOT_TRAINING);
// func0f1094e4(&g_FilemgrLoadedMainFile, 0, 0);
// func0f1094e4(&g_FilemgrLoadedMainFile, FILEOP_SAVE_GAME_000, 0);
// break;
// }
// }

View File

@ -749,11 +749,31 @@
#define FILEERROR_PAKDAMAGED 7
#define FILEERROR_DELETENOTEFAILED 8
#define FILEOP_IS_LOAD(op) (op >= 100)
#define FILEOP_IS_SAVE(op) (op < 100)
#define FILEOP_SAVE_GAME_000 0 // from endscreens
#define FILEOP_SAVE_GAME_001 1 // from closing options dialog
#define FILEOP_SAVE_GAME_002 2
#define FILEOP_SAVE_MPPLAYER 3
#define FILEOP_SAVE_MPSETUP 4
#define FILEOP_005 5 // Perfect head?
#define FILEOP_WRITE_GAME 6
#define FILEOP_WRITE_MPSETUP 7
#define FILEOP_WRITE_MPPLAYER 8
#define FILEOP_LOAD_GAME 100
#define FILEOP_LOAD_MPPLAYER 101
#define FILEOP_LOAD_MPSETUP 102
#define FILEOP_103 103 // Perfect head?
#define FILEOP_READ_GAME 104
#define FILEOP_READ_MPSETUP 105
#define FILEOP_READ_MPPLAYER 106
#define FILESTATE_UNSELECTED 0
#define FILESTATE_SELECTED 1
#define FILESTATE_CHANGINGAGENT 2
#define FILETYPE_SOLO 0
#define FILETYPE_GAME 0
#define FILETYPE_MPSETUP 1
#define FILETYPE_MPPLAYER 2

View File

@ -18,12 +18,12 @@ s32 filemgrGetDeviceNameOrStartIndex(s32 listnum, s32 operation, s32 optionindex
char *filemgrMenuTextErrorTitle(struct menuitem *item);
char *filemgrMenuTextFileType(struct menuitem *item);
void func0f10898c(void);
void func0f108a80(void);
void filemgrHandleSuccess(void);
void filemgrEraseCorruptFile(void);
char *filemgrMenuTextInsertOriginalPak(struct menuitem *item);
void filemgrRetrySave(s32 arg0);
bool fileSave(s32 arg0, bool arg1);
bool func0f1094e4(struct savelocation_2d8 *arg0, s32 arg1, void *arg2);
bool filemgrAttemptOperation(s32 arg0, bool arg1);
bool func0f1094e4(struct savelocation_2d8 *arg0, s32 fileop, void *arg2);
void filemgrDeleteCurrentFile(void);
void func0f1097d0(s32 device);
void func0f109954(s32 arg0);
@ -36,7 +36,7 @@ char *filemgrMenuTextDeviceNameContainingDuplicateFile(struct menuitem *item);
char *filemgrMenuTextDuplicateFileName(struct menuitem *item);
char *filemgrMenuTextLocationName2(struct menuitem *item);
char *filemgrMenuTextSaveLocationSpaces(struct menuitem *item);
void filemgrPushSelectLocationDialog(s32 arg0, u32 arg1);
void filemgrPushSelectLocationDialog(s32 arg0, u32 filetype);
char *filemgrMenuTextFileInUseDescription(struct menuitem *item);
Gfx *filemgrRenderPerfectHeadThumbnail(Gfx *gdl, struct menuitemrenderdata *renderdata, u32 arg2, u32 arg3);
bool filemgrIsFileInUse(struct filelistfile *file);

View File

@ -128,7 +128,7 @@ s32 menuhandlerMpCheckboxOption(s32 operation, struct menuitem *item, union hand
s32 menuhandlerMpTeamsEnabled(s32 operation, struct menuitem *item, union handlerdata *data);
s32 menuhandlerMpDisplayOptionCheckbox(s32 operation, struct menuitem *item, union handlerdata *data);
s32 menuhandlerMpConfirmSaveChr(s32 operation, struct menuitem *item, union handlerdata *data);
s32 menuhandlerMpPlayerName(s32 operation, struct menuitem *item, union handlerdata *data);
s32 menuhandlerMpSetupName(s32 operation, struct menuitem *item, union handlerdata *data);
s32 menuhandlerMpSaveSetupOverwrite(s32 operation, struct menuitem *item, union handlerdata *data);
s32 menuhandlerMpSaveSetupCopy(s32 operation, struct menuitem *item, union handlerdata *data);
s32 menuhandlerMpCharacterBody(s32 operation, struct menuitem *item, union handlerdata *data);

View File

@ -4479,7 +4479,7 @@ struct menu {
/*0xe3f*/ u8 listnum;
/*0xe40*/ u8 unke40;
/*0xe41*/ u8 unke41;
/*0xe42*/ u8 unke42;
/*0xe42*/ u8 fileop;
/*0xe44*/ void *unke44;
/*0xe48*/ u32 unke48;
/*0xe4c*/ u32 unke4c;