Skip to content

Commit

Permalink
Core: Fix UI slowdown for savestate timestamp reads
Browse files Browse the repository at this point in the history
  • Loading branch information
malleoz committed Oct 26, 2023
1 parent 3454bc4 commit 6636bb3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Source/Core/Core/State.cpp
Expand Up @@ -560,7 +560,7 @@ static bool GetVersionFromLZO(StateHeader& header, File::IOFile& f)
return true;
}

static bool ReadStateHeaderFromFile(StateHeader& header, File::IOFile& f)
static bool ReadStateHeaderFromFile(StateHeader& header, File::IOFile& f, bool version = true)
{
if (!f.IsOpen())
{
Expand All @@ -574,6 +574,11 @@ static bool ReadStateHeaderFromFile(StateHeader& header, File::IOFile& f)
return false;
}

// Bail out if we only care for retrieving the legacy header.
// This is the case with ReadHeader() calls.
if (!version)
return true;

if (header.legacy_header.lzo_size != 0)
{
// Parse out version from legacy LZO compressed states
Expand Down Expand Up @@ -608,7 +613,7 @@ bool ReadHeader(const std::string& filename, StateHeader& header)
std::lock_guard lk(s_save_thread_mutex);

File::IOFile f(filename, "rb");
return ReadStateHeaderFromFile(header, f);
return ReadStateHeaderFromFile(header, f, false);
}

std::string GetInfoStringOfSlot(int slot, bool translate)
Expand Down

0 comments on commit 6636bb3

Please sign in to comment.