diff options
Diffstat (limited to 'src/core/hle/service')
-rw-r--r-- | src/core/hle/service/hid/hid.cpp | 29 | ||||
-rw-r--r-- | src/core/hle/service/lm/lm.cpp | 25 | ||||
-rw-r--r-- | src/core/hle/service/lm/lm.h | 3 | ||||
-rw-r--r-- | src/core/hle/service/time/time.cpp | 66 |
4 files changed, 62 insertions, 61 deletions
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index d99e9c505..ae60cc7b4 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -162,23 +162,26 @@ public: ~Hid() = default; private: - Kernel::SharedPtr<Kernel::ClientPort> client_port; + std::shared_ptr<IAppletResource> applet_resource; void CreateAppletResource(Kernel::HLERequestContext& ctx) { - if (client_port == nullptr) { - client_port = std::make_shared<IAppletResource>()->CreatePort(); + if (applet_resource == nullptr) { + applet_resource = std::make_shared<IAppletResource>(); } - auto session = client_port->Connect(); - if (session.Succeeded()) { - LOG_DEBUG(Service, "called, initialized IAppletResource -> session=%u", - (*session)->GetObjectId()); - IPC::RequestBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); - rb.PushMoveObjects(std::move(session).Unwrap()); - } else { - UNIMPLEMENTED(); - } + // TODO(Subv): Verify if this should return the interface as a domain object when called + // from within a domain. + + auto sessions = Kernel::ServerSession::CreateSessionPair(applet_resource->GetServiceName()); + auto server = std::get<Kernel::SharedPtr<Kernel::ServerSession>>(sessions); + auto client = std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions); + applet_resource->ClientConnected(server); + + LOG_DEBUG(Service, "called, initialized IAppletResource -> session=%u", + client->GetObjectId()); + IPC::RequestBuilder rb{ctx, 2, 0, 1}; + rb.Push(RESULT_SUCCESS); + rb.PushMoveObjects(std::move(client)); } }; diff --git a/src/core/hle/service/lm/lm.cpp b/src/core/hle/service/lm/lm.cpp index 13c9ee3d3..b505cdcaf 100644 --- a/src/core/hle/service/lm/lm.cpp +++ b/src/core/hle/service/lm/lm.cpp @@ -146,18 +146,19 @@ void InstallInterfaces(SM::ServiceManager& service_manager) { * 0: ResultCode */ void LM::Initialize(Kernel::HLERequestContext& ctx) { - auto client_port = std::make_shared<Logger>()->CreatePort(); - auto session = client_port->Connect(); - if (session.Succeeded()) { - LOG_DEBUG(Service_SM, "called, initialized logger -> session=%u", - (*session)->GetObjectId()); - IPC::RequestBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); - rb.PushMoveObjects(std::move(session).Unwrap()); - registered_loggers.emplace_back(std::move(client_port)); - } else { - UNIMPLEMENTED(); - } + // TODO(Subv): Verify if this should return the interface as a domain object when called from + // within a domain. + + auto logger = std::make_shared<Logger>(); + auto sessions = Kernel::ServerSession::CreateSessionPair(logger->GetServiceName()); + auto server = std::get<Kernel::SharedPtr<Kernel::ServerSession>>(sessions); + auto client = std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions); + logger->ClientConnected(server); + + LOG_DEBUG(Service_SM, "called, initialized logger -> session=%u", client->GetObjectId()); + IPC::RequestBuilder rb{ctx, 2, 0, 1}; + rb.Push(RESULT_SUCCESS); + rb.PushMoveObjects(std::move(client)); LOG_INFO(Service_SM, "called"); } diff --git a/src/core/hle/service/lm/lm.h b/src/core/hle/service/lm/lm.h index 4b954bdb2..371135057 100644 --- a/src/core/hle/service/lm/lm.h +++ b/src/core/hle/service/lm/lm.h @@ -5,7 +5,6 @@ #pragma once #include <vector> -#include "core/hle/kernel/client_port.h" #include "core/hle/kernel/kernel.h" #include "core/hle/service/service.h" @@ -19,8 +18,6 @@ public: private: void Initialize(Kernel::HLERequestContext& ctx); - - std::vector<Kernel::SharedPtr<Kernel::ClientPort>> registered_loggers; }; /// Registers all LM services with the specified service manager. diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp index 9fed89246..8abb2ce7a 100644 --- a/src/core/hle/service/time/time.cpp +++ b/src/core/hle/service/time/time.cpp @@ -83,45 +83,45 @@ private: }; void Module::Interface::GetStandardUserSystemClock(Kernel::HLERequestContext& ctx) { - auto client_port = std::make_shared<ISystemClock>()->CreatePort(); - auto session = client_port->Connect(); - if (session.Succeeded()) { - LOG_DEBUG(Service, "called, initialized ISystemClock -> session=%u", - (*session)->GetObjectId()); - IPC::RequestBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); - rb.PushMoveObjects(std::move(session).Unwrap()); - } else { - UNIMPLEMENTED(); - } + // TODO(Subv): Verify if this should return the interface as a domain object when called from + // within a domain. + auto system_clock = std::make_shared<ISystemClock>(); + auto sessions = Kernel::ServerSession::CreateSessionPair(system_clock->GetServiceName()); + auto server = std::get<Kernel::SharedPtr<Kernel::ServerSession>>(sessions); + auto client = std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions); + system_clock->ClientConnected(server); + LOG_DEBUG(Service, "called, initialized ISystemClock -> session=%u", client->GetObjectId()); + IPC::RequestBuilder rb{ctx, 2, 0, 1}; + rb.Push(RESULT_SUCCESS); + rb.PushMoveObjects(std::move(client)); } void Module::Interface::GetStandardNetworkSystemClock(Kernel::HLERequestContext& ctx) { - auto client_port = std::make_shared<ISystemClock>()->CreatePort(); - auto session = client_port->Connect(); - if (session.Succeeded()) { - LOG_DEBUG(Service, "called, initialized ISystemClock -> session=%u", - (*session)->GetObjectId()); - IPC::RequestBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); - rb.PushMoveObjects(std::move(session).Unwrap()); - } else { - UNIMPLEMENTED(); - } + // TODO(Subv): Verify if this should return the interface as a domain object when called from + // within a domain. + auto system_clock = std::make_shared<ISystemClock>(); + auto sessions = Kernel::ServerSession::CreateSessionPair(system_clock->GetServiceName()); + auto server = std::get<Kernel::SharedPtr<Kernel::ServerSession>>(sessions); + auto client = std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions); + system_clock->ClientConnected(server); + LOG_DEBUG(Service, "called, initialized ISystemClock -> session=%u", client->GetObjectId()); + IPC::RequestBuilder rb{ctx, 2, 0, 1}; + rb.Push(RESULT_SUCCESS); + rb.PushMoveObjects(std::move(client)); } void Module::Interface::GetStandardSteadyClock(Kernel::HLERequestContext& ctx) { - auto client_port = std::make_shared<ISteadyClock>()->CreatePort(); - auto session = client_port->Connect(); - if (session.Succeeded()) { - LOG_DEBUG(Service, "called, initialized ISteadyClock -> session=%u", - (*session)->GetObjectId()); - IPC::RequestBuilder rb{ctx, 2, 0, 1}; - rb.Push(RESULT_SUCCESS); - rb.PushMoveObjects(std::move(session).Unwrap()); - } else { - UNIMPLEMENTED(); - } + // TODO(Subv): Verify if this should return the interface as a domain object when called from + // within a domain. + auto steady_clock = std::make_shared<ISteadyClock>(); + auto sessions = Kernel::ServerSession::CreateSessionPair(steady_clock->GetServiceName()); + auto server = std::get<Kernel::SharedPtr<Kernel::ServerSession>>(sessions); + auto client = std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions); + steady_clock->ClientConnected(server); + LOG_DEBUG(Service, "called, initialized ISteadyClock -> session=%u", client->GetObjectId()); + IPC::RequestBuilder rb{ctx, 2, 0, 1}; + rb.Push(RESULT_SUCCESS); + rb.PushMoveObjects(std::move(client)); } void Module::Interface::GetTimeZoneService(Kernel::HLERequestContext& ctx) { |