mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-02-22 12:39:52 +00:00
Savestates: savestate reload fix
This commit is contained in:
parent
12ebf77e22
commit
56619b20cf
@ -79,7 +79,7 @@ extern void ppu_unload_prx(const lv2_prx&);
|
|||||||
extern std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object&, const std::string&, s64 = 0, utils::serial* = nullptr);
|
extern std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object&, const std::string&, s64 = 0, utils::serial* = nullptr);
|
||||||
extern std::pair<std::shared_ptr<lv2_overlay>, CellError> ppu_load_overlay(const ppu_exec_object&, const std::string& path, s64 = 0, utils::serial* = nullptr);
|
extern std::pair<std::shared_ptr<lv2_overlay>, CellError> ppu_load_overlay(const ppu_exec_object&, const std::string& path, s64 = 0, utils::serial* = nullptr);
|
||||||
extern bool ppu_load_rel_exec(const ppu_rel_object&);
|
extern bool ppu_load_rel_exec(const ppu_rel_object&);
|
||||||
extern bool is_savestate_version_compatible(const std::vector<std::pair<u16, u16>>& data, bool log);
|
extern bool is_savestate_version_compatible(const std::vector<std::pair<u16, u16>>& data, bool is_boot_check);
|
||||||
extern std::vector<std::pair<u16, u16>> read_used_savestate_versions();
|
extern std::vector<std::pair<u16, u16>> read_used_savestate_versions();
|
||||||
|
|
||||||
fs::file g_tty;
|
fs::file g_tty;
|
||||||
|
@ -108,7 +108,7 @@ std::vector<std::pair<u16, u16>> get_savestate_versioning_data(const fs::file& f
|
|||||||
return ar;
|
return ar;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_savestate_version_compatible(const std::vector<std::pair<u16, u16>>& data, bool log)
|
bool is_savestate_version_compatible(const std::vector<std::pair<u16, u16>>& data, bool is_boot_check)
|
||||||
{
|
{
|
||||||
if (data.empty())
|
if (data.empty())
|
||||||
{
|
{
|
||||||
@ -121,20 +121,28 @@ bool is_savestate_version_compatible(const std::vector<std::pair<u16, u16>>& dat
|
|||||||
{
|
{
|
||||||
if (identifier >= s_serial_versions.size())
|
if (identifier >= s_serial_versions.size())
|
||||||
{
|
{
|
||||||
(log ? sys_log.error : sys_log.trace)("Savestate version identider is unknown! (category=%u, version=%u)", identifier, version);
|
(is_boot_check ? sys_log.error : sys_log.trace)("Savestate version identider is unknown! (category=%u, version=%u)", identifier, version);
|
||||||
ok = false; // Log all mismatches
|
ok = false; // Log all mismatches
|
||||||
}
|
}
|
||||||
else if (!s_serial_versions[identifier].compatible_versions.count(version))
|
else if (!s_serial_versions[identifier].compatible_versions.count(version))
|
||||||
{
|
{
|
||||||
(log ? sys_log.error : sys_log.trace)("Savestate version is not supported. (category=%u, version=%u)", identifier, version);
|
(is_boot_check ? sys_log.error : sys_log.trace)("Savestate version is not supported. (category=%u, version=%u)", identifier, version);
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
else
|
else if (is_boot_check)
|
||||||
{
|
{
|
||||||
s_serial_versions[identifier].current_version = version;
|
s_serial_versions[identifier].current_version = version;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!ok && is_boot_check)
|
||||||
|
{
|
||||||
|
for (auto [identifier, _] : data)
|
||||||
|
{
|
||||||
|
s_serial_versions[identifier].current_version = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,7 +178,7 @@ bool boot_last_savestate()
|
|||||||
const std::string save_dir = fs::get_cache_dir() + "/savestates/";
|
const std::string save_dir = fs::get_cache_dir() + "/savestates/";
|
||||||
|
|
||||||
std::string savestate_path;
|
std::string savestate_path;
|
||||||
u64 mtime = umax;
|
s64 mtime = smin;
|
||||||
|
|
||||||
for (auto&& entry : fs::dir(save_dir))
|
for (auto&& entry : fs::dir(save_dir))
|
||||||
{
|
{
|
||||||
@ -180,7 +188,7 @@ bool boot_last_savestate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Find the latest savestate file compatible with the game (TODO: Check app version and anything more)
|
// Find the latest savestate file compatible with the game (TODO: Check app version and anything more)
|
||||||
if (entry.name.find(Emu.GetTitleID()) != umax && mtime < entry.mtime)
|
if (entry.name.find(Emu.GetTitleID()) != umax && mtime <= entry.mtime)
|
||||||
{
|
{
|
||||||
if (std::string path = save_dir + entry.name; is_savestate_compatible(fs::file(path)))
|
if (std::string path = save_dir + entry.name; is_savestate_compatible(fs::file(path)))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user