2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Merge pull request #4636 from lioncash/kernel-hle

service: Remove two usages of the global system accessor
This commit is contained in:
bunnei 2020-09-14 09:17:10 -07:00 committed by GitHub
commit 042567e4b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 7 deletions

View file

@ -105,10 +105,9 @@ void ServiceFrameworkBase::InstallAsService(SM::ServiceManager& service_manager)
port_installed = true; port_installed = true;
} }
void ServiceFrameworkBase::InstallAsNamedPort() { void ServiceFrameworkBase::InstallAsNamedPort(Kernel::KernelCore& kernel) {
ASSERT(!port_installed); ASSERT(!port_installed);
auto& kernel = Core::System::GetInstance().Kernel();
auto [server_port, client_port] = auto [server_port, client_port] =
Kernel::ServerPort::CreatePortPair(kernel, max_sessions, service_name); Kernel::ServerPort::CreatePortPair(kernel, max_sessions, service_name);
server_port->SetHleHandler(shared_from_this()); server_port->SetHleHandler(shared_from_this());
@ -116,10 +115,9 @@ void ServiceFrameworkBase::InstallAsNamedPort() {
port_installed = true; port_installed = true;
} }
std::shared_ptr<Kernel::ClientPort> ServiceFrameworkBase::CreatePort() { std::shared_ptr<Kernel::ClientPort> ServiceFrameworkBase::CreatePort(Kernel::KernelCore& kernel) {
ASSERT(!port_installed); ASSERT(!port_installed);
auto& kernel = Core::System::GetInstance().Kernel();
auto [server_port, client_port] = auto [server_port, client_port] =
Kernel::ServerPort::CreatePortPair(kernel, max_sessions, service_name); Kernel::ServerPort::CreatePortPair(kernel, max_sessions, service_name);
auto port = MakeResult(std::move(server_port)).Unwrap(); auto port = MakeResult(std::move(server_port)).Unwrap();

View file

@ -63,9 +63,9 @@ public:
/// Creates a port pair and registers this service with the given ServiceManager. /// Creates a port pair and registers this service with the given ServiceManager.
void InstallAsService(SM::ServiceManager& service_manager); void InstallAsService(SM::ServiceManager& service_manager);
/// Creates a port pair and registers it on the kernel's global port registry. /// Creates a port pair and registers it on the kernel's global port registry.
void InstallAsNamedPort(); void InstallAsNamedPort(Kernel::KernelCore& kernel);
/// Creates and returns an unregistered port for the service. /// Creates and returns an unregistered port for the service.
std::shared_ptr<Kernel::ClientPort> CreatePort(); std::shared_ptr<Kernel::ClientPort> CreatePort(Kernel::KernelCore& kernel);
void InvokeRequest(Kernel::HLERequestContext& ctx); void InvokeRequest(Kernel::HLERequestContext& ctx);

View file

@ -43,7 +43,7 @@ void ServiceManager::InstallInterfaces(std::shared_ptr<ServiceManager> self,
ASSERT(self->sm_interface.expired()); ASSERT(self->sm_interface.expired());
auto sm = std::make_shared<SM>(self, kernel); auto sm = std::make_shared<SM>(self, kernel);
sm->InstallAsNamedPort(); sm->InstallAsNamedPort(kernel);
self->sm_interface = sm; self->sm_interface = sm;
self->controller_interface = std::make_unique<Controller>(); self->controller_interface = std::make_unique<Controller>();
} }