Invalidate Savestates

This commit is contained in:
Eladash 2023-07-21 18:23:09 +03:00 committed by Elad Ashkenazi
parent e303cc536c
commit 9ff91c29f2
7 changed files with 17 additions and 71 deletions

View file

@ -335,17 +335,7 @@ public:
[[maybe_unused]] const s32 version = GET_OR_USE_SERIALIZATION_VERSION(ar.is_writing(), cellGem); [[maybe_unused]] const s32 version = GET_OR_USE_SERIALIZATION_VERSION(ar.is_writing(), cellGem);
ar(attribute, vc_attribute, status_flags, enable_pitch_correction, inertial_counter, controllers ar(attribute, vc_attribute, status_flags, enable_pitch_correction, inertial_counter, controllers
, connected_controllers, update_started, camera_frame, memory_ptr); , connected_controllers, update_started, camera_frame, memory_ptr, start_timestamp_us);
if (version == 1 && !ar.is_writing())
{
u32 ts = ar;
start_timestamp_us = ts;
}
else
{
ar(start_timestamp_us);
}
} }
gem_config_data(utils::serial& ar) gem_config_data(utils::serial& ar)

View file

@ -2030,21 +2030,7 @@ void ppu_thread::serialize_common(utils::serial& ar)
{ {
[[maybe_unused]] const s32 version = GET_OR_USE_SERIALIZATION_VERSION(ar.is_writing(), ppu); [[maybe_unused]] const s32 version = GET_OR_USE_SERIALIZATION_VERSION(ar.is_writing(), ppu);
ar(gpr, fpr, cr, fpscr.bits, lr, ctr, vrsave, cia, xer, sat, nj); ar(gpr, fpr, cr, fpscr.bits, lr, ctr, vrsave, cia, xer, sat, nj, prio.raw().all);
if (ar.is_writing())
{
ar(prio.load().all);
}
else if (version < 2)
{
prio.raw().all = 0;
prio.raw().prio = ar.operator s32();
}
else
{
ar(prio.raw().all);
}
ar(optional_savestate_state, vr); ar(optional_savestate_state, vr);

View file

@ -259,10 +259,7 @@ lv2_socket::lv2_socket(utils::serial& ar, lv2_socket_type _type)
const s32 version = GET_SERIALIZATION_VERSION(lv2_net); const s32 version = GET_SERIALIZATION_VERSION(lv2_net);
if (version >= 2) ar(so_rcvtimeo, so_sendtimeo);
{
ar(so_rcvtimeo, so_sendtimeo);
}
lv2_id = idm::last_id(); lv2_id = idm::last_id();

View file

@ -312,11 +312,7 @@ std::shared_ptr<void> lv2_prx::load(utils::serial& ar)
{ {
std::basic_string<bool> loaded_flags, external_flags; std::basic_string<bool> loaded_flags, external_flags;
if (version >= 4) ar(loaded_flags, external_flags);
{
ar(loaded_flags);
ar(external_flags);
}
fs::file file{path.substr(0, path.size() - (offset ? fmt::format("_x%x", offset).size() : 0))}; fs::file file{path.substr(0, path.size() - (offset ? fmt::format("_x%x", offset).size() : 0))};
@ -328,21 +324,11 @@ std::shared_ptr<void> lv2_prx::load(utils::serial& ar)
prx->m_loaded_flags = std::move(loaded_flags); prx->m_loaded_flags = std::move(loaded_flags);
prx->m_external_loaded_flags = std::move(external_flags); prx->m_external_loaded_flags = std::move(external_flags);
if (version == 2 && (state == PRX_STATE_STARTED || state == PRX_STATE_STARTING)) if (state <= PRX_STATE_STARTED)
{
prx->load_exports();
}
if (version >= 4 && state <= PRX_STATE_STARTED)
{ {
prx->restore_exports(); prx->restore_exports();
} }
if (version == 1)
{
prx->load_exports();
}
ensure(prx); ensure(prx);
} }
else else

View file

@ -215,14 +215,7 @@ lv2_spu_group::lv2_spu_group(utils::serial& ar) noexcept
{ {
std::common_type_t<decltype(lv2_spu_group::prio)> prio{}; std::common_type_t<decltype(lv2_spu_group::prio)> prio{};
if (GET_SERIALIZATION_VERSION(spu) < 3) ar(prio.all);
{
prio.prio = ar.operator s32();
}
else
{
ar(prio.all);
}
return prio; return prio;
}()) }())
@ -387,10 +380,7 @@ struct spu_limits_t
spu_limits_t(utils::serial& ar) noexcept spu_limits_t(utils::serial& ar) noexcept
{ {
if (GET_SERIALIZATION_VERSION(spu) >= 2) ar(max_raw, max_spu);
{
ar(max_raw, max_spu);
}
} }
void save(utils::serial& ar) void save(utils::serial& ar)

