From 1185d627924b9bd5dd13461e7581850a777e9d22 Mon Sep 17 00:00:00 2001 From: Hamish Milne Date: Wed, 25 Dec 2019 23:19:01 +0000 Subject: [PATCH] BOSS service serialization --- TODO | 2 +- src/core/hle/service/apt/apt.h | 8 ++++++++ src/core/hle/service/boss/boss.h | 30 +++++++++++++++++++++++++++- src/core/hle/service/boss/boss_p.cpp | 3 +++ src/core/hle/service/boss/boss_p.h | 6 ++++++ src/core/hle/service/boss/boss_u.cpp | 3 +++ src/core/hle/service/boss/boss_u.h | 6 ++++++ 7 files changed, 56 insertions(+), 2 deletions(-) diff --git a/TODO b/TODO index 9e591af8d..c6e3366e3 100644 --- a/TODO +++ b/TODO @@ -65,7 +65,7 @@ ✔ ACT @done(19-12-24 23:17) ✔ AM @started(19-12-24 23:17) @done(19-12-24 23:53) @lasted(36m8s) ✔ APT @done(19-12-25 21:41) - ☐ BOSS + ✔ BOSS @started(19-12-25 21:48) @done(19-12-25 23:18) @lasted(1h30m14s) ☐ CAM ☐ CECD ☐ CGF diff --git a/src/core/hle/service/apt/apt.h b/src/core/hle/service/apt/apt.h index c12dc3f55..45a93b350 100644 --- a/src/core/hle/service/apt/apt.h +++ b/src/core/hle/service/apt/apt.h @@ -608,6 +608,14 @@ public: protected: bool application_reset_prepared{}; std::shared_ptr apt; + + private: + template + void serialize(Archive& ar, const unsigned int) + { + ar & application_reset_prepared; + } + friend class boost::serialization::access; }; private: diff --git a/src/core/hle/service/boss/boss.h b/src/core/hle/service/boss/boss.h index e0cb39b37..7017ce2b6 100644 --- a/src/core/hle/service/boss/boss.h +++ b/src/core/hle/service/boss/boss.h @@ -5,8 +5,10 @@ #pragma once #include +#include #include "core/hle/kernel/event.h" #include "core/hle/service/service.h" +#include "core/global.h" namespace Core { class System; @@ -952,19 +954,45 @@ public: */ void GetNsDataNewFlagPrivileged(Kernel::HLERequestContext& ctx); - private: + protected: std::shared_ptr boss; + private: u8 new_arrival_flag; u8 ns_data_new_flag; u8 ns_data_new_flag_privileged; u8 output_flag; + + template + void serialize(Archive& ar, const unsigned int) + { + ar & new_arrival_flag; + ar & ns_data_new_flag; + ar & ns_data_new_flag_privileged; + ar & output_flag; + } + friend class boost::serialization::access; }; private: std::shared_ptr task_finish_event; + + template + void serialize(Archive& ar, const unsigned int) + { + ar & task_finish_event; + } + friend class boost::serialization::access; }; void InstallInterfaces(Core::System& system); } // namespace Service::BOSS + +namespace boost::serialization { + template + inline void load_construct_data(Archive& ar, Service::BOSS::Module* t, const unsigned int) + { + ::new(t)Service::BOSS::Module(Core::Global()); + } +} diff --git a/src/core/hle/service/boss/boss_p.cpp b/src/core/hle/service/boss/boss_p.cpp index cdc8f1036..4e48fe8f3 100644 --- a/src/core/hle/service/boss/boss_p.cpp +++ b/src/core/hle/service/boss/boss_p.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include "core/hle/service/boss/boss_p.h" +#include "common/archives.h" namespace Service::BOSS { @@ -84,3 +85,5 @@ BOSS_P::BOSS_P(std::shared_ptr boss) } } // namespace Service::BOSS + +SERIALIZE_EXPORT_IMPL(Service::BOSS::BOSS_P) diff --git a/src/core/hle/service/boss/boss_p.h b/src/core/hle/service/boss/boss_p.h index 9c84a1e9d..56f0cd4fc 100644 --- a/src/core/hle/service/boss/boss_p.h +++ b/src/core/hle/service/boss/boss_p.h @@ -11,6 +11,12 @@ namespace Service::BOSS { class BOSS_P final : public Module::Interface { public: explicit BOSS_P(std::shared_ptr boss); + +private: + SERVICE_SERIALIZATION(BOSS_P, boss, Module) }; } // namespace Service::BOSS + +BOOST_CLASS_EXPORT_KEY(Service::BOSS::BOSS_P) +BOOST_SERIALIZATION_CONSTRUCT(Service::BOSS::BOSS_P) diff --git a/src/core/hle/service/boss/boss_u.cpp b/src/core/hle/service/boss/boss_u.cpp index c6aaba888..f839e9292 100644 --- a/src/core/hle/service/boss/boss_u.cpp +++ b/src/core/hle/service/boss/boss_u.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include "core/hle/service/boss/boss_u.h" +#include "common/archives.h" namespace Service::BOSS { @@ -72,3 +73,5 @@ BOSS_U::BOSS_U(std::shared_ptr boss) } } // namespace Service::BOSS + +SERIALIZE_EXPORT_IMPL(Service::BOSS::BOSS_U) diff --git a/src/core/hle/service/boss/boss_u.h b/src/core/hle/service/boss/boss_u.h index a93b4e502..195783b40 100644 --- a/src/core/hle/service/boss/boss_u.h +++ b/src/core/hle/service/boss/boss_u.h @@ -11,6 +11,12 @@ namespace Service::BOSS { class BOSS_U final : public Module::Interface { public: explicit BOSS_U(std::shared_ptr boss); + +private: + SERVICE_SERIALIZATION(BOSS_U, boss, Module) }; } // namespace Service::BOSS + +BOOST_CLASS_EXPORT_KEY(Service::BOSS::BOSS_U) +BOOST_SERIALIZATION_CONSTRUCT(Service::BOSS::BOSS_U)