Serialize PTM service

This commit is contained in:
Hamish Milne 2020-01-01 22:36:58 +00:00 committed by zhupengfei
parent f5e2f873b0
commit 92857efca4
17 changed files with 77 additions and 3 deletions

4
TODO
View File

@ -101,9 +101,9 @@
✔ NS @done(20-01-01 00:46) ✔ NS @done(20-01-01 00:46)
✔ NWM @done(20-01-01 21:31) ✔ NWM @done(20-01-01 21:31)
☐ Fix wifi_packet_received? ☐ Fix wifi_packet_received?
☐ PM ✔ PM @done(20-01-01 22:14)
✔ PS @done(20-01-01 00:54) ✔ PS @done(20-01-01 00:54)
☐ PTM ✔ PTM @done(20-01-01 22:36)
✔ PXI @done(20-01-01 00:53) ✔ PXI @done(20-01-01 00:53)
☐ QTM ☐ QTM
✔ SOC @done(20-01-01 00:51) ✔ SOC @done(20-01-01 00:51)

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/pm/pm_app.h" #include "core/hle/service/pm/pm_app.h"
SERIALIZE_EXPORT_IMPL(Service::PM::PM_APP)
namespace Service::PM { namespace Service::PM {
PM_APP::PM_APP() : ServiceFramework("pm:app", 3) { PM_APP::PM_APP() : ServiceFramework("pm:app", 3) {

View File

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

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/pm/pm_dbg.h" #include "core/hle/service/pm/pm_dbg.h"
SERIALIZE_EXPORT_IMPL(Service::PM::PM_DBG)
namespace Service::PM { namespace Service::PM {
PM_DBG::PM_DBG() : ServiceFramework("pm:dbg", 3) { PM_DBG::PM_DBG() : ServiceFramework("pm:dbg", 3) {

View File

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

View File

@ -3,6 +3,7 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <cinttypes> #include <cinttypes>
#include "common/archives.h"
#include "common/common_paths.h" #include "common/common_paths.h"
#include "common/file_util.h" #include "common/file_util.h"
#include "common/logging/log.h" #include "common/logging/log.h"
@ -18,6 +19,8 @@
#include "core/hle/service/ptm/ptm_u.h" #include "core/hle/service/ptm/ptm_u.h"
#include "core/settings.h" #include "core/settings.h"
SERIALIZE_EXPORT_IMPL(Service::PTM::Module)
namespace Service::PTM { namespace Service::PTM {
/// Values for the default gamecoin.dat file /// Values for the default gamecoin.dat file

View File

@ -137,7 +137,7 @@ public:
*/ */
void CheckNew3DS(Kernel::HLERequestContext& ctx); void CheckNew3DS(Kernel::HLERequestContext& ctx);
private: protected:
std::shared_ptr<Module> ptm; std::shared_ptr<Module> ptm;
}; };
@ -145,8 +145,18 @@ private:
bool shell_open = true; bool shell_open = true;
bool battery_is_charging = true; bool battery_is_charging = true;
bool pedometer_is_counting = false; bool pedometer_is_counting = false;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& shell_open;
ar& battery_is_charging;
ar& pedometer_is_counting;
}
friend class boost::serialization::access;
}; };
void InstallInterfaces(Core::System& system); void InstallInterfaces(Core::System& system);
} // namespace Service::PTM } // namespace Service::PTM
BOOST_CLASS_EXPORT_KEY(Service::PTM::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/ptm/ptm_gets.h" #include "core/hle/service/ptm/ptm_gets.h"
SERIALIZE_EXPORT_IMPL(Service::PTM::PTM_Gets)
namespace Service::PTM { namespace Service::PTM {
PTM_Gets::PTM_Gets(std::shared_ptr<Module> ptm) PTM_Gets::PTM_Gets(std::shared_ptr<Module> ptm)

View File

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

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/ptm/ptm_play.h" #include "core/hle/service/ptm/ptm_play.h"
SERIALIZE_EXPORT_IMPL(Service::PTM::PTM_Play)
namespace Service::PTM { namespace Service::PTM {
PTM_Play::PTM_Play(std::shared_ptr<Module> ptm) PTM_Play::PTM_Play(std::shared_ptr<Module> ptm)

View File

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

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/ptm/ptm_sets.h" #include "core/hle/service/ptm/ptm_sets.h"
SERIALIZE_EXPORT_IMPL(Service::PTM::PTM_Sets)
namespace Service::PTM { namespace Service::PTM {
PTM_Sets::PTM_Sets(std::shared_ptr<Module> ptm) : Module::Interface(std::move(ptm), "ptm:sets", 1) { PTM_Sets::PTM_Sets(std::shared_ptr<Module> ptm) : Module::Interface(std::move(ptm), "ptm:sets", 1) {

View File

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

View File

@ -2,8 +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/service/ptm/ptm_sysm.h" #include "core/hle/service/ptm/ptm_sysm.h"
SERIALIZE_EXPORT_IMPL(Service::PTM::PTM_S)
SERIALIZE_EXPORT_IMPL(Service::PTM::PTM_Sysm)
namespace Service::PTM { namespace Service::PTM {
PTM_S_Common::PTM_S_Common(std::shared_ptr<Module> ptm, const char* name) PTM_S_Common::PTM_S_Common(std::shared_ptr<Module> ptm, const char* name)

View File

@ -17,11 +17,22 @@ public:
class PTM_S final : public PTM_S_Common { class PTM_S final : public PTM_S_Common {
public: public:
explicit PTM_S(std::shared_ptr<Module> ptm); explicit PTM_S(std::shared_ptr<Module> ptm);
private:
SERVICE_SERIALIZATION(PTM_S, ptm, Module)
}; };
class PTM_Sysm final : public PTM_S_Common { class PTM_Sysm final : public PTM_S_Common {
public: public:
explicit PTM_Sysm(std::shared_ptr<Module> ptm); explicit PTM_Sysm(std::shared_ptr<Module> ptm);
private:
SERVICE_SERIALIZATION(PTM_Sysm, ptm, Module)
}; };
} // namespace Service::PTM } // namespace Service::PTM
BOOST_CLASS_EXPORT_KEY(Service::PTM::PTM_S)
BOOST_CLASS_EXPORT_KEY(Service::PTM::PTM_Sysm)
BOOST_SERIALIZATION_CONSTRUCT(Service::PTM::PTM_S)
BOOST_SERIALIZATION_CONSTRUCT(Service::PTM::PTM_Sysm)

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/ptm/ptm_u.h" #include "core/hle/service/ptm/ptm_u.h"
SERIALIZE_EXPORT_IMPL(Service::PTM::PTM_U)
namespace Service::PTM { namespace Service::PTM {
PTM_U::PTM_U(std::shared_ptr<Module> ptm) : Module::Interface(std::move(ptm), "ptm:u", 26) { PTM_U::PTM_U(std::shared_ptr<Module> ptm) : Module::Interface(std::move(ptm), "ptm:u", 26) {

View File

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