diff --git a/rpcs3/Emu/Cell/lv2/sys_sync.h b/rpcs3/Emu/Cell/lv2/sys_sync.h index 0d6162e664..98df7cd729 100644 --- a/rpcs3/Emu/Cell/lv2/sys_sync.h +++ b/rpcs3/Emu/Cell/lv2/sys_sync.h @@ -84,6 +84,11 @@ private: public: SAVESTATE_INIT_POS(4); // Dependency on PPUs + lv2_obj() noexcept = default; + lv2_obj(u32 i) noexcept : exists{ i } {} + lv2_obj(utils::serial&) noexcept {} + void save(utils::serial&) {} + // Existence validation (workaround for shared-ptr ref-counting) atomic_t exists = 0; diff --git a/rpcs3/Emu/IdManager.h b/rpcs3/Emu/IdManager.h index 4c98a35e43..b75cb73e47 100644 --- a/rpcs3/Emu/IdManager.h +++ b/rpcs3/Emu/IdManager.h @@ -248,16 +248,17 @@ namespace id_manager std::vector>> vec{}, private_copy{}; shared_mutex mutex{}; // TODO: Use this instead of global mutex - id_map() + id_map() noexcept { // Preallocate memory vec.reserve(T::id_count); } // Order it directly before the source type's position - static constexpr double savestate_init_pos = std::bit_cast(std::bit_cast(T::savestate_init_pos) - 1); + static constexpr double savestate_init_pos_original = T::savestate_init_pos; + static constexpr double savestate_init_pos = std::bit_cast(std::bit_cast(savestate_init_pos_original) - 1); - id_map(utils::serial& ar) + id_map(utils::serial& ar) noexcept requires (savestate_init_pos_original != 0 && std::is_constructible_v>) { vec.resize(T::id_count); @@ -297,7 +298,7 @@ namespace id_manager } } - void save(utils::serial& ar) + void save(utils::serial& ar) requires (savestate_init_pos_original != 0 && std::is_constructible_v>) { u32 obj_count = 0; usz obj_count_offs = ar.data.size(); @@ -334,8 +335,7 @@ namespace id_manager std::memcpy(ar.data.data() + obj_count_offs, &obj_count, sizeof(obj_count)); } - template requires (std::is_assignable_v) - id_map& operator=(thread_state state) + id_map& operator=(thread_state state) noexcept requires (std::is_assignable_v) { if (private_copy.empty()) { diff --git a/rpcs3/util/types.hpp b/rpcs3/util/types.hpp index fb44d45bdb..23e617e2d9 100644 --- a/rpcs3/util/types.hpp +++ b/rpcs3/util/types.hpp @@ -1353,4 +1353,4 @@ extern bool serialize(utils::serial& ar, T& obj); }() #define ENABLE_BITWISE_SERIALIZATION using enable_bitcopy = std::true_type; -#define SAVESTATE_INIT_POS(x) static constexpr double savestate_init_pos = (x) +#define SAVESTATE_INIT_POS(...) static constexpr double savestate_init_pos = (__VA_ARGS__)