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)
✔ LDR_RO @done(19-12-30 16:25)
✔ MIC @done(19-12-30 16:53)
☐ MVD
☐ NDM
☐ NEWS
☐ NFC
✔ MVD @done(19-12-31 18:26)
✔ NDM @done(19-12-31 18:26)
✔ NEWS @done(19-12-31 18:29)
✔ NFC @done(19-12-31 20:35)
☐ NIM
☐ NS
☐ NWM

View file

@ -2,6 +2,7 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/archives.h"
#include "core/core.h"
#include "core/core_timing.h"
#include "core/hle/ipc_helpers.h"
@ -12,8 +13,24 @@
#include "core/movie.h"
#include "core/settings.h"
SERIALIZE_EXPORT_IMPL(Service::IR::IR_RST)
SERVICE_CONSTRUCT_IMPL(Service::IR::IR_RST)
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 {
PadState current_state;
PadState delta_additions;

View file

@ -87,6 +87,13 @@ private:
std::atomic<bool> is_device_reload_pending{false};
bool raw_c_stick{false};
int update_period{0};
template <class Archive>
void serialize(Archive& ar, const unsigned int);
friend class boost::serialization::access;
};
} // 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
// Refer to the license.txt file included.
#include "common/archives.h"
#include "core/hle/service/ir/ir_u.h"
SERIALIZE_EXPORT_IMPL(Service::IR::IR_U)
namespace Service::IR {
IR_U::IR_U() : ServiceFramework("ir:u", 1) {

View file

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

View file

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

View file

@ -12,6 +12,15 @@ class MVD_STD final : public ServiceFramework<MVD_STD> {
public:
MVD_STD();
~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
BOOST_CLASS_EXPORT_KEY(Service::MVD::MVD_STD)

View file

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

View file

@ -270,8 +270,23 @@ private:
u32 scan_interval = DEFAULT_SCAN_INTERVAL;
u32 retry_interval = DEFAULT_RETRY_INTERVAL;
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);
} // namespace Service::NDM
BOOST_CLASS_EXPORT_KEY(Service::NDM::NDM_U)

View file

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

View file

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

View file

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

View file

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

View file

@ -2,6 +2,7 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/archives.h"
#include "core/core.h"
#include "core/hle/ipc_helpers.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_u.h"
SERVICE_CONSTRUCT_IMPL(Service::NFC::Module)
SERIALIZE_EXPORT_IMPL(Service::NFC::Module)
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 {
u16_le id_offset_size;
u8 unk1;

View file

@ -226,7 +226,7 @@ public:
*/
void GetIdentificationBlock(Kernel::HLERequestContext& ctx);
private:
protected:
std::shared_ptr<Module> nfc;
};
@ -241,8 +241,15 @@ private:
AmiiboData amiibo_data{};
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);
} // 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
// Refer to the license.txt file included.
#include "common/archives.h"
#include "core/hle/service/nfc/nfc_m.h"
SERIALIZE_EXPORT_IMPL(Service::NFC::NFC_M)
namespace Service::NFC {
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 {
public:
explicit NFC_M(std::shared_ptr<Module> nfc);
private:
SERVICE_SERIALIZATION(NFC_M, nfc, Module)
};
} // 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
// Refer to the license.txt file included.
#include "common/archives.h"
#include "core/hle/service/nfc/nfc_u.h"
SERIALIZE_EXPORT_IMPL(Service::NFC::NFC_U)
namespace Service::NFC {
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 {
public:
explicit NFC_U(std::shared_ptr<Module> nfc);
private:
SERVICE_SERIALIZATION(NFC_U, nfc, Module)
};
} // namespace Service::NFC
BOOST_CLASS_EXPORT_KEY(Service::NFC::NFC_U)
BOOST_SERIALIZATION_CONSTRUCT(Service::NFC::NFC_U)