Serialize NWM service

This commit is contained in:
Hamish Milne 2020-01-01 21:31:52 +00:00 committed by zhupengfei
parent 571b1062f0
commit f5e2f873b0
18 changed files with 82 additions and 8 deletions

18
TODO
View File

@ -10,11 +10,16 @@
☐ App loader ☐ App loader
☐ Archive manager ☐ Archive manager
☐ Custom texture cache ☐ Custom texture cache
☐ MMIO ✘ MMIO @cancelled(20-01-01 01:06)
☐ Movie Seems that this whole subsystem is only used in tests
☐ Perf stats ✘ Movie @cancelled(20-01-01 01:07)
☐ Settings Doesn't need to be serialized here
☐ Telemetry session ✘ Perf stats @cancelled(20-01-01 01:09)
Doesn't need to be serialized here
✘ Settings @cancelled(20-01-01 01:11)
For now, let the settings just be whatever they are
✘ Telemetry session @cancelled(20-01-01 01:12)
Doesn't need to be serialized here
☐ Replace SERIALIZE_AS_POD with BOOST_IS_BITWISE_SERIALIZABLE ☐ Replace SERIALIZE_AS_POD with BOOST_IS_BITWISE_SERIALIZABLE
☐ Review constructor/initialization code ☐ Review constructor/initialization code
✔ Fix CI @done(19-12-31 21:32) ✔ Fix CI @done(19-12-31 21:32)
@ -94,7 +99,8 @@
✔ NFC @done(19-12-31 20:35) ✔ NFC @done(19-12-31 20:35)
✔ NIM @done(19-12-31 21:08) ✔ NIM @done(19-12-31 21:08)
✔ NS @done(20-01-01 00:46) ✔ NS @done(20-01-01 00:46)
☐ NWM ✔ NWM @done(20-01-01 21:31)
☐ Fix wifi_packet_received?
☐ PM ☐ PM
✔ PS @done(20-01-01 00:54) ✔ PS @done(20-01-01 00:54)
☐ PTM ☐ PTM

2
externals/boost vendored

