mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-11-03 23:28:48 +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
				
			
		| 
						 | 
				
			
			@ -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;
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue