From 009b15b3aa9858930f461d825f7dd030fc963801 Mon Sep 17 00:00:00 2001 From: Subv Date: Wed, 30 Nov 2016 22:50:13 -0500 Subject: A bit of a redesign. Sessions and Ports are now detached from each other. HLE services are handled by means of a SessionRequestHandler class, Interface now inherits from this class. The File and Directory classes are no longer kernel objects, but SessionRequestHandlers instead, bound to a ServerSession when requested. File::OpenLinkFile now creates a new session pair and binds the File instance to it. --- src/core/hle/svc.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/core/hle/svc.cpp') diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index be03e53bc..6d990b5f2 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp @@ -21,6 +21,7 @@ #include "core/hle/kernel/resource_limit.h" #include "core/hle/kernel/semaphore.h" #include "core/hle/kernel/server_port.h" +#include "core/hle/kernel/server_session.h" #include "core/hle/kernel/shared_memory.h" #include "core/hle/kernel/thread.h" #include "core/hle/kernel/timer.h" @@ -223,13 +224,18 @@ static ResultCode ConnectToPort(Handle* out_handle, const char* port_name) { return ERR_NOT_FOUND; } - auto client_port = it->second; + auto client_port = std::get>(it->second); + // The hle_handler will be nullptr if this port was registered by the emulated + // application by means of svcCreatePort with a defined name. + auto hle_handler = std::get>(it->second); // Create a new session pair - auto sessions = Kernel::ServerSession::CreateSessionPair(client_port, port_name); + auto sessions = Kernel::ServerSession::CreateSessionPair(port_name, hle_handler); auto client_session = std::get>(sessions); auto server_session = std::get>(sessions); + // TODO(Subv): Wait the current thread until the ServerPort calls AcceptSession. + // Add the server session to the port's queue client_port->AddWaitingSession(server_session); @@ -247,6 +253,7 @@ static ResultCode SendSyncRequest(Handle handle) { LOG_TRACE(Kernel_SVC, "called handle=0x%08X(%s)", handle, session->GetName().c_str()); + // TODO(Subv): Wait the current thread and reschedule if this request is not going to be handled by HLE code. return session->HandleSyncRequest(); } -- cgit v1.2.3