@ -1 +1 @@
Subproject commit 65dc954e93b22870b8423701e225147c75e3b31b Subproject commit 6d7edc593be8e47c8de7bc5f7d6b32971fad0c24

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/nwm/nwm_cec.h" #include "core/hle/service/nwm/nwm_cec.h"
SERIALIZE_EXPORT_IMPL(Service::NWM::NWM_CEC)
namespace Service::NWM { namespace Service::NWM {
NWM_CEC::NWM_CEC() : ServiceFramework("nwm::CEC") { NWM_CEC::NWM_CEC() : ServiceFramework("nwm::CEC") {

View File

@ -14,3 +14,5 @@ public:
}; };
} // namespace Service::NWM } // namespace Service::NWM
BOOST_CLASS_EXPORT_KEY(Service::NWM::NWM_CEC)

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/nwm/nwm_ext.h" #include "core/hle/service/nwm/nwm_ext.h"
SERIALIZE_EXPORT_IMPL(Service::NWM::NWM_EXT)
namespace Service::NWM { namespace Service::NWM {
NWM_EXT::NWM_EXT() : ServiceFramework("nwm::EXT") { NWM_EXT::NWM_EXT() : ServiceFramework("nwm::EXT") {

View File

@ -14,3 +14,5 @@ public:
}; };
} // namespace Service::NWM } // namespace Service::NWM
BOOST_CLASS_EXPORT_KEY(Service::NWM::NWM_EXT)

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/nwm/nwm_inf.h" #include "core/hle/service/nwm/nwm_inf.h"
SERIALIZE_EXPORT_IMPL(Service::NWM::NWM_INF)
namespace Service::NWM { namespace Service::NWM {
NWM_INF::NWM_INF() : ServiceFramework("nwm::INF") { NWM_INF::NWM_INF() : ServiceFramework("nwm::INF") {

View File

@ -14,3 +14,5 @@ public:
}; };
} // namespace Service::NWM } // namespace Service::NWM
BOOST_CLASS_EXPORT_KEY(Service::NWM::NWM_INF)

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/nwm/nwm_sap.h" #include "core/hle/service/nwm/nwm_sap.h"
SERIALIZE_EXPORT_IMPL(Service::NWM::NWM_SAP)
namespace Service::NWM { namespace Service::NWM {
NWM_SAP::NWM_SAP() : ServiceFramework("nwm::SAP") { NWM_SAP::NWM_SAP() : ServiceFramework("nwm::SAP") {

View File

@ -14,3 +14,5 @@ public:
}; };
} // namespace Service::NWM } // namespace Service::NWM
BOOST_CLASS_EXPORT_KEY(Service::NWM::NWM_SAP)

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/nwm/nwm_soc.h" #include "core/hle/service/nwm/nwm_soc.h"
SERIALIZE_EXPORT_IMPL(Service::NWM::NWM_SOC)
namespace Service::NWM { namespace Service::NWM {
NWM_SOC::NWM_SOC() : ServiceFramework("nwm::SOC") { NWM_SOC::NWM_SOC() : ServiceFramework("nwm::SOC") {

View File

@ -14,3 +14,5 @@ public:
}; };
} // namespace Service::NWM } // namespace Service::NWM
BOOST_CLASS_EXPORT_KEY(Service::NWM::NWM_SOC)

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/nwm/nwm_tst.h" #include "core/hle/service/nwm/nwm_tst.h"
SERIALIZE_EXPORT_IMPL(Service::NWM::NWM_TST)
namespace Service::NWM { namespace Service::NWM {
NWM_TST::NWM_TST() : ServiceFramework("nwm::TST") { NWM_TST::NWM_TST() : ServiceFramework("nwm::TST") {

View File

@ -14,3 +14,5 @@ public:
}; };
} // namespace Service::NWM } // namespace Service::NWM
BOOST_CLASS_EXPORT_KEY(Service::NWM::NWM_TST)

View File

@ -4,7 +4,10 @@
#include <algorithm> #include <algorithm>
#include <cstring> #include <cstring>
#include <boost/serialization/list.hpp>
#include <boost/serialization/map.hpp>
#include <cryptopp/osrng.h> #include <cryptopp/osrng.h>
#include "common/archives.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/core.h" #include "core/core.h"
@ -23,6 +26,15 @@
namespace Service::NWM { namespace Service::NWM {
template <class Archive>
void NWM_UDS::serialize(Archive& ar, const unsigned int) {
ar& node_map;
ar& connection_event;
ar& received_beacons;
// TODO: Fix wifi_packet_received?
}
SERIALIZE_IMPL(NWM_UDS)
namespace ErrCodes { namespace ErrCodes {
enum { enum {
NotInitialized = 2, NotInitialized = 2,

View File

@ -521,6 +521,14 @@ private:
struct Node { struct Node {
bool connected; bool connected;
u16 node_id; u16 node_id;
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& connected;
ar& node_id;
}
friend class boost::serialization::access;
}; };
std::map<MacAddress, Node> node_map; std::map<MacAddress, Node> node_map;
@ -543,6 +551,12 @@ private:
// List of the last <MaxBeaconFrames> beacons received from the network. // List of the last <MaxBeaconFrames> beacons received from the network.
std::list<Network::WifiPacket> received_beacons; std::list<Network::WifiPacket> received_beacons;
template <class Archive>
void serialize(Archive& ar, const unsigned int);
}; };
} // namespace Service::NWM } // namespace Service::NWM
SERVICE_CONSTRUCT(Service::NWM::NWM_UDS)
BOOST_CLASS_EXPORT_KEY(Service::NWM::NWM_UDS)

View File

@ -13,4 +13,4 @@ add_library(network STATIC
create_target_directory_groups(network) create_target_directory_groups(network)
target_link_libraries(network PRIVATE common enet) target_link_libraries(network PRIVATE common enet Boost::boost)

View File

@ -8,6 +8,7 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include <vector> #include <vector>
#include <boost/serialization/access.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "network/room.h" #include "network/room.h"
@ -30,6 +31,17 @@ struct WifiPacket {
MacAddress transmitter_address; ///< Mac address of the transmitter. MacAddress transmitter_address; ///< Mac address of the transmitter.
MacAddress destination_address; ///< Mac address of the receiver. MacAddress destination_address; ///< Mac address of the receiver.
u8 channel; ///< WiFi channel where this frame was transmitted. u8 channel; ///< WiFi channel where this frame was transmitted.
private:
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& type;
ar& data;
ar& transmitter_address;
ar& destination_address;
ar& channel;
}
friend class boost::serialization::access;
}; };
/// Represents a chat message. /// Represents a chat message.