mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-30 21:30:04 +00:00 
			
		
		
		
	Serialize NWM service
This commit is contained in:
		
							parent
							
								
									571b1062f0
								
							
						
					
					
						commit
						f5e2f873b0
					
				
					 18 changed files with 82 additions and 8 deletions
				
			
		|  | @ -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/nwm/nwm_cec.h" | ||||
| 
 | ||||
| SERIALIZE_EXPORT_IMPL(Service::NWM::NWM_CEC) | ||||
| 
 | ||||
| namespace Service::NWM { | ||||
| 
 | ||||
| NWM_CEC::NWM_CEC() : ServiceFramework("nwm::CEC") { | ||||
|  |  | |||
|  | @ -14,3 +14,5 @@ public: | |||
| }; | ||||
| 
 | ||||
| } // namespace Service::NWM
 | ||||
| 
 | ||||
| BOOST_CLASS_EXPORT_KEY(Service::NWM::NWM_CEC) | ||||
|  |  | |||
|  | @ -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/nwm/nwm_ext.h" | ||||
| 
 | ||||
| SERIALIZE_EXPORT_IMPL(Service::NWM::NWM_EXT) | ||||
| 
 | ||||
| namespace Service::NWM { | ||||
| 
 | ||||
| NWM_EXT::NWM_EXT() : ServiceFramework("nwm::EXT") { | ||||
|  |  | |||
|  | @ -14,3 +14,5 @@ public: | |||
| }; | ||||
| 
 | ||||
| } // namespace Service::NWM
 | ||||
| 
 | ||||
| BOOST_CLASS_EXPORT_KEY(Service::NWM::NWM_EXT) | ||||
|  |  | |||
|  | @ -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/nwm/nwm_inf.h" | ||||
| 
 | ||||
| SERIALIZE_EXPORT_IMPL(Service::NWM::NWM_INF) | ||||
| 
 | ||||
| namespace Service::NWM { | ||||
| 
 | ||||
| NWM_INF::NWM_INF() : ServiceFramework("nwm::INF") { | ||||
|  |  | |||
|  | @ -14,3 +14,5 @@ public: | |||
| }; | ||||
| 
 | ||||
| } // namespace Service::NWM
 | ||||
| 
 | ||||
| BOOST_CLASS_EXPORT_KEY(Service::NWM::NWM_INF) | ||||
|  |  | |||
|  | @ -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/nwm/nwm_sap.h" | ||||
| 
 | ||||
| SERIALIZE_EXPORT_IMPL(Service::NWM::NWM_SAP) | ||||
| 
 | ||||
| namespace Service::NWM { | ||||
| 
 | ||||
| NWM_SAP::NWM_SAP() : ServiceFramework("nwm::SAP") { | ||||
|  |  | |||
|  | @ -14,3 +14,5 @@ public: | |||
| }; | ||||
| 
 | ||||
| } // namespace Service::NWM
 | ||||
| 
 | ||||
| BOOST_CLASS_EXPORT_KEY(Service::NWM::NWM_SAP) | ||||
|  |  | |||
|  | @ -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/nwm/nwm_soc.h" | ||||
| 
 | ||||
| SERIALIZE_EXPORT_IMPL(Service::NWM::NWM_SOC) | ||||
| 
 | ||||
| namespace Service::NWM { | ||||
| 
 | ||||
| NWM_SOC::NWM_SOC() : ServiceFramework("nwm::SOC") { | ||||
|  |  | |||
|  | @ -14,3 +14,5 @@ public: | |||
| }; | ||||
| 
 | ||||
| } // namespace Service::NWM
 | ||||
| 
 | ||||
| BOOST_CLASS_EXPORT_KEY(Service::NWM::NWM_SOC) | ||||
|  |  | |||
|  | @ -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/nwm/nwm_tst.h" | ||||
| 
 | ||||
| SERIALIZE_EXPORT_IMPL(Service::NWM::NWM_TST) | ||||
| 
 | ||||
| namespace Service::NWM { | ||||
| 
 | ||||
| NWM_TST::NWM_TST() : ServiceFramework("nwm::TST") { | ||||
|  |  | |||
|  | @ -14,3 +14,5 @@ public: | |||
| }; | ||||
| 
 | ||||
| } // namespace Service::NWM
 | ||||
| 
 | ||||
| BOOST_CLASS_EXPORT_KEY(Service::NWM::NWM_TST) | ||||
|  |  | |||
|  | @ -4,7 +4,10 @@ | |||
| 
 | ||||
| #include <algorithm> | ||||
| #include <cstring> | ||||
| #include <boost/serialization/list.hpp> | ||||
| #include <boost/serialization/map.hpp> | ||||
| #include <cryptopp/osrng.h> | ||||
| #include "common/archives.h" | ||||
| #include "common/common_types.h" | ||||
| #include "common/logging/log.h" | ||||
| #include "core/core.h" | ||||
|  | @ -23,6 +26,15 @@ | |||
| 
 | ||||
| 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 { | ||||
| enum { | ||||
|     NotInitialized = 2, | ||||
|  |  | |||
|  | @ -521,6 +521,14 @@ private: | |||
|     struct Node { | ||||
|         bool connected; | ||||
|         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; | ||||
|  | @ -543,6 +551,12 @@ private: | |||
| 
 | ||||
|     // List of the last <MaxBeaconFrames> beacons received from the network.
 | ||||
|     std::list<Network::WifiPacket> received_beacons; | ||||
| 
 | ||||
|     template <class Archive> | ||||
|     void serialize(Archive& ar, const unsigned int); | ||||
| }; | ||||
| 
 | ||||
| } // namespace Service::NWM
 | ||||
| 
 | ||||
| SERVICE_CONSTRUCT(Service::NWM::NWM_UDS) | ||||
| BOOST_CLASS_EXPORT_KEY(Service::NWM::NWM_UDS) | ||||
|  |  | |||
|  | @ -13,4 +13,4 @@ add_library(network STATIC | |||
| 
 | ||||
| create_target_directory_groups(network) | ||||
| 
 | ||||
| target_link_libraries(network PRIVATE common enet) | ||||
| target_link_libraries(network PRIVATE common enet Boost::boost) | ||||
|  |  | |||
|  | @ -8,6 +8,7 @@ | |||
| #include <memory> | ||||
| #include <string> | ||||
| #include <vector> | ||||
| #include <boost/serialization/access.hpp> | ||||
| #include "common/common_types.h" | ||||
| #include "network/room.h" | ||||
| 
 | ||||
|  | @ -30,6 +31,17 @@ struct WifiPacket { | |||
|     MacAddress transmitter_address; ///< Mac address of the transmitter.
 | ||||
|     MacAddress destination_address; ///< Mac address of the receiver.
 | ||||
|     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.
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue