Savestates Support For PS3 Emulation (#10478)

This commit is contained in:
Elad Ashkenazi 2022-07-04 16:02:17 +03:00 committed by GitHub
parent 969b9eb89d
commit fcd297ffb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
154 changed files with 4948 additions and 635 deletions

View file

@ -94,7 +94,7 @@ public:
static constexpr auto thread_name = "Gem Thread"sv;
atomic_t<u32> state = 0;
atomic_t<u8> state = 0;
struct gem_color
{
@ -131,6 +131,8 @@ public:
u64 calibration_start_us{0}; // The start timestamp of the calibration in microseconds
static constexpr u64 calibration_time_us = 500000; // The calibration supposedly takes 0.5 seconds (500000 microseconds)
ENABLE_BITWISE_SERIALIZATION;
};
CellGemAttribute attribute = {};
@ -202,6 +204,30 @@ public:
controllers[gem_num].port = 7u - gem_num;
}
}
gem_config_data() = default;
SAVESTATE_INIT_POS(15);
void save(utils::serial& ar)
{
ar(state);
if (!state)
{
return;
}
USING_SERIALIZATION_VERSION_COND(ar.is_writing(), cellGem);
ar(attribute, vc_attribute, status_flags, enable_pitch_correction, inertial_counter, controllers
, connected_controllers, update_started, camera_frame, memory_ptr, start_timestamp);
}
gem_config_data(utils::serial& ar)
{
save(ar);
}
};
static inline int32_t cellGemGetVideoConvertSize(s32 output_format)
@ -854,7 +880,7 @@ error_code cellGemEnd(ppu_thread& ppu)
if (gem.state.compare_and_swap_test(1, 0))
{
if (u32 addr = gem.memory_ptr)
if (u32 addr = std::exchange(gem.memory_ptr, 0))
{
sys_memory_free(ppu, addr);
}