Serialize IR, MVD, NDM, NEWS, NFC

This commit is contained in:
Hamish Milne 2019-12-31 20:39:38 +00:00 committed by zhupengfei
parent 3d6e372f96
commit 2409ee39cb
19 changed files with 112 additions and 5 deletions

8
TODO
View File

@ -88,10 +88,10 @@
✔ IR @done(19-12-30 16:06) ✔ IR @done(19-12-30 16:06)
✔ LDR_RO @done(19-12-30 16:25) ✔ LDR_RO @done(19-12-30 16:25)
✔ MIC @done(19-12-30 16:53) ✔ MIC @done(19-12-30 16:53)
☐ MVD ✔ MVD @done(19-12-31 18:26)
☐ NDM ✔ NDM @done(19-12-31 18:26)
☐ NEWS ✔ NEWS @done(19-12-31 18:29)
☐ NFC ✔ NFC @done(19-12-31 20:35)
☐ NIM ☐ NIM
☐ NS ☐ NS
☐ NWM ☐ NWM

View File

@ -2,6 +2,7 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/archives.h"
#include "core/core.h" #include "core/core.h"
#include "core/core_timing.h" #include "core/core_timing.h"
#include "core/hle/ipc_helpers.h" #include "core/hle/ipc_helpers.h"
@ -12,8 +13,24 @@
#include "core/movie.h" #include "core/movie.h"
#include "core/settings.h" #include "core/settings.h"
SERIALIZE_EXPORT_IMPL(Service::IR::IR_RST)
SERVICE_CONSTRUCT_IMPL(Service::IR::IR_RST)
namespace Service::IR { namespace Service::IR {
template <class Archive>
void IR_RST::serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<Kernel::SessionRequestHandler>(*this);
ar& update_event;
ar& shared_memory;
ar& next_pad_index;
ar& raw_c_stick;
ar& update_period;
// update_callback_id and input devices are set separately
ReloadInputDevices();
}
SERIALIZE_IMPL(IR_RST)
struct PadDataEntry { struct PadDataEntry {
PadState current_state; PadState current_state;
PadState delta_additions; PadState delta_additions;

View File

@ -87,6 +87,13 @@ private:
std::atomic<bool> is_device_reload_pending{false}; std::atomic<bool> is_device_reload_pending{false};
bool raw_c_stick{false}; bool raw_c_stick{false};
int update_period{0}; int update_period{0};
template <class Archive>
void serialize(Archive& ar, const unsigned int);
friend class boost::serialization::access;
}; };
} // namespace Service::IR } // namespace Service::IR
BOOST_CLASS_EXPORT_KEY(Service::IR::IR_RST)
SERVICE_CONSTRUCT(Service::IR::IR_RST)

View File

