From cb05daf4375015706f6c7cee9a9b9c4884550d48 Mon Sep 17 00:00:00 2001 From: Shanoah Alkire Date: Sat, 13 Oct 2018 18:43:41 -0700 Subject: [PATCH] Add some logging for the saveslot changes, and the option to turn on just the extra ui update calls without the other saveslot changes, for testing. --- pcsx2/System/SysCoreThread.cpp | 2 +- pcsx2/gui/App.h | 3 +++ pcsx2/gui/AppCoreThread.cpp | 2 +- pcsx2/gui/Saveslots.cpp | 5 ++++- pcsx2/gui/Saveslots.h | 14 ++++++++++++++ pcsx2/gui/UpdateUI.cpp | 15 +++++++++++++++ 6 files changed, 38 insertions(+), 3 deletions(-) diff --git a/pcsx2/System/SysCoreThread.cpp b/pcsx2/System/SysCoreThread.cpp index 9fa577d8af..d69e5014a7 100644 --- a/pcsx2/System/SysCoreThread.cpp +++ b/pcsx2/System/SysCoreThread.cpp @@ -236,7 +236,7 @@ void SysCoreThread::GameStartingInThread() sApp.PostAppMethod(&Pcsx2App::resetDebugger); ApplyLoadedPatches(PPT_ONCE_ON_LOAD); -#ifdef USE_NEW_SAVESLOTS_UI +#ifdef USE_SAVESLOT_UI_UPDATES UI_UpdateSysControls(); #endif } diff --git a/pcsx2/gui/App.h b/pcsx2/gui/App.h index 482ff7a569..9efd1d3c9a 100644 --- a/pcsx2/gui/App.h +++ b/pcsx2/gui/App.h @@ -27,6 +27,9 @@ #include "AppCoreThread.h" #include "RecentIsoList.h" +//Purely to make sure the saveslot define comes through. Remove if it gets removed. +#include "Saveslots.h" + class DisassemblyDialog; #include "System.h" diff --git a/pcsx2/gui/AppCoreThread.cpp b/pcsx2/gui/AppCoreThread.cpp index 3fa5dce9bf..64ff0eecf7 100644 --- a/pcsx2/gui/AppCoreThread.cpp +++ b/pcsx2/gui/AppCoreThread.cpp @@ -487,7 +487,7 @@ void LoadAllPatchesAndStuff(const Pcsx2Config& cfg) _ApplySettings(cfg, dummy); // And I'm hacking in updating the UI here too. -#ifdef USE_NEW_SAVESLOTS_UI +#ifdef USE_SAVESLOT_UI_UPDATES UI_UpdateSysControls(); #endif } diff --git a/pcsx2/gui/Saveslots.cpp b/pcsx2/gui/Saveslots.cpp index 46a3abf1e1..54fb88197c 100644 --- a/pcsx2/gui/Saveslots.cpp +++ b/pcsx2/gui/Saveslots.cpp @@ -80,10 +80,13 @@ void States_FreezeCurrentSlot() StateCopy_SaveToSlot(StatesC); #ifdef USE_NEW_SAVESLOTS_UI - // Hack: Update the saveslot saying it's filled *right now* because it's still writing the file and we don't have a timestamp. + // Update the saveslot cache with the new saveslot, and give it the current timestamp, + // Because we aren't going to be able to get the real timestamp from disk right now. saveslot_cache[StatesC].empty = false; saveslot_cache[StatesC].updated = wxDateTime::Now(); saveslot_cache[StatesC].crc = ElfCRC; + + // Update the slot next time we run through the UI update. saveslot_cache[StatesC].menu_update = true; #endif diff --git a/pcsx2/gui/Saveslots.h b/pcsx2/gui/Saveslots.h index 6b7517e151..1e5741d862 100644 --- a/pcsx2/gui/Saveslots.h +++ b/pcsx2/gui/Saveslots.h @@ -20,8 +20,22 @@ #include "System.h" #include "Elfheader.h" +// Uncomment to turn on the new saveslot UI. //#define USE_NEW_SAVESLOTS_UI +// Uncomment to turn on the extra UI updates *without* the UI. +//#define USE_SAVESLOT_UI_UPDATES + +#ifdef USE_NEW_SAVESLOTS_UI +// Should always be enabled if the new saveslots are. +#define USE_SAVESLOT_UI_UPDATES +#endif + +#ifdef USE_SAVESLOT_UI_UPDATES +// Uncomment to add saveslot logging and comment to turn off. +#define SAVESLOT_LOGS +#endif + class Saveslot { public: diff --git a/pcsx2/gui/UpdateUI.cpp b/pcsx2/gui/UpdateUI.cpp index 174632fee2..33f259a9dd 100644 --- a/pcsx2/gui/UpdateUI.cpp +++ b/pcsx2/gui/UpdateUI.cpp @@ -44,6 +44,7 @@ static void _SaveLoadStuff(bool 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; @@ -55,10 +56,20 @@ static void _SaveLoadStuff(bool enabled) // 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. @@ -79,6 +90,10 @@ static void _SaveLoadStuff(bool enabled) // etc. Typically called by SysEvtHandler whenever the message pump becomes idle. void UI_UpdateSysControls() { + #ifdef SAVESLOT_LOGS + Console.WriteLn("In the routine for updating the UI."); + #endif + if (wxGetApp().Rpc_TryInvokeAsync(&UI_UpdateSysControls)) return;