mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 03:25:16 +00:00
Savestates: Fixup
This commit is contained in:
parent
1111c1952b
commit
fba1db29b3
2 changed files with 21 additions and 2 deletions
|
@ -77,6 +77,11 @@ struct avc2_settings
|
|||
u8 video_stream_sharing = 0;
|
||||
u32 total_video_bitrate = 0;
|
||||
|
||||
static bool saveable(bool is_writing) noexcept
|
||||
{
|
||||
return GET_SERIALIZATION_VERSION(cellSysutil) != 0;
|
||||
}
|
||||
|
||||
avc2_settings(utils::serial& ar) noexcept
|
||||
{
|
||||
[[maybe_unused]] const s32 version = GET_SERIALIZATION_VERSION(cellSysutil);
|
||||
|
|
|
@ -73,6 +73,7 @@ namespace stx
|
|||
bool(*create)(uchar* ptr, manual_typemap&, utils::serial*, std::string_view) noexcept = nullptr;
|
||||
void(*thread_op)(void* ptr, thread_state) noexcept = nullptr;
|
||||
void(*save)(void* ptr, utils::serial&) noexcept = nullptr;
|
||||
bool(*saveable)(bool) noexcept = nullptr;
|
||||
void(*destroy)(void* ptr) noexcept = nullptr;
|
||||
bool is_trivial_and_nonsavable = false;
|
||||
std::string_view name;
|
||||
|
@ -148,6 +149,12 @@ namespace stx
|
|||
std::launder(static_cast<T*>(ptr))->save(stx::exact_t<utils::serial&>(ar));
|
||||
}
|
||||
|
||||
template <typename T> requires requires (const T&) { T::saveable(true); }
|
||||
static bool call_saveable(bool is_writing) noexcept
|
||||
{
|
||||
return T::saveable(is_writing);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static typeinfo make_typeinfo()
|
||||
{
|
||||
|
@ -167,6 +174,11 @@ namespace stx
|
|||
r.save = &call_save<T>;
|
||||
}
|
||||
|
||||
if constexpr (!!(requires (const T&) { T::saveable(true); }))
|
||||
{
|
||||
r.saveable = &call_saveable<T>;
|
||||
}
|
||||
|
||||
r.is_trivial_and_nonsavable = std::is_trivially_default_constructible_v<T> && !r.save;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
@ -284,13 +296,15 @@ namespace stx
|
|||
continue;
|
||||
}
|
||||
|
||||
if (type.create(data, *this, ar, type.name))
|
||||
const bool saveable = !type.saveable || type.saveable(false);
|
||||
|
||||
if (type.create(data, *this, saveable ? ar : nullptr, type.name))
|
||||
{
|
||||
*m_order++ = data;
|
||||
*m_info++ = &type;
|
||||
m_init[id] = true;
|
||||
|
||||
if (ar && type.save)
|
||||
if (ar && saveable && type.save)
|
||||
{
|
||||
serial_breathe_and_tag(*ar, type.name, false);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue