From 12ebf77e22834bf5599e34bed2310f3c023d2eb9 Mon Sep 17 00:00:00 2001 From: Eladash Date: Fri, 15 Jul 2022 20:13:06 +0300 Subject: [PATCH] Savestates: save sys_spu_initialize settings --- rpcs3/Emu/Cell/lv2/sys_spu.cpp | 22 +++++++++++++++++----- rpcs3/Emu/savestate_utils.cpp | 2 +- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/rpcs3/Emu/Cell/lv2/sys_spu.cpp b/rpcs3/Emu/Cell/lv2/sys_spu.cpp index ac512d4b68..e01c9dc682 100644 --- a/rpcs3/Emu/Cell/lv2/sys_spu.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_spu.cpp @@ -347,9 +347,6 @@ std::pair*, std::shared_ptr> lv2_spu_gro return res; } -namespace -{ - struct limits_data { u32 physical = 0; @@ -365,6 +362,23 @@ struct spu_limits_t u32 max_spu = 6; shared_mutex mutex; + spu_limits_t() = default; + + spu_limits_t(utils::serial& ar) noexcept + { + if (GET_SERIALIZATION_VERSION(spu) >= 2) + { + ar(max_raw, max_spu); + } + } + + void save(utils::serial& ar) + { + ar(max_raw, max_spu); + } + + SAVESTATE_INIT_POS(47); + bool check(const limits_data& init) const { u32 physical_spus_count = init.physical; @@ -396,8 +410,6 @@ struct spu_limits_t } }; -} // annonymous namespace - error_code sys_spu_initialize(ppu_thread& ppu, u32 max_usable_spu, u32 max_raw_spu) { ppu.state += cpu_flag::wait; diff --git a/rpcs3/Emu/savestate_utils.cpp b/rpcs3/Emu/savestate_utils.cpp index 018fbed717..806c874770 100644 --- a/rpcs3/Emu/savestate_utils.cpp +++ b/rpcs3/Emu/savestate_utils.cpp @@ -37,7 +37,7 @@ static std::array s_serial_versions; SERIALIZATION_VER(global_version, 0, 12) // For stuff not listed here SERIALIZATION_VER(ppu, 1, 1) -SERIALIZATION_VER(spu, 2, 1) +SERIALIZATION_VER(spu, 2, 1, 2 /*spu_limits_t ctor*/) SERIALIZATION_VER(lv2_sync, 3, 1) SERIALIZATION_VER(lv2_vm, 4, 1) SERIALIZATION_VER(lv2_net, 5, 1)