Revert "Saveslots: This version is still commented out, and somewhat broken at the moment. If you uncomment it, after loading a game, pause and then resume to force the save and load menus to update."

This reverts commit 49b91ea78f.
This commit is contained in:
Shanoah Alkire 2018-10-15 23:46:41 -07:00
parent 77ac35058c
commit 8f986828e7
6 changed files with 59 additions and 51 deletions

View File

@ -236,6 +236,9 @@ void SysCoreThread::GameStartingInThread()
sApp.PostAppMethod(&Pcsx2App::resetDebugger); sApp.PostAppMethod(&Pcsx2App::resetDebugger);
ApplyLoadedPatches(PPT_ONCE_ON_LOAD); ApplyLoadedPatches(PPT_ONCE_ON_LOAD);
#ifdef USE_SAVESLOT_UI_UPDATES
UI_UpdateSysControls();
#endif
} }
bool SysCoreThread::StateCheckInThread() bool SysCoreThread::StateCheckInThread()

View File

@ -485,6 +485,11 @@ void LoadAllPatchesAndStuff(const Pcsx2Config& cfg)
Pcsx2Config dummy; Pcsx2Config dummy;
PatchesVerboseReset(); PatchesVerboseReset();
_ApplySettings(cfg, dummy); _ApplySettings(cfg, dummy);
// And I'm hacking in updating the UI here too.
#ifdef USE_SAVESLOT_UI_UPDATES
UI_UpdateSysControls();
#endif
} }
void AppCoreThread::ApplySettings( const Pcsx2Config& src ) void AppCoreThread::ApplySettings( const Pcsx2Config& src )

View File

@ -125,51 +125,7 @@ void States_DefrostCurrentSlotBackup()
_States_DefrostCurrentSlot(true); _States_DefrostCurrentSlot(true);
} }
void States_UpdateSaveslotMenu() // I'd keep an eye on this function, as it may still be problematic.
{
#ifdef USE_NEW_SAVESLOTS_UI
// Run though all the slots.Update if they need updating or the crc changed.
for (int i = 0; i < 10; i++)
{
int load_menu_item = MenuId_State_Load01 + i + 1;
int save_menu_item = MenuId_State_Save01 + i + 1;
// We need to reload the file information if the crc changed.
if (saveslot_cache[i].crc != ElfCRC) saveslot_cache[i].invalid_cache = true;
// Either the cache needs updating, or the menu items do, or both.
if (saveslot_cache[i].menu_update || saveslot_cache[i].invalid_cache)
{
#ifdef SAVESLOT_LOGS
Console.WriteLn("Updating slot %i.", i);
if (saveslot_cache[i].menu_update) Console.WriteLn("Menu update needed.");
if (saveslot_cache[i].invalid_cache) Console.WriteLn("Invalid cache. (CRC different or just initialized.)");
#endif
if (saveslot_cache[i].invalid_cache)
{
// Pull everything from disk.
saveslot_cache[i].UpdateCache();
#ifdef SAVESLOT_LOGS
saveslot_cache[i].ConsoleDump();
#endif
}
// Update from the cached information.
saveslot_cache[i].menu_update = false;
saveslot_cache[i].crc = ElfCRC;
sMainFrame.EnableMenuItem(load_menu_item, !saveslot_cache[i].empty);
sMainFrame.SetMenuItemLabel(load_menu_item, saveslot_cache[i].SlotName());
sMainFrame.SetMenuItemLabel(save_menu_item, saveslot_cache[i].SlotName());
}
}
Sstates_updateLoadBackupMenuItem(false);
#endif
}
void Sstates_updateLoadBackupMenuItem(bool isBeforeSave) void Sstates_updateLoadBackupMenuItem(bool isBeforeSave)
{ {
wxString file = SaveStateBase::GetFilename(StatesC); wxString file = SaveStateBase::GetFilename(StatesC);

View File

@ -119,5 +119,4 @@ extern void States_CycleSlotForward();
extern void States_CycleSlotBackward(); extern void States_CycleSlotBackward();
extern void States_SetCurrentSlot(int slot); extern void States_SetCurrentSlot(int slot);
extern int States_GetCurrentSlot(); extern int States_GetCurrentSlot();
extern void States_UpdateSaveslotMenu();
extern void Sstates_updateLoadBackupMenuItem(bool isBeforeSave); extern void Sstates_updateLoadBackupMenuItem(bool isBeforeSave);

View File

@ -476,6 +476,11 @@ protected:
void CleanupEvent() void CleanupEvent()
{ {
#ifdef USE_NEW_SAVESLOTS_UI
// I have a feeling this doesn't need to be here, so I'm commenting this out for the moment.
// I'll remove it if it doesn't cause other issues.
//UI_UpdateSysControls();
#endif
} }
}; };
@ -674,8 +679,8 @@ void StateCopy_SaveToSlot( uint num )
Console.Indent().WriteLn( Color_StrongGreen, L"filename: %s", WX_STR(file) ); Console.Indent().WriteLn( Color_StrongGreen, L"filename: %s", WX_STR(file) );
StateCopy_SaveToFile( file ); StateCopy_SaveToFile( file );
#ifdef USE_SAVESLOT_UI_UPDATES #ifdef USE_NEW_SAVESLOTS_UI
States_UpdateSaveslotMenu(); UI_UpdateSysControls();
#endif #endif
} }
@ -693,7 +698,7 @@ void StateCopy_LoadFromSlot( uint slot, bool isFromBackup )
Console.Indent().WriteLn( Color_StrongGreen, L"filename: %s", WX_STR(file) ); Console.Indent().WriteLn( Color_StrongGreen, L"filename: %s", WX_STR(file) );
StateCopy_LoadFromFile( file ); StateCopy_LoadFromFile( file );
#ifdef USE_SAVESLOT_UI_UPDATES #ifdef USE_NEW_SAVESLOTS_UI
States_UpdateSaveslotMenu(); UI_UpdateSysControls();
#endif #endif
} }

