forked from Ports/perfect_dark
mpsetups: a bunch of bug fixes
- "load settings" becoming invalid when entering and exiting the challenges screen - when setting a setup as default, it would change the current setup - larger window width causing the marquee text to be rendered off-bounds - reduced the setup name's max length, as it wouldn't fit on the screen in some cases
This commit is contained in:
1 parent
0316317aa3
commit
6198fbc479
4 files changed
+22
-16
No files matched your search
+12
-8
@@ -154,8 +154,8 @@ struct menuitem g_RenameSetupItems[] = {
|
||||
{
|
||||
MENUITEMTYPE_LABEL,
|
||||
0,
|
||||
MENUITEMFLAG_LESSLEFTPADDING,
|
||||
L_MPMENU_189, // "Enter a name for your game setup file:"
|
||||
MENUITEMFLAG_LITERAL_TEXT | MENUITEMFLAG_LESSLEFTPADDING,
|
||||
(uintptr_t)"Enter the setup name:\n",
|
||||
0,
|
||||
NULL,
|
||||
},
|
||||
@@ -663,9 +663,12 @@ static s32 deleteSetup()
|
||||
memcpy(dst, src, MPSETUP_BLOCKSIZE);
|
||||
}
|
||||
|
||||
if (g_MpCurrentSetup >= slotindex) {
|
||||
if (g_MpCurrentSetup > slotindex) {
|
||||
g_MpCurrentSetup--;
|
||||
}
|
||||
else if (g_MpCurrentSetup == slotindex) {
|
||||
g_MpCurrentSetup = -1;
|
||||
}
|
||||
|
||||
if (g_MpSetupFile.defaultsetup > slotindex + 1) {
|
||||
g_MpSetupFile.defaultsetup--;
|
||||
@@ -802,8 +805,10 @@ s32 exportMpSetupFile()
|
||||
{
|
||||
struct mpsetupfile expMpSetupFile;
|
||||
expMpSetupFile.numsetups = 0;
|
||||
|
||||
u8 maxsetups = g_MpImportExportFilter[1] == 0 ? 64 : 128;
|
||||
expMpSetupFile.defaultsetup = 0;
|
||||
expMpSetupFile.version = MPSETUP_VERSION;
|
||||
|
||||
u8 maxsetups = MPSETUP_MAXSETUPS;
|
||||
maxsetups = MIN(maxsetups, g_MpSetupFile.numsetups);
|
||||
for (int i = 0; i < maxsetups; ++i) {
|
||||
u8 bank = i < 64 ? 0 : 1;
|
||||
@@ -840,13 +845,12 @@ static s32 mpsetupSaveFile(u8 op, struct mpsetupfile *setupfile)
|
||||
if (nwritten < 1) {
|
||||
fsFileFree(f);
|
||||
sysLogPrintf(LOG_ERROR, "Unable to write the MP setup file");
|
||||
sprintf(g_StatusText, "Unable to write the setup file\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
fsFileFree(f);
|
||||
|
||||
// reload the file to update in-memory structs
|
||||
return mpsetupLoadCurrentFile();
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 mpsetupSaveSetup(s32 slotindex, u8 savefile)
|
||||
|
||||
@@ -459,6 +459,7 @@ MenuItemHandlerResult menuhandlerMpConfirmSaveChr(s32 operation, struct menuitem
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern struct menudialogdef g_StatusErrorDialog;
|
||||
MenuItemHandlerResult menuhandlerMpSetupName(s32 operation, struct menuitem *item, union handlerdata *data)
|
||||
{
|
||||
char *name = data->keyboard.string;
|
||||
@@ -475,10 +476,10 @@ MenuItemHandlerResult menuhandlerMpSetupName(s32 operation, struct menuitem *ite
|
||||
err = mpsetupSaveSetup(g_MpSetupFile.numsetups, true);
|
||||
if (!err) {
|
||||
menuPushDialog(&g_FilemgrFileSavedMenuDialog);
|
||||
g_MpCurrentSetup = g_MpSetupFile.numsetups - 1;
|
||||
}
|
||||
else {
|
||||
// menuPushDialog(&g_FilemgrErrorMenuDialog);
|
||||
// TODO
|
||||
menuPushDialog(&g_StatusErrorDialog);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1092,8 +1093,8 @@ struct menuitem g_MpSaveSetupNameMenuItems[] = {
|
||||
{
|
||||
MENUITEMTYPE_LABEL,
|
||||
0,
|
||||
MENUITEMFLAG_LESSLEFTPADDING,
|
||||
L_MPMENU_189, // "Enter a name for your game setup file:"
|
||||
MENUITEMFLAG_LITERAL_TEXT | MENUITEMFLAG_LESSLEFTPADDING,
|
||||
(uintptr_t)"Enter the setup name:\n",
|
||||
0,
|
||||
NULL,
|
||||
},
|
||||
@@ -2322,7 +2323,7 @@ MenuItemHandlerResult mpLoadSettingsMenuHandler(s32 operation, struct menuitem *
|
||||
|
||||
char *mpMenuTextMpconfigMarquee(struct menuitem *item)
|
||||
{
|
||||
char filename[20];
|
||||
char filename[MPSETUP_MAXNAME+1];
|
||||
u16 numsims;
|
||||
u16 stagenum;
|
||||
u16 scenarionum;
|
||||
@@ -2628,7 +2629,7 @@ struct menuitem g_MpLoadSettingsMenuItems[] = {
|
||||
MENUITEMTYPE_LIST,
|
||||
0,
|
||||
0,
|
||||
160,
|
||||
0x00000078,
|
||||
0x00000042,
|
||||
mpLoadSettingsMenuHandler,
|
||||
},
|
||||
|
||||
@@ -4757,7 +4757,7 @@ enum weaponnum {
|
||||
#define EXTRA_SLEEP_TIME 1000LL // 100us
|
||||
|
||||
#define MPSETUP_MAXSETUPS 128
|
||||
#define MPSETUP_MAXNAME 18
|
||||
#define MPSETUP_MAXNAME 17
|
||||
#define MPSETUP_BLOCKSIZE 80
|
||||
|
||||
#endif
|
||||
|
||||
+2
-1
@@ -3983,13 +3983,14 @@ struct menu {
|
||||
union {
|
||||
struct menudata_endscreen endscreen;
|
||||
struct menudata_main main;
|
||||
struct menudata_mpsetup mpsetup;
|
||||
struct menudata_mppause mppause;
|
||||
struct menudata_mpend mpend;
|
||||
struct menudata_filemgr fm;
|
||||
struct menudata_main4mb main4mb;
|
||||
struct menudata_training training;
|
||||
};
|
||||
|
||||
struct menudata_mpsetup mpsetup;
|
||||
};
|
||||
|
||||
struct gamefile {
|
||||
|
||||
Reference in new issue
Block a user