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.

This commit is contained in:
Shanoah Alkire 2018-10-13 18:43:41 -07:00
parent 6ad4345a39
commit cb05daf437
6 changed files with 38 additions and 3 deletions

View File

@ -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
}

View File

@ -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"

View File

@ -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
}

View File

@ -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

View File

@ -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:

View File

@ -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;