mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 05:40:04 +00:00 
			
		
		
		
	Serialize service manager, server prt
This commit is contained in:
		
							parent
							
								
									4f95575d41
								
							
						
					
					
						commit
						7a5bde0b44
					
				
					 11 changed files with 77 additions and 16 deletions
				
			
		|  | @ -235,7 +235,7 @@ System::ResultStatus System::Init(Frontend::EmuWindow& emu_window, u32 system_mo | |||
| 
 | ||||
|     rpc_server = std::make_unique<RPC::RPCServer>(); | ||||
| 
 | ||||
|     service_manager = std::make_shared<Service::SM::ServiceManager>(*this); | ||||
|     service_manager = std::make_unique<Service::SM::ServiceManager>(*this); | ||||
|     archive_manager = std::make_unique<Service::FS::ArchiveManager>(*this); | ||||
| 
 | ||||
|     HW::Init(*memory); | ||||
|  | @ -399,7 +399,7 @@ template<class Archive> | |||
| void System::serialize(Archive & ar, const unsigned int file_version) | ||||
| { | ||||
|     ar & *cpu_core.get(); | ||||
|     //ar & *service_manager.get();
 | ||||
|     ar & *service_manager.get(); | ||||
|     ar & GPU::g_regs; | ||||
|     ar & LCD::g_regs; | ||||
|     ar & dsp_core->GetDspMemory(); | ||||
|  |  | |||
|  | @ -305,7 +305,7 @@ private: | |||
|     std::unique_ptr<Core::TelemetrySession> telemetry_session; | ||||
| 
 | ||||
|     /// Service manager
 | ||||
|     std::shared_ptr<Service::SM::ServiceManager> service_manager; | ||||
|     std::unique_ptr<Service::SM::ServiceManager> service_manager; | ||||
| 
 | ||||
|     /// Frontend applets
 | ||||
|     std::shared_ptr<Frontend::MiiSelector> registered_mii_selector; | ||||
|  |  | |||
|  | @ -11,12 +11,19 @@ | |||
| #include <string> | ||||
| #include <vector> | ||||
| #include <boost/container/small_vector.hpp> | ||||
| #include <boost/serialization/unique_ptr.hpp> | ||||
| #include <boost/serialization/shared_ptr.hpp> | ||||
| #include <boost/serialization/vector.hpp> | ||||
| #include <boost/serialization/assume_abstract.hpp> | ||||
| #include "common/common_types.h" | ||||
| #include "common/swap.h" | ||||
| #include "core/hle/ipc.h" | ||||
| #include "core/hle/kernel/object.h" | ||||
| #include "core/hle/kernel/server_session.h" | ||||
| 
 | ||||
| BOOST_SERIALIZATION_ASSUME_ABSTRACT(Kernel::SessionRequestHandler) | ||||
| BOOST_SERIALIZATION_ASSUME_ABSTRACT(Kernel::SessionRequestHandler::SessionDataBase) | ||||
| 
 | ||||
| namespace Service { | ||||
| class ServiceFrameworkBase; | ||||
| } | ||||
|  | @ -90,12 +97,31 @@ protected: | |||
| 
 | ||||
|         std::shared_ptr<ServerSession> session; | ||||
|         std::unique_ptr<SessionDataBase> data; | ||||
| 
 | ||||
|     private: | ||||
|         template <class Archive> | ||||
|         void serialize(Archive& ar, const unsigned int file_version) | ||||
|         { | ||||
|             ar & session; | ||||
|             ar & data; | ||||
|         } | ||||
|         friend class boost::serialization::access; | ||||
|     }; | ||||
|     /// List of sessions that are connected to this handler. A ServerSession whose server endpoint
 | ||||
|     /// is an HLE implementation is kept alive by this list for the duration of the connection.
 | ||||
|     std::vector<SessionInfo> connected_sessions; | ||||
| 
 | ||||
| private: | ||||
|     template <class Archive> | ||||
|     void serialize(Archive& ar, const unsigned int file_version) | ||||
|     { | ||||
|         ar & connected_sessions; | ||||
|     } | ||||
|     friend class boost::serialization::access; | ||||
| }; | ||||
| 
 | ||||
| // NOTE: The below classes are ephemeral and don't need serialization
 | ||||
| 
 | ||||