View file

@ -506,13 +506,10 @@ namespace rsx
ar(u32{0}); ar(u32{0});
} }
} }
else if (version > 1) else if (u32 count = ar)
{ {
if (u32 count = ar) restore_fifo_count = count;
{ ar(restore_fifo_cmd);
restore_fifo_count = count;
ar(restore_fifo_cmd);
}
} }
} }

View file

@ -35,20 +35,20 @@ static std::array<serial_ver_t, 23> s_serial_versions;
return ::s_serial_versions[identifier].current_version;\ return ::s_serial_versions[identifier].current_version;\
} }
SERIALIZATION_VER(global_version, 0, 12) // For stuff not listed here SERIALIZATION_VER(global_version, 0, 13) // For stuff not listed here
SERIALIZATION_VER(ppu, 1, 1, 2 /*thread sleep queue order*/) SERIALIZATION_VER(ppu, 1, 1)
SERIALIZATION_VER(spu, 2, 1, 2 /*spu_limits_t ctor*/, 3 /*thread sleep queue order*/) SERIALIZATION_VER(spu, 2, 1)
SERIALIZATION_VER(lv2_sync, 3, 1) SERIALIZATION_VER(lv2_sync, 3, 1)
SERIALIZATION_VER(lv2_vm, 4, 1) SERIALIZATION_VER(lv2_vm, 4, 1)
SERIALIZATION_VER(lv2_net, 5, 1, 2/*RECV/SEND timeout*/) SERIALIZATION_VER(lv2_net, 5, 1)
SERIALIZATION_VER(lv2_fs, 6, 1) SERIALIZATION_VER(lv2_fs, 6, 1)
SERIALIZATION_VER(lv2_prx_overlay, 7, 1, 2/*PRX dynamic exports*/, 4/*Conditionally Loaded Local Exports*/) SERIALIZATION_VER(lv2_prx_overlay, 7, 1)
SERIALIZATION_VER(lv2_memory, 8, 1) SERIALIZATION_VER(lv2_memory, 8, 1)
SERIALIZATION_VER(lv2_config, 9, 1) SERIALIZATION_VER(lv2_config, 9, 1)
namespace rsx namespace rsx
{ {
SERIALIZATION_VER(rsx, 10, 1, 2) SERIALIZATION_VER(rsx, 10, 1)
} }
namespace np namespace np
@ -65,7 +65,7 @@ SERIALIZATION_VER(sceNp, 11)
SERIALIZATION_VER(cellVdec, 12, 1) SERIALIZATION_VER(cellVdec, 12, 1)
SERIALIZATION_VER(cellAudio, 13, 1) SERIALIZATION_VER(cellAudio, 13, 1)
SERIALIZATION_VER(cellCamera, 14, 1) SERIALIZATION_VER(cellCamera, 14, 1)
SERIALIZATION_VER(cellGem, 15, 1, 2/*frame_timestamp u32->u64*/) SERIALIZATION_VER(cellGem, 15, 1)
SERIALIZATION_VER(sceNpTrophy, 16, 1) SERIALIZATION_VER(sceNpTrophy, 16, 1)
SERIALIZATION_VER(cellMusic, 17, 1) SERIALIZATION_VER(cellMusic, 17, 1)
SERIALIZATION_VER(cellVoice, 18, 1) SERIALIZATION_VER(cellVoice, 18, 1)