code: Remove save state compatibility checks (#6980)

This commit is contained in:
GPUCode 2023-09-17 01:22:10 +03:00 committed by GitHub
parent 542209c993
commit d1c16bad78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 52 additions and 115 deletions

View file

@ -79,29 +79,13 @@ private:
void WakeUp(ThreadWakeupReason reason, std::shared_ptr<Thread> thread,
std::shared_ptr<WaitObject> object) override;
class DummyCallback : public WakeupCallback {
public:
void WakeUp(ThreadWakeupReason reason, std::shared_ptr<Thread> thread,
std::shared_ptr<WaitObject> object) override {}
};
friend class boost::serialization::access;
template <class Archive>
void serialize(Archive& ar, const unsigned int file_version) {
ar& boost::serialization::base_object<Object>(*this);
if (file_version == 1) {
// This rigmarole is needed because in past versions, AddressArbiter inherited
// WakeupCallback But it turns out this breaks shared_from_this, so we split it out.
// Using a dummy class to deserialize a base_object allows compatibility to be
// maintained.
DummyCallback x;
ar& boost::serialization::base_object<WakeupCallback>(x);
}
ar& name;
ar& waiting_threads;
if (file_version > 1) {
ar& timeout_callback;
}
ar& timeout_callback;
}
};

View file

@ -45,16 +45,7 @@ void Thread::serialize(Archive& ar, const unsigned int file_version) {
ar& tls_address;
ar& held_mutexes;
ar& pending_mutexes;
// Note: this is equivalent of what is done in boost/serialization/weak_ptr.hpp, but it's
// compatible with previous versions of savestates.
// TODO(SaveStates): When the savestate version is bumped, simplify this again.
std::shared_ptr<Process> shared_owner_process = owner_process.lock();
ar& shared_owner_process;
if (Archive::is_loading::value) {
owner_process = shared_owner_process;
}
ar& owner_process;
ar& wait_objects;
ar& wait_address;
ar& name;

View file

@ -11,9 +11,9 @@
#include <vector>
#include <boost/container/flat_set.hpp>
#include <boost/serialization/export.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/unordered_map.hpp>
#include <boost/serialization/vector.hpp>
#include <boost/serialization/weak_ptr.hpp>
#include "common/common_types.h"
#include "common/thread_queue_list.h"
#include "core/arm/arm_interface.h"

View file

@ -188,9 +188,7 @@ private:
void serialize(Archive& ar, const unsigned int file_version) {
ar& next_title_id;
ar& next_media_type;
if (file_version > 0) {
ar& flags;
}
ar& flags;
ar& current_title_id;
ar& current_media_type;
}
@ -517,25 +515,23 @@ private:
void serialize(Archive& ar, const unsigned int file_version) {
ar& next_parameter;
ar& app_jump_parameters;
if (file_version > 0) {
ar& delayed_parameter;
ar& app_start_parameters;
ar& deliver_arg;
ar& capture_info;
ar& capture_buffer_info;
ar& active_slot;
ar& last_library_launcher_slot;
ar& last_prepared_library_applet;
ar& last_system_launcher_slot;
ar& last_jump_to_home_slot;
ar& ordered_to_close_sys_applet;
ar& ordered_to_close_application;
ar& application_cancelled;
ar& application_close_target;
ar& new_3ds_mode_blocked;
ar& lock;
ar& capture_info;
}
ar& delayed_parameter;
ar& app_start_parameters;
ar& deliver_arg;
ar& capture_info;
ar& capture_buffer_info;
ar& active_slot;
ar& last_library_launcher_slot;
ar& last_prepared_library_applet;
ar& last_system_launcher_slot;
ar& last_jump_to_home_slot;
ar& ordered_to_close_sys_applet;
ar& ordered_to_close_application;
ar& application_cancelled;
ar& application_close_target;
ar& new_3ds_mode_blocked;
ar& lock;
ar& capture_info;
ar& applet_slots;
ar& library_applet_closing_command;

View file

@ -48,9 +48,7 @@ void Module::serialize(Archive& ar, const unsigned int file_version) {
ar& cpu_percent;
ar& screen_capture_post_permission;
ar& applet_manager;
if (file_version > 0) {
ar& wireless_reboot_info;
}
ar& wireless_reboot_info;
}
SERIALIZE_IMPL(Module)

View file

@ -30,11 +30,7 @@ void Module::serialize(Archive& ar, const unsigned int file_version) {
ar& cameras;
ar& ports;
ar& is_camera_reload_pending;
if (file_version > 0) {
ar& initialized;
} else {
initialized = true;
}
ar& initialized;
if (Archive::is_loading::value && initialized) {
for (int i = 0; i < NumCameras; i++) {
LoadCameraImplementation(cameras[i], i);

View file

@ -681,11 +681,6 @@ private:
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int file_version) {
// For compatibility: put a nullptr here
if (file_version == 0) {
std::unique_ptr<Camera::CameraInterface> x;
ar& x;
}
ar& contexts;
ar& current_context;
ar& frame_rate;

View file

@ -46,9 +46,7 @@ void Module::serialize(Archive& ar, const unsigned int file_version) {
if (Archive::is_loading::value) {
LoadInputDevices();
}
if (file_version >= 1) {
ar& state.hex;
}
ar& state.hex;
// Update events are set in the constructor
// Devices are set from the implementation (and are stateless afaik)
}

View file

@ -400,18 +400,16 @@ private:
ar& clamp;
// mic interface set in constructor
ar& state;
if (file_version > 0) {
// Maintain the internal mic state
ar& encoding;
bool is_sampling = mic && mic->IsSampling();
ar& is_sampling;
if (Archive::is_loading::value) {
if (is_sampling) {
CreateMic();
StartSampling();
} else if (mic) {
mic->StopSampling();
}
// Maintain the internal mic state
ar& encoding;
bool is_sampling = mic && mic->IsSampling();
ar& is_sampling;
if (Archive::is_loading::value) {
if (is_sampling) {
CreateMic();
StartSampling();
} else if (mic) {
mic->StopSampling();
}
}
}