Qt: Show save times in save state menu as well

This commit is contained in:
Connor McLaughlin
2020-03-12 13:51:23 +10:00
parent b2d0dd2d6c
commit e8a5259e68
3 changed files with 46 additions and 40 deletions

View File

@ -763,6 +763,18 @@ std::vector<HostInterface::SaveStateInfo> HostInterface::GetAvailableSaveStates(
return si;
}
std::optional<HostInterface::SaveStateInfo> HostInterface::GetSaveStateInfo(const char* game_code, s32 slot)
{
const bool global = (!game_code || game_code[0] == 0);
std::string path = global ? GetGlobalSaveStateFileName(slot) : GetGameSaveStateFileName(game_code, slot);
FILESYSTEM_STAT_DATA sd;
if (!FileSystem::StatFile(path.c_str(), &sd))
return std::nullopt;
return SaveStateInfo{std::move(path), sd.ModificationTime.AsUnixTimestamp(), slot, global};
}
void HostInterface::DeleteSaveStates(const char* game_code, bool resume)
{
const std::vector<SaveStateInfo> states(GetAvailableSaveStates(game_code));

View File

@ -161,6 +161,9 @@ protected:
/// Returns a list of save states for the specified game code.
std::vector<SaveStateInfo> GetAvailableSaveStates(const char* game_code) const;
/// Returns save state info if present. If game_code is null or empty, assumes global state.
std::optional<SaveStateInfo> GetSaveStateInfo(const char* game_code, s32 slot);
/// Returns the most recent resume save state.
std::string GetMostRecentResumeSaveStatePath() const;