@ -2,8 +2,11 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/archives.h"
#include "core/hle/service/ir/ir_u.h" #include "core/hle/service/ir/ir_u.h"
SERIALIZE_EXPORT_IMPL(Service::IR::IR_U)
namespace Service::IR { namespace Service::IR {
IR_U::IR_U() : ServiceFramework("ir:u", 1) { IR_U::IR_U() : ServiceFramework("ir:u", 1) {

View File

@ -15,3 +15,5 @@ public:
}; };
} // namespace Service::IR } // namespace Service::IR
BOOST_CLASS_EXPORT_KEY(Service::IR::IR_U)

View File

@ -2,9 +2,12 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/archives.h"
#include "core/hle/ipc_helpers.h" #include "core/hle/ipc_helpers.h"
#include "core/hle/service/mvd/mvd_std.h" #include "core/hle/service/mvd/mvd_std.h"
SERIALIZE_EXPORT_IMPL(Service::MVD::MVD_STD)
namespace Service::MVD { namespace Service::MVD {
MVD_STD::MVD_STD() : ServiceFramework("mvd:std", 1) { MVD_STD::MVD_STD() : ServiceFramework("mvd:std", 1) {

View File

@ -12,6 +12,15 @@ class MVD_STD final : public ServiceFramework<MVD_STD> {
public: public:
MVD_STD(); MVD_STD();
~MVD_STD() = default; ~MVD_STD() = default;
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<Kernel::SessionRequestHandler>(*this);
}
friend class boost::serialization::access;
}; };
} // namespace Service::MVD } // namespace Service::MVD
BOOST_CLASS_EXPORT_KEY(Service::MVD::MVD_STD)

View File

@ -2,10 +2,13 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/archives.h"
#include "core/core.h" #include "core/core.h"
#include "core/hle/ipc_helpers.h" #include "core/hle/ipc_helpers.h"
#include "core/hle/service/ndm/ndm_u.h" #include "core/hle/service/ndm/ndm_u.h"
SERIALIZE_EXPORT_IMPL(Service::NDM::NDM_U)
namespace Service::NDM { namespace Service::NDM {
void NDM_U::EnterExclusiveState(Kernel::HLERequestContext& ctx) { void NDM_U::EnterExclusiveState(Kernel::HLERequestContext& ctx) {

View File

@ -270,8 +270,23 @@ private:
u32 scan_interval = DEFAULT_SCAN_INTERVAL; u32 scan_interval = DEFAULT_SCAN_INTERVAL;
u32 retry_interval = DEFAULT_RETRY_INTERVAL; u32 retry_interval = DEFAULT_RETRY_INTERVAL;
bool daemon_lock_enabled = false; bool daemon_lock_enabled = false;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::base_object<Kernel::SessionRequestHandler>(*this);
ar& daemon_bit_mask;
ar& default_daemon_bit_mask;
ar& daemon_status;
ar& exclusive_state;
ar& scan_interval;
ar& retry_interval;
ar& daemon_lock_enabled;
}
friend class boost::serialization::access;
}; };
void InstallInterfaces(Core::System& system); void InstallInterfaces(Core::System& system);
} // namespace Service::NDM } // namespace Service::NDM
BOOST_CLASS_EXPORT_KEY(Service::NDM::NDM_U)

View File

@ -2,9 +2,12 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/archives.h"
#include "core/hle/ipc_helpers.h" #include "core/hle/ipc_helpers.h"
#include "core/hle/service/news/news_s.h" #include "core/hle/service/news/news_s.h"
SERIALIZE_EXPORT_IMPL(Service::NEWS::NEWS_S)
namespace Service::NEWS { namespace Service::NEWS {
void NEWS_S::GetTotalNotifications(Kernel::HLERequestContext& ctx) { void NEWS_S::GetTotalNotifications(Kernel::HLERequestContext& ctx) {

View File

@ -27,3 +27,5 @@ private:
}; };
} // namespace Service::NEWS } // namespace Service::NEWS
BOOST_CLASS_EXPORT_KEY(Service::NEWS::NEWS_S)

View File

@ -2,8 +2,11 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/archives.h"
#include "core/hle/service/news/news_u.h" #include "core/hle/service/news/news_u.h"
SERIALIZE_EXPORT_IMPL(Service::NEWS::NEWS_U)
namespace Service::NEWS { namespace Service::NEWS {
NEWS_U::NEWS_U() : ServiceFramework("news:u", 1) { NEWS_U::NEWS_U() : ServiceFramework("news:u", 1) {

View File

@ -15,3 +15,5 @@ public:
}; };
} // namespace Service::NEWS } // namespace Service::NEWS
BOOST_CLASS_EXPORT_KEY(Service::NEWS::NEWS_U)

View File

@ -2,6 +2,7 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/archives.h"
#include "core/core.h" #include "core/core.h"
#include "core/hle/ipc_helpers.h" #include "core/hle/ipc_helpers.h"
#include "core/hle/kernel/event.h" #include "core/hle/kernel/event.h"
@ -10,8 +11,20 @@
#include "core/hle/service/nfc/nfc_m.h" #include "core/hle/service/nfc/nfc_m.h"
#include "core/hle/service/nfc/nfc_u.h" #include "core/hle/service/nfc/nfc_u.h"
SERVICE_CONSTRUCT_IMPL(Service::NFC::Module)
SERIALIZE_EXPORT_IMPL(Service::NFC::Module)
namespace Service::NFC { namespace Service::NFC {
template <class Archive>
void Module::serialize(Archive& ar, const unsigned int) {
ar& tag_in_range_event;
ar& tag_out_of_range_event;
ar& nfc_tag_state;
ar& nfc_status;
}
SERIALIZE_IMPL(Module)
struct TagInfo { struct TagInfo {
u16_le id_offset_size; u16_le id_offset_size;
u8 unk1; u8 unk1;

View File

@ -226,7 +226,7 @@ public:
*/ */
void GetIdentificationBlock(Kernel::HLERequestContext& ctx); void GetIdentificationBlock(Kernel::HLERequestContext& ctx);
private: protected:
std::shared_ptr<Module> nfc; std::shared_ptr<Module> nfc;
}; };
@ -241,8 +241,15 @@ private:
AmiiboData amiibo_data{}; AmiiboData amiibo_data{};
bool amiibo_in_range = false; bool amiibo_in_range = false;
template <class Archive>
void serialize(Archive& ar, const unsigned int);
friend class boost::serialization::access;
}; };
void InstallInterfaces(Core::System& system); void InstallInterfaces(Core::System& system);
} // namespace Service::NFC } // namespace Service::NFC
SERVICE_CONSTRUCT(Service::NFC::Module)
BOOST_CLASS_EXPORT_KEY(Service::NFC::Module)

View File

@ -2,8 +2,11 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/archives.h"
#include "core/hle/service/nfc/nfc_m.h" #include "core/hle/service/nfc/nfc_m.h"
SERIALIZE_EXPORT_IMPL(Service::NFC::NFC_M)
namespace Service::NFC { namespace Service::NFC {
NFC_M::NFC_M(std::shared_ptr<Module> nfc) : Module::Interface(std::move(nfc), "nfc:m", 1) { NFC_M::NFC_M(std::shared_ptr<Module> nfc) : Module::Interface(std::move(nfc), "nfc:m", 1) {

View File

@ -11,6 +11,12 @@ namespace Service::NFC {
class NFC_M final : public Module::Interface { class NFC_M final : public Module::Interface {
public: public:
explicit NFC_M(std::shared_ptr<Module> nfc); explicit NFC_M(std::shared_ptr<Module> nfc);
private:
SERVICE_SERIALIZATION(NFC_M, nfc, Module)
}; };
} // namespace Service::NFC } // namespace Service::NFC
BOOST_CLASS_EXPORT_KEY(Service::NFC::NFC_M)
BOOST_SERIALIZATION_CONSTRUCT(Service::NFC::NFC_M)

View File

@ -2,8 +2,11 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "common/archives.h"
#include "core/hle/service/nfc/nfc_u.h" #include "core/hle/service/nfc/nfc_u.h"
SERIALIZE_EXPORT_IMPL(Service::NFC::NFC_U)
namespace Service::NFC { namespace Service::NFC {
NFC_U::NFC_U(std::shared_ptr<Module> nfc) : Module::Interface(std::move(nfc), "nfc:u", 1) { NFC_U::NFC_U(std::shared_ptr<Module> nfc) : Module::Interface(std::move(nfc), "nfc:u", 1) {

View File

@ -11,6 +11,12 @@ namespace Service::NFC {
class NFC_U final : public Module::Interface { class NFC_U final : public Module::Interface {
public: public:
explicit NFC_U(std::shared_ptr<Module> nfc); explicit NFC_U(std::shared_ptr<Module> nfc);
private:
SERVICE_SERIALIZATION(NFC_U, nfc, Module)
}; };
} // namespace Service::NFC } // namespace Service::NFC
BOOST_CLASS_EXPORT_KEY(Service::NFC::NFC_U)
BOOST_SERIALIZATION_CONSTRUCT(Service::NFC::NFC_U)