|
|
@ -162,23 +162,23 @@ public:
|
|
|
|
~Hid() = default;
|
|
|
|
~Hid() = default;
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
private:
|
|
|
|
Kernel::SharedPtr<Kernel::ClientPort> client_port;
|
|
|
|
std::shared_ptr<IAppletResource> applet_resource;
|
|
|
|
|
|
|
|
|
|
|
|
void CreateAppletResource(Kernel::HLERequestContext& ctx) {
|
|
|
|
void CreateAppletResource(Kernel::HLERequestContext& ctx) {
|
|
|
|
if (client_port == nullptr) {
|
|
|
|
if (applet_resource == nullptr) {
|
|
|
|
client_port = std::make_shared<IAppletResource>()->CreatePort();
|
|
|
|
applet_resource = std::make_shared<IAppletResource>();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
auto session = client_port->Connect();
|
|
|
|
auto sessions = Kernel::ServerSession::CreateSessionPair(applet_resource->GetServiceName());
|
|
|
|
if (session.Succeeded()) {
|
|
|
|
auto server = std::get<Kernel::SharedPtr<Kernel::ServerSession>>(sessions);
|
|
|
|
LOG_DEBUG(Service, "called, initialized IAppletResource -> session=%u",
|
|
|
|
auto client = std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions);
|
|
|
|
(*session)->GetObjectId());
|
|
|
|
applet_resource->ClientConnected(server);
|
|
|
|
IPC::RequestBuilder rb{ctx, 2, 0, 1};
|
|
|
|
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
LOG_DEBUG(Service, "called, initialized IAppletResource -> session=%u",
|
|
|
|
rb.PushMoveObjects(std::move(session).Unwrap());
|
|
|
|
client->GetObjectId());
|
|
|
|
} else {
|
|
|
|
IPC::RequestBuilder rb{ctx, 2, 0, 1};
|
|
|
|
UNIMPLEMENTED();
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
}
|
|
|
|
rb.PushMoveObjects(std::move(client));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|