Merge pull request #12256 from malleoz/savestate_read_header_fix
Core: Fix UI slowdown for savestate timestamp reads
This commit is contained in:
commit
045868bbb4
|
@ -560,7 +560,8 @@ static bool GetVersionFromLZO(StateHeader& header, File::IOFile& f)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ReadStateHeaderFromFile(StateHeader& header, File::IOFile& f)
|
static bool ReadStateHeaderFromFile(StateHeader& header, File::IOFile& f,
|
||||||
|
bool get_version_header = true)
|
||||||
{
|
{
|
||||||
if (!f.IsOpen())
|
if (!f.IsOpen())
|
||||||
{
|
{
|
||||||
|
@ -574,6 +575,11 @@ static bool ReadStateHeaderFromFile(StateHeader& header, File::IOFile& f)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Bail out if we only care for retrieving the legacy header.
|
||||||
|
// This is the case with ReadHeader() calls.
|
||||||
|
if (!get_version_header)
|
||||||
|
return true;
|
||||||
|
|
||||||
if (header.legacy_header.lzo_size != 0)
|
if (header.legacy_header.lzo_size != 0)
|
||||||
{
|
{
|
||||||
// Parse out version from legacy LZO compressed states
|
// Parse out version from legacy LZO compressed states
|
||||||
|
@ -608,7 +614,8 @@ bool ReadHeader(const std::string& filename, StateHeader& header)
|
||||||
std::lock_guard lk(s_save_thread_mutex);
|
std::lock_guard lk(s_save_thread_mutex);
|
||||||
|
|
||||||
File::IOFile f(filename, "rb");
|
File::IOFile f(filename, "rb");
|
||||||
return ReadStateHeaderFromFile(header, f);
|
bool get_version_header = false;
|
||||||
|
return ReadStateHeaderFromFile(header, f, get_version_header);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GetInfoStringOfSlot(int slot, bool translate)
|
std::string GetInfoStringOfSlot(int slot, bool translate)
|
||||||
|
|
Loading…
Reference in New Issue