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 commit is contained in:
Shanoah Alkire 2018-10-14 02:41:41 -07:00
parent cb05daf437
commit 49b91ea78f
6 changed files with 51 additions and 59 deletions

View File

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

View File

@ -485,11 +485,6 @@ void LoadAllPatchesAndStuff(const Pcsx2Config& cfg)
Pcsx2Config dummy;
PatchesVerboseReset();
_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 )

View File

@ -125,7 +125,51 @@ void States_DefrostCurrentSlotBackup()
_States_DefrostCurrentSlot(true);
}
// I'd keep an eye on this function, as it may still be problematic.
void 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
}
void Sstates_updateLoadBackupMenuItem(bool isBeforeSave)
{
wxString file = SaveStateBase::GetFilename(StatesC);

View File

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

View File

@ -476,11 +476,6 @@ protected:
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
}
};
@ -679,8 +674,8 @@ void StateCopy_SaveToSlot( uint num )
Console.Indent().WriteLn( Color_StrongGreen, L"filename: %s", WX_STR(file) );
StateCopy_SaveToFile( file );
#ifdef USE_NEW_SAVESLOTS_UI
UI_UpdateSysControls();
#ifdef USE_SAVESLOT_UI_UPDATES
States_UpdateSaveslotMenu();
#endif
}
@ -698,7 +693,7 @@ void StateCopy_LoadFromSlot( uint slot, bool isFromBackup )
Console.Indent().WriteLn( Color_StrongGreen, L"filename: %s", WX_STR(file) );
StateCopy_LoadFromFile( file );
#ifdef USE_NEW_SAVESLOTS_UI
UI_UpdateSysControls();
#ifdef USE_SAVESLOT_UI_UPDATES
States_UpdateSaveslotMenu();
#endif
}

View File

@ -43,47 +43,7 @@ static void _SaveLoadStuff(bool enabled)
sMainFrame.EnableMenuItem(MenuId_Sys_LoadStates, enabled);
sMainFrame.EnableMenuItem(MenuId_Sys_SaveStates, enabled);
#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
States_UpdateSaveslotMenu();
}
// Updates the enable/disable status of all System related controls: menus, toolbars,