From 452ae2e3714ba6f8de7902c8b6046e22a8f2f957 Mon Sep 17 00:00:00 2001 From: Hamish Milne Date: Thu, 26 Dec 2019 18:10:38 +0000 Subject: [PATCH] Added DSP service serialization --- TODO | 2 +- src/core/hle/service/dsp/dsp_dsp.cpp | 14 ++++++++++++++ src/core/hle/service/dsp/dsp_dsp.h | 19 +++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/TODO b/TODO index 27f720dca..c3e8a57d7 100644 --- a/TODO +++ b/TODO @@ -75,7 +75,7 @@ Also needs archive backend.. ✔ CSND @started(19-12-26 17:51) @done(19-12-26 17:56) @lasted(5m30s) ✔ DLP @done(19-12-26 18:02) - ☐ DSP + ✔ DSP @done(19-12-26 18:10) ☐ ERR ☐ FRD ☐ FS diff --git a/src/core/hle/service/dsp/dsp_dsp.cpp b/src/core/hle/service/dsp/dsp_dsp.cpp index 37682edcc..519d39b0c 100644 --- a/src/core/hle/service/dsp/dsp_dsp.cpp +++ b/src/core/hle/service/dsp/dsp_dsp.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include "audio_core/audio_types.h" +#include "common/archives.h" #include "common/assert.h" #include "common/logging/log.h" #include "core/core.h" @@ -13,6 +14,19 @@ using DspPipe = AudioCore::DspPipe; using InterruptType = Service::DSP::DSP_DSP::InterruptType; +SERIALIZE_EXPORT_IMPL(Service::DSP::DSP_DSP) + +namespace boost::serialization { + template + void load_construct_data(Archive& ar, Service::DSP::DSP_DSP* t, const unsigned int) + { + ::new(t)Service::DSP::DSP_DSP(Core::Global()); + } + + template + void load_construct_data(iarchive& ar, Service::DSP::DSP_DSP* t, const unsigned int); +} + namespace AudioCore { enum class DspPipe; } diff --git a/src/core/hle/service/dsp/dsp_dsp.h b/src/core/hle/service/dsp/dsp_dsp.h index ef1f0b76d..b4c727091 100644 --- a/src/core/hle/service/dsp/dsp_dsp.h +++ b/src/core/hle/service/dsp/dsp_dsp.h @@ -264,8 +264,27 @@ private: /// Each DSP pipe has an associated interrupt std::array, AudioCore::num_dsp_pipe> pipes = {{}}; + + template + void serialize(Archive& ar, const unsigned int) + { + ar & boost::serialization::base_object(*this); + ar & semaphore_event; + ar & preset_semaphore; + ar & interrupt_zero; + ar & interrupt_one; + ar & pipes; + } + friend class boost::serialization::access; }; void InstallInterfaces(Core::System& system); } // namespace Service::DSP + +BOOST_CLASS_EXPORT_KEY(Service::DSP::DSP_DSP) + +namespace boost::serialization { + template + void load_construct_data(Archive& ar, Service::DSP::DSP_DSP* t, const unsigned int); +}