| class MappedBuffer { | ||||
| public: | ||||
|     MappedBuffer(Memory::MemorySystem& memory, const Process& process, u32 descriptor, | ||||
|  |  | |||
|  | @ -6,6 +6,7 @@ | |||
| 
 | ||||
| #include <memory> | ||||
| #include <vector> | ||||
| #include <boost/serialization/unique_ptr.hpp> | ||||
| #include "common/common_types.h" | ||||
| #include "core/hle/ipc.h" | ||||
| #include "core/hle/kernel/thread.h" | ||||
|  | @ -26,6 +27,20 @@ struct MappedBufferContext { | |||
| 
 | ||||
|     std::unique_ptr<u8[]> buffer; | ||||
|     std::unique_ptr<u8[]> reserve_buffer; | ||||
| 
 | ||||
| private: | ||||
|     template <class Archive> | ||||
|     void serialize(Archive& ar, const unsigned int file_version) | ||||
|     { | ||||
|         ar & permissions; | ||||
|         ar & size; | ||||
|         ar & source_address; | ||||
|         ar & target_address; | ||||
|         // TODO: Check whether we need these. If we do, add a field for the size and/or change to a 'vector'
 | ||||
|         //ar & buffer;
 | ||||
|         //ar & reserve_buffer;
 | ||||
|     } | ||||
|     friend class boost::serialization::access; | ||||
| }; | ||||
| 
 | ||||
| /// Performs IPC command buffer translation from one process to another.
 | ||||
|  |  | |||
|  | @ -11,6 +11,7 @@ | |||
| #include "core/hle/kernel/server_port.h" | ||||
| #include "core/hle/kernel/server_session.h" | ||||
| #include "core/hle/kernel/thread.h" | ||||
| #include "core/hle/kernel/hle_ipc.h" | ||||
| 
 | ||||
| SERIALIZE_EXPORT_IMPL(Kernel::ServerPort) | ||||
| 
 | ||||
|  | @ -50,4 +51,14 @@ KernelSystem::PortPair KernelSystem::CreatePortPair(u32 max_sessions, std::strin | |||
|     return std::make_pair(std::move(server_port), std::move(client_port)); | ||||
| } | ||||
| 
 | ||||
| template <class Archive> | ||||
| void ServerPort::serialize(Archive& ar, const unsigned int file_version) | ||||
| { | ||||
|     ar & boost::serialization::base_object<WaitObject>(*this); | ||||
|     ar & name; | ||||
|     ar & pending_sessions; | ||||
|     ar & hle_handler; | ||||
| } | ||||
| SERIALIZE_IMPL(ServerPort) | ||||
| 
 | ||||
| } // namespace Kernel
 | ||||
|  |  | |||
|  | @ -67,13 +67,7 @@ public: | |||
| private: | ||||
|     friend class boost::serialization::access; | ||||
|     template <class Archive> | ||||
|     void serialize(Archive& ar, const unsigned int file_version) | ||||
|     { | ||||
|         ar & boost::serialization::base_object<Object>(*this); | ||||
|         ar & name; | ||||
|         ar & pending_sessions; | ||||
|         //ar & hle_handler;
 | ||||
|     } | ||||
|     void serialize(Archive& ar, const unsigned int file_version); | ||||
| }; | ||||
| 
 | ||||
| } // namespace Kernel
 | ||||
|  |  | |||
|  | @ -115,10 +115,10 @@ private: | |||
|         ar & boost::serialization::base_object<Object>(*this); | ||||
|         ar & name; | ||||
|         ar & parent; | ||||
|         //ar & hle_handler;
 | ||||
|         ar & hle_handler; | ||||
|         ar & pending_requesting_threads; | ||||
|         ar & currently_handling; | ||||
|         //ar & mapped_buffer_context;
 | ||||
|         ar & mapped_buffer_context; | ||||
|     } | ||||
| }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -8,6 +8,7 @@ | |||
| #include "core/hle/kernel/client_session.h" | ||||
| #include "core/hle/kernel/server_session.h" | ||||
| #include "core/hle/kernel/client_port.h" | ||||
| #include "core/hle/kernel/hle_ipc.h" | ||||
| 
 | ||||
| SERIALIZE_IMPL(Kernel::Session) | ||||
| 
 | ||||
|  |  | |||
|  | @ -117,7 +117,7 @@ private: | |||
|         ar & owner_process; | ||||
|         ar & base_address; | ||||
|         ar & name; | ||||
|         ar & *(reinterpret_cast<MemoryRegionInfo::IntervalSet::ImplSetT*>(&holding_memory));; | ||||
|         ar & *(reinterpret_cast<MemoryRegionInfo::IntervalSet::ImplSetT*>(&holding_memory)); | ||||
|     } | ||||
|     friend class boost::serialization::access; | ||||
| }; | ||||
|  |  | |||
|  | @ -8,6 +8,9 @@ | |||
| #include <string> | ||||
| #include <type_traits> | ||||
| #include <unordered_map> | ||||
| #include <boost/serialization/shared_ptr.hpp> | ||||
| #include <boost/serialization/string.hpp> | ||||
| #include <boost/serialization/unordered_map.hpp> | ||||
| #include "core/hle/kernel/client_port.h" | ||||
| #include "core/hle/kernel/object.h" | ||||
| #include "core/hle/kernel/server_port.h" | ||||
|  | @ -80,6 +83,14 @@ private: | |||
|     // For IPC Recorder
 | ||||
|     /// client port Object id -> service name
 | ||||
|     std::unordered_map<u32, std::string> registered_services_inverse; | ||||
| 
 | ||||
|     template <class Archive> | ||||
|     void serialize(Archive& ar, const unsigned int file_version) | ||||
|     { | ||||
|         ar & registered_services; | ||||
|         ar & registered_services_inverse; // TODO: Instead, compute this from registered_services
 | ||||
|     } | ||||
|     friend class boost::serialization::access; | ||||
| }; | ||||
| 
 | ||||
| } // namespace Service::SM
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue