mirror of https://github.com/PCSX2/pcsx2.git
Redo how the saveslot code works. Still leaving disabled until it's been tested.
This commit is contained in:
parent
db18a01a7b
commit
8defe54e3b
|
@ -485,6 +485,11 @@ void LoadAllPatchesAndStuff(const Pcsx2Config& cfg)
|
|||
Pcsx2Config dummy;
|
||||
PatchesVerboseReset();
|
||||
_ApplySettings(cfg, dummy);
|
||||
|
||||
// And I'm hacking in updating the UI here too.
|
||||
#ifdef USE_NEW_SAVESLOTS_UI
|
||||
UI_UpdateSysControls();
|
||||
#endif
|
||||
}
|
||||
|
||||
void AppCoreThread::ApplySettings( const Pcsx2Config& src )
|
||||
|
|
|
@ -84,6 +84,7 @@ void States_FreezeCurrentSlot()
|
|||
saveslot_cache[StatesC].empty = false;
|
||||
saveslot_cache[StatesC].updated = wxDateTime::Now();
|
||||
saveslot_cache[StatesC].crc = ElfCRC;
|
||||
saveslot_cache[StatesC].menu_update = true;
|
||||
#endif
|
||||
|
||||
GetSysExecutorThread().PostIdleEvent(SysExecEvent_ClearSavingLoadingFlag());
|
||||
|
|
|
@ -29,6 +29,7 @@ public:
|
|||
bool empty;
|
||||
wxDateTime updated;
|
||||
u32 crc;
|
||||
bool menu_update, invalid_cache;
|
||||
|
||||
Saveslot()
|
||||
{
|
||||
|
@ -36,6 +37,8 @@ public:
|
|||
empty = true;
|
||||
updated = wxInvalidDateTime;
|
||||
crc = ElfCRC;
|
||||
menu_update = false;
|
||||
invalid_cache = true;
|
||||
}
|
||||
|
||||
Saveslot(int i)
|
||||
|
@ -44,6 +47,8 @@ public:
|
|||
empty = true;
|
||||
updated = wxInvalidDateTime;
|
||||
crc = ElfCRC;
|
||||
menu_update = false;
|
||||
invalid_cache = true;
|
||||
}
|
||||
|
||||
bool isUsed()
|
||||
|
@ -63,6 +68,7 @@ public:
|
|||
empty = !isUsed();
|
||||
updated = GetTimestamp();
|
||||
crc = ElfCRC;
|
||||
invalid_cache = false;
|
||||
}
|
||||
|
||||
wxString SlotName()
|
||||
|
@ -86,8 +92,8 @@ public:
|
|||
if (updated != wxInvalidDateTime)
|
||||
Console.WriteLn(wxsFormat(_("Write time is %s %s."), updated.FormatDate(), updated.FormatTime()));
|
||||
|
||||
if (isUsed())
|
||||
Console.WriteLn(wxsFormat(_("The disk has a file on it dated %s %s."), GetTimestamp().FormatDate(), GetTimestamp().FormatTime()));
|
||||
//if (isUsed())
|
||||
// Console.WriteLn(wxsFormat(_("The disk has a file on it dated %s %s."), GetTimestamp().FormatDate(), GetTimestamp().FormatTime()));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -49,22 +49,28 @@ static void _SaveLoadStuff(bool enabled)
|
|||
int load_menu_item = MenuId_State_Load01 + i + 1;
|
||||
int save_menu_item = MenuId_State_Save01 + i + 1;
|
||||
|
||||
// If the cache is out of sync with the actual files, we need to update things. First update, the cache'll be blank, and this will populate everything.
|
||||
if (saveslot_cache[i].empty == saveslot_cache[i].isUsed())
|
||||
// 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)
|
||||
{
|
||||
// If there is actually a file there, or the cache was for a different game, we force an update.
|
||||
// If the cache says there's a saveslot for the current game that there isn't a file for, writing it is done in a different thread,
|
||||
// so it might not be written yet. Which is why I cache to begin with.
|
||||
if (saveslot_cache[i].isUsed() || (saveslot_cache[i].crc != ElfCRC))
|
||||
if (saveslot_cache[i].invalid_cache)
|
||||
{
|
||||
// Pull everything from disk.
|
||||
saveslot_cache[i].UpdateCache();
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue