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;
|
Pcsx2Config dummy;
|
||||||
PatchesVerboseReset();
|
PatchesVerboseReset();
|
||||||
_ApplySettings(cfg, dummy);
|
_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 )
|
void AppCoreThread::ApplySettings( const Pcsx2Config& src )
|
||||||
|
|
|
@ -84,6 +84,7 @@ void States_FreezeCurrentSlot()
|
||||||
saveslot_cache[StatesC].empty = false;
|
saveslot_cache[StatesC].empty = false;
|
||||||
saveslot_cache[StatesC].updated = wxDateTime::Now();
|
saveslot_cache[StatesC].updated = wxDateTime::Now();
|
||||||
saveslot_cache[StatesC].crc = ElfCRC;
|
saveslot_cache[StatesC].crc = ElfCRC;
|
||||||
|
saveslot_cache[StatesC].menu_update = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GetSysExecutorThread().PostIdleEvent(SysExecEvent_ClearSavingLoadingFlag());
|
GetSysExecutorThread().PostIdleEvent(SysExecEvent_ClearSavingLoadingFlag());
|
||||||
|
|
|
@ -29,6 +29,7 @@ public:
|
||||||
bool empty;
|
bool empty;
|
||||||
wxDateTime updated;
|
wxDateTime updated;
|
||||||
u32 crc;
|
u32 crc;
|
||||||
|
bool menu_update, invalid_cache;
|
||||||
|
|
||||||
Saveslot()
|
Saveslot()
|
||||||
{
|
{
|
||||||
|
@ -36,6 +37,8 @@ public:
|
||||||
empty = true;
|
empty = true;
|
||||||
updated = wxInvalidDateTime;
|
updated = wxInvalidDateTime;
|
||||||
crc = ElfCRC;
|
crc = ElfCRC;
|
||||||
|
menu_update = false;
|
||||||
|
invalid_cache = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Saveslot(int i)
|
Saveslot(int i)
|
||||||
|
@ -44,6 +47,8 @@ public:
|
||||||
empty = true;
|
empty = true;
|
||||||
updated = wxInvalidDateTime;
|
updated = wxInvalidDateTime;
|
||||||
crc = ElfCRC;
|
crc = ElfCRC;
|
||||||
|
menu_update = false;
|
||||||
|
invalid_cache = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isUsed()
|
bool isUsed()
|
||||||
|
@ -63,6 +68,7 @@ public:
|
||||||
empty = !isUsed();
|
empty = !isUsed();
|
||||||
updated = GetTimestamp();
|
updated = GetTimestamp();
|
||||||
crc = ElfCRC;
|
crc = ElfCRC;
|
||||||
|
invalid_cache = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString SlotName()
|
wxString SlotName()
|
||||||
|
@ -86,8 +92,8 @@ public:
|
||||||
if (updated != wxInvalidDateTime)
|
if (updated != wxInvalidDateTime)
|
||||||
Console.WriteLn(wxsFormat(_("Write time is %s %s."), updated.FormatDate(), updated.FormatTime()));
|
Console.WriteLn(wxsFormat(_("Write time is %s %s."), updated.FormatDate(), updated.FormatTime()));
|
||||||
|
|
||||||
if (isUsed())
|
//if (isUsed())
|
||||||
Console.WriteLn(wxsFormat(_("The disk has a file on it dated %s %s."), GetTimestamp().FormatDate(), GetTimestamp().FormatTime()));
|
// Console.WriteLn(wxsFormat(_("The disk has a file on it dated %s %s."), GetTimestamp().FormatDate(), GetTimestamp().FormatTime()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -49,21 +49,27 @@ static void _SaveLoadStuff(bool enabled)
|
||||||
int load_menu_item = MenuId_State_Load01 + i + 1;
|
int load_menu_item = MenuId_State_Load01 + i + 1;
|
||||||
int save_menu_item = MenuId_State_Save01 + 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.
|
// We need to reload the file information if the crc changed.
|
||||||
if (saveslot_cache[i].empty == saveslot_cache[i].isUsed())
|
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 (saveslot_cache[i].invalid_cache)
|
||||||
// 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))
|
|
||||||
{
|
{
|
||||||
|
// Pull everything from disk.
|
||||||
saveslot_cache[i].UpdateCache();
|
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());
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
Sstates_updateLoadBackupMenuItem(false);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue