summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-01-23 03:37:15 +0100
committerGitHub <noreply@github.com>2018-01-23 03:37:15 +0100
commitd1b64cdc070c02b63398803136c04d4fe8bd0df0 (patch)
treee41a908d37931f4a0de99f5fbe13cbb1f8a6f32c
parentMerge pull request #133 from Subv/nvflinger2 (diff)
parentServices: Added a todo about returning interfaces as domain objects in lm, hid and time. (diff)
downloadyuzu-d1b64cdc070c02b63398803136c04d4fe8bd0df0.tar
yuzu-d1b64cdc070c02b63398803136c04d4fe8bd0df0.tar.gz
yuzu-d1b64cdc070c02b63398803136c04d4fe8bd0df0.tar.bz2
yuzu-d1b64cdc070c02b63398803136c04d4fe8bd0df0.tar.lz
yuzu-d1b64cdc070c02b63398803136c04d4fe8bd0df0.tar.xz
yuzu-d1b64cdc070c02b63398803136c04d4fe8bd0df0.tar.zst
yuzu-d1b64cdc070c02b63398803136c04d4fe8bd0df0.zip
-rw-r--r--src/core/hle/ipc_helpers.h9
-rw-r--r--src/core/hle/service/hid/hid.cpp29
-rw-r--r--src/core/hle/service/lm/lm.cpp25
-rw-r--r--src/core/hle/service/lm/lm.h3
-rw-r--r--src/core/hle/service/time/time.cpp66
5 files changed, 67 insertions, 65 deletions
diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h
index a27cfbc2d..ab479b49b 100644
--- a/src/core/hle/ipc_helpers.h
+++ b/src/core/hle/ipc_helpers.h
@@ -118,10 +118,11 @@ public:
if (context->IsDomain()) {
context->AddDomainObject(std::move(iface));
} else {
- auto port = iface->CreatePort();
- auto session = port->Connect();
- ASSERT(session.Succeeded());
- context->AddMoveObject(std::move(session).Unwrap());
+ auto sessions = Kernel::ServerSession::CreateSessionPair(iface->GetServiceName());
+ auto server = std::get<Kernel::SharedPtr<Kernel::ServerSession>>(sessions);
+ auto client = std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions);
+ iface->ClientConnected(server);
+ context->AddMoveObject(std::move(client));
}
}
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) {