Merge pull request #9177 from JosJuice/android-savestate-time

Android: Show how long ago each savestate was created
This commit is contained in:
LC
2020-10-23 13:59:43 -04:00
committed by GitHub
8 changed files with 80 additions and 53 deletions

View File

@ -478,6 +478,17 @@ std::string GetInfoStringOfSlot(int slot, bool translate)
return Common::Timer::GetDateTimeFormatted(header.time);
}
u64 GetUnixTimeOfSlot(int slot)
{
State::StateHeader header;
if (!ReadHeader(MakeStateFilename(slot), header))
return 0;
constexpr u64 MS_PER_SEC = 1000;
return static_cast<u64>(header.time * MS_PER_SEC) +
(Common::Timer::DOUBLE_TIME_OFFSET * MS_PER_SEC);
}
static void LoadFileStateData(const std::string& filename, std::vector<u8>& ret_data)
{
Flush();

View File

@ -36,6 +36,9 @@ bool ReadHeader(const std::string& filename, StateHeader& header);
// which can be presented to the user for identification purposes
std::string GetInfoStringOfSlot(int slot, bool translate = true);
// Returns when the savestate in the given slot was created, or 0 if the slot is empty.
u64 GetUnixTimeOfSlot(int slot);
// These don't happen instantly - they get scheduled as events.
// ...But only if we're not in the main CPU thread.
// If we're in the main CPU thread then they run immediately instead