diff --git a/src/audio_core/dsp_interface.h b/src/audio_core/dsp_interface.h index fc3d7cab2d..29ec13d613 100644 --- a/src/audio_core/dsp_interface.h +++ b/src/audio_core/dsp_interface.h @@ -6,6 +6,7 @@ #include #include +#include "boost/serialization/array.hpp" #include "audio_core/audio_types.h" #include "audio_core/time_stretch.h" #include "common/common_types.h" diff --git a/src/core/core.cpp b/src/core/core.cpp index ebaee4f870..cee6a38666 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -4,9 +4,12 @@ #include #include +#include "boost/serialization/array.hpp" +#include "boost/serialization/unique_ptr.hpp" #include "audio_core/dsp_interface.h" #include "audio_core/hle/hle.h" #include "audio_core/lle/lle.h" +#include "common/archives.h" #include "common/logging/log.h" #include "common/texture.h" #include "core/arm/arm_interface.h" @@ -30,7 +33,9 @@ #include "core/hle/service/fs/archive.h" #include "core/hle/service/service.h" #include "core/hle/service/sm/sm.h" +#include "core/hw/gpu.h" #include "core/hw/hw.h" +#include "core/hw/lcd.h" #include "core/loader/loader.h" #include "core/movie.h" #include "core/rpc/rpc_server.h" @@ -389,4 +394,25 @@ void System::Reset() { Load(*m_emu_window, m_filepath); } +template +void System::serialize(Archive & ar, const unsigned int file_version) +{ + ar & memory; + ar & GPU::g_regs; + ar & LCD::g_regs; + ar & dsp_core->GetDspMemory(); +} + +void System::Save(std::ostream &stream) const +{ + boost::archive::binary_oarchive oa{stream}; + oa & *this; +} + +void System::Load(std::istream &stream) +{ + boost::archive::binary_iarchive ia{stream}; + ia & *this; +} + } // namespace Core diff --git a/src/core/core.h b/src/core/core.h index 333e4a76c6..b811badbaa 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -6,6 +6,7 @@ #include #include +#include "boost/serialization/access.hpp" #include "common/common_types.h" #include "core/custom_tex_cache.h" #include "core/frontend/applets/mii_selector.h" @@ -15,7 +16,6 @@ #include "core/memory.h" #include "core/perf_stats.h" #include "core/telemetry_session.h" -class boost::serialization::access; class ARM_Interface; @@ -272,6 +272,10 @@ public: return registered_image_interface; } + void Save(std::ostream &stream) const; + + void Load(std::istream &stream); + private: /** * Initialize the emulated system. @@ -342,11 +346,7 @@ private: friend class boost::serialization::access; template - void serialize(Archive & ar, const unsigned int file_version) - { - ar & GPU::g_regs; - ar & LCD::g_regs; - } + void serialize(Archive & ar, const unsigned int file_version); }; inline ARM_Interface& CPU() { diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 9ee279129d..fe33cf767d 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -6,6 +6,7 @@ #include #include "boost/serialization/array.hpp" #include "boost/serialization/nvp.hpp" +#include "boost/serialization/unique_ptr.hpp" #include "audio_core/dsp_interface.h" #include "common/archives.h" #include "common/assert.h" @@ -107,11 +108,17 @@ private: } }; -SERIALIZE_IMPL(MemorySystem::Impl) - MemorySystem::MemorySystem() : impl(std::make_unique()) {} MemorySystem::~MemorySystem() = default; +template +void MemorySystem::serialize(Archive & ar, const unsigned int file_version) +{ + ar & impl; +} + +SERIALIZE_IMPL(MemorySystem) + void MemorySystem::SetCurrentPageTable(PageTable* page_table) { impl->current_page_table = page_table; } diff --git a/src/core/memory.h b/src/core/memory.h index e5582d16d4..9c1455a806 100644 --- a/src/core/memory.h +++ b/src/core/memory.h @@ -9,7 +9,7 @@ #include #include #include -#include "boost/serialization/split_member.hpp" +#include "boost/serialization/access.hpp" #include "common/common_types.h" #include "core/mmio.h" @@ -324,6 +324,10 @@ private: class Impl; std::unique_ptr impl; + + friend class boost::serialization::access; + template + void serialize(Archive & ar, const unsigned int file_version); }; /// Determines if the given VAddr is valid for the specified process.