View File

@ -43,7 +43,47 @@ static void _SaveLoadStuff(bool enabled)
sMainFrame.EnableMenuItem(MenuId_Sys_LoadStates, enabled); sMainFrame.EnableMenuItem(MenuId_Sys_LoadStates, enabled);
sMainFrame.EnableMenuItem(MenuId_Sys_SaveStates, enabled); sMainFrame.EnableMenuItem(MenuId_Sys_SaveStates, enabled);
States_UpdateSaveslotMenu(); #ifdef USE_NEW_SAVESLOTS_UI
// Run though all the slots.Update if they need updating or the crc changed.
for (int i = 0; i < 10; i++)
{
int load_menu_item = MenuId_State_Load01 + i + 1;
int save_menu_item = MenuId_State_Save01 + i + 1;
// We need to reload the file information if the crc changed.
if (saveslot_cache[i].crc != ElfCRC) saveslot_cache[i].invalid_cache = true;
// Either the cache needs updating, or the menu items do, or both.
if (saveslot_cache[i].menu_update || saveslot_cache[i].invalid_cache)
{
#ifdef SAVESLOT_LOGS
Console.WriteLn("Updating slot %i.", i);
if (saveslot_cache[i].menu_update) Console.WriteLn("Menu update needed.");
if (saveslot_cache[i].invalid_cache) Console.WriteLn("Invalid cache. (CRC different or just initialized.)");
#endif
if (saveslot_cache[i].invalid_cache)
{
// Pull everything from disk.
saveslot_cache[i].UpdateCache();
#ifdef SAVESLOT_LOGS
saveslot_cache[i].ConsoleDump();
#endif
}
// Update from the cached information.
saveslot_cache[i].menu_update = false;
saveslot_cache[i].crc = ElfCRC;
sMainFrame.EnableMenuItem(load_menu_item, !saveslot_cache[i].empty);
sMainFrame.SetMenuItemLabel(load_menu_item, saveslot_cache[i].SlotName());
sMainFrame.SetMenuItemLabel(save_menu_item, saveslot_cache[i].SlotName());
}
}
Sstates_updateLoadBackupMenuItem(false);
#endif
} }
// Updates the enable/disable status of all System related controls: menus, toolbars, // Updates the enable/disable status of all System related controls: menus, toolbars,