Android: Show how long ago each savestate was created

This commit is contained in:
JosJuice
2020-10-21 19:49:56 +02:00
parent a8b7c3b577
commit 21d3ea523c
8 changed files with 80 additions and 53 deletions

View File

@ -482,6 +482,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