mirror of https://github.com/PCSX2/pcsx2.git
gui: Simplify function and solve unlikely edge-case
If backups are enabled, the .backup file will have already been created via renaming the original save-state. The asynchronous process is dumping the current emulation state, but by the time we've hit this function the rename has already taken place so we have a guarantee. This solves a potential bug in the existing code (which probably would have never been hit): Save to slot that has no current backup Rename fails Update method looks for the file without .backup, which is still there. Load backup option is enabled despite there not actually being a backup to load.
This commit is contained in:
parent
288c8fedce
commit
717677402c
|
@ -71,7 +71,6 @@ void States_FreezeCurrentSlot()
|
|||
Console.WriteLn("Load or save action is already pending.");
|
||||
return;
|
||||
}
|
||||
States_updateLoadBackupMenuItem(true);
|
||||
|
||||
GSchangeSaveState(StatesC, SaveStateBase::GetFilename(StatesC).ToUTF8());
|
||||
StateCopy_SaveToSlot(StatesC);
|
||||
|
@ -81,6 +80,8 @@ void States_FreezeCurrentSlot()
|
|||
#endif
|
||||
|
||||
GetSysExecutorThread().PostIdleEvent(SysExecEvent_ClearSavingLoadingFlag());
|
||||
|
||||
States_updateLoadBackupMenuItem();
|
||||
}
|
||||
|
||||
void _States_DefrostCurrentSlot(bool isFromBackup)
|
||||
|
@ -115,14 +116,9 @@ void States_DefrostCurrentSlotBackup()
|
|||
_States_DefrostCurrentSlot(true);
|
||||
}
|
||||
|
||||
void States_updateLoadBackupMenuItem(bool isBeforeSave)
|
||||
void States_updateLoadBackupMenuItem()
|
||||
{
|
||||
wxString file = SaveStateBase::GetFilename(StatesC);
|
||||
|
||||
if (!(isBeforeSave && g_Conf->EmuOptions.BackupSavestate))
|
||||
{
|
||||
file = file + L".backup";
|
||||
}
|
||||
wxString file = SaveStateBase::GetFilename(StatesC) + ".backup";
|
||||
|
||||
sMainFrame.EnableMenuItem(MenuId_State_LoadBackup, wxFileExists(file));
|
||||
sMainFrame.SetMenuItemLabel(MenuId_State_LoadBackup, wxsFormat(L"%s %d", _("Backup"), StatesC));
|
||||
|
|
|
@ -134,4 +134,4 @@ extern void States_CycleSlotForward();
|
|||
extern void States_CycleSlotBackward();
|
||||
extern void States_SetCurrentSlot(int slot);
|
||||
extern int States_GetCurrentSlot();
|
||||
extern void States_updateLoadBackupMenuItem(bool isBeforeSave = false);
|
||||
extern void States_updateLoadBackupMenuItem();
|
Loading…
Reference in New Issue