diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h index 22f8fe007..97c487aba 100644 --- a/src/core/arm/arm_interface.h +++ b/src/core/arm/arm_interface.h @@ -35,8 +35,7 @@ public: const auto r = GetCpuRegister(i); ar << r; } - std::size_t fpu_reg_count = file_version == 0 ? 16 : 64; - for (std::size_t i = 0; i < fpu_reg_count; i++) { + for (std::size_t i = 0; i < 64; i++) { const auto r = GetFpuRegister(i); ar << r; } @@ -55,8 +54,7 @@ public: ar >> r; SetCpuRegister(i, r); } - std::size_t fpu_reg_count = file_version == 0 ? 16 : 64; - for (std::size_t i = 0; i < fpu_reg_count; i++) { + for (std::size_t i = 0; i < 64; i++) { ar >> r; SetFpuRegister(i, r); } @@ -268,8 +266,7 @@ private: ar << pc; const auto cpsr = GetCPSR(); ar << cpsr; - int vfp_reg_count = file_version == 0 ? 32 : 64; - for (int i = 0; i < vfp_reg_count; i++) { + for (int i = 0; i < 64; i++) { const auto r = GetVFPReg(i); ar << r; } @@ -316,8 +313,7 @@ private: SetPC(r); ar >> r; SetCPSR(r); - int vfp_reg_count = file_version == 0 ? 32 : 64; - for (int i = 0; i < vfp_reg_count; i++) { + for (int i = 0; i < 64; i++) { ar >> r; SetVFPReg(i, r); } diff --git a/src/core/core.cpp b/src/core/core.cpp index de239fe21..b39c81223 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -717,9 +717,7 @@ void System::serialize(Archive& ar, const unsigned int file_version) { ar&* memory.get(); ar&* kernel.get(); VideoCore::serialize(ar, file_version); - if (file_version >= 1) { - ar& movie; - } + ar& movie; // This needs to be set from somewhere - might as well be here! if (Archive::is_loading::value) { diff --git a/src/core/core_timing.h b/src/core/core_timing.h index 998c3886d..006d10959 100644 --- a/src/core/core_timing.h +++ b/src/core/core_timing.h @@ -299,13 +299,7 @@ private: void serialize(Archive& ar, const unsigned int file_version) { // event_types set during initialization of other things ar& timers; - if (file_version == 0) { - std::shared_ptr x; - ar& x; - current_timer = x.get(); - } else { - ar& current_timer; - } + ar& current_timer; if (Archive::is_loading::value) { event_queue_locked = true; } diff --git a/src/core/hle/kernel/address_arbiter.h b/src/core/hle/kernel/address_arbiter.h index 86b46ed3e..893df5408 100644 --- a/src/core/hle/kernel/address_arbiter.h +++ b/src/core/hle/kernel/address_arbiter.h @@ -79,29 +79,13 @@ private: void WakeUp(ThreadWakeupReason reason, std::shared_ptr thread, std::shared_ptr object) override; - class DummyCallback : public WakeupCallback { - public: - void WakeUp(ThreadWakeupReason reason, std::shared_ptr thread, - std::shared_ptr object) override {} - }; - friend class boost::serialization::access; template void serialize(Archive& ar, const unsigned int file_version) { ar& boost::serialization::base_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(x); - } ar& name; ar& waiting_threads; - if (file_version > 1) { - ar& timeout_callback; - } + ar& timeout_callback; } }; diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 5c2c44b4a..635e73f89 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -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 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; diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h index 543b8fa3c..493d6d5c6 100644 --- a/src/core/hle/kernel/thread.h +++ b/src/core/hle/kernel/thread.h @@ -11,9 +11,9 @@ #include #include #include -#include #include #include +#include #include "common/common_types.h" #include "common/thread_queue_list.h" #include "core/arm/arm_interface.h" diff --git a/src/core/hle/service/apt/applet_manager.h b/src/core/hle/service/apt/applet_manager.h index 13bbbd2d6..8794b7713 100644 --- a/src/core/hle/service/apt/applet_manager.h +++ b/src/core/hle/service/apt/applet_manager.h @@ -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; diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp index 88d9e2953..0d6505ca2 100644 --- a/src/core/hle/service/apt/apt.cpp +++ b/src/core/hle/service/apt/apt.cpp @@ -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) diff --git a/src/core/hle/service/cam/cam.cpp b/src/core/hle/service/cam/cam.cpp index a9f4b61b4..26a2360db 100644 --- a/src/core/hle/service/cam/cam.cpp +++ b/src/core/hle/service/cam/cam.cpp @@ -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); diff --git a/src/core/hle/service/cam/cam.h b/src/core/hle/service/cam/cam.h index 5fea2b3ca..936a8d447 100644 --- a/src/core/hle/service/cam/cam.h +++ b/src/core/hle/service/cam/cam.h @@ -681,11 +681,6 @@ private: private: template void serialize(Archive& ar, const unsigned int file_version) { - // For compatibility: put a nullptr here - if (file_version == 0) { - std::unique_ptr x; - ar& x; - } ar& contexts; ar& current_context; ar& frame_rate; diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index cc4a33b46..a02e5a99b 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -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) } diff --git a/src/core/hle/service/mic/mic_u.cpp b/src/core/hle/service/mic/mic_u.cpp index bca6177c0..9b24f4591 100644 --- a/src/core/hle/service/mic/mic_u.cpp +++ b/src/core/hle/service/mic/mic_u.cpp @@ -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(); } } } diff --git a/src/core/movie.cpp b/src/core/movie.cpp index 376f8521d..3602ae9b6 100644 --- a/src/core/movie.cpp +++ b/src/core/movie.cpp @@ -153,37 +153,30 @@ void Movie::serialize(Archive& ar, const unsigned int file_version) { u64 _current_byte = static_cast(current_byte); ar& _current_byte; current_byte = static_cast(_current_byte); - - if (file_version > 0) { - ar& current_input; - } + ar& current_input; std::vector recorded_input_ = recorded_input; ar& recorded_input_; ar& init_time; - if (file_version > 0) { - if (Archive::is_loading::value) { - u64 savestate_movie_id; - ar& savestate_movie_id; - if (id != savestate_movie_id) { - if (savestate_movie_id == 0) { - throw std::runtime_error("You must close your movie to load this state"); - } else { - throw std::runtime_error("You must load the same movie to load this state"); - } + if (Archive::is_loading::value) { + u64 savestate_movie_id; + ar& savestate_movie_id; + if (id != savestate_movie_id) { + if (savestate_movie_id == 0) { + throw std::runtime_error("You must close your movie to load this state"); + } else { + throw std::runtime_error("You must load the same movie to load this state"); } - } else { - ar& id; } + } else { + ar& id; } // Whether the state was made in MovieFinished state bool post_movie = play_mode == PlayMode::MovieFinished; - if (file_version > 0) { - ar& post_movie; - } + ar& post_movie; if (Archive::is_loading::value && id != 0) { if (!read_only) {