diff options
author | Subv <subv2112@gmail.com> | 2018-01-22 23:41:31 +0100 |
---|---|---|
committer | Subv <subv2112@gmail.com> | 2018-01-22 23:41:31 +0100 |
commit | 1003996e80791baf1187b8a122f521d3cf02cc96 (patch) | |
tree | e727790dd3aab5d195084824c5ed15a69f71f651 | |
parent | LM: Don't create an unnecessary port in Initialize. (diff) | |
download | yuzu-1003996e80791baf1187b8a122f521d3cf02cc96.tar yuzu-1003996e80791baf1187b8a122f521d3cf02cc96.tar.gz yuzu-1003996e80791baf1187b8a122f521d3cf02cc96.tar.bz2 yuzu-1003996e80791baf1187b8a122f521d3cf02cc96.tar.lz yuzu-1003996e80791baf1187b8a122f521d3cf02cc96.tar.xz yuzu-1003996e80791baf1187b8a122f521d3cf02cc96.tar.zst yuzu-1003996e80791baf1187b8a122f521d3cf02cc96.zip |
-rw-r--r-- | src/core/hle/service/hid/hid.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index d99e9c505..9b1e680f1 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -162,23 +162,23 @@ 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(); - } + 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)); } }; |