summaryrefslogtreecommitdiff
path: root/src/core/hle/service/sm
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/service/sm')
-rw-r--r--src/core/hle/service/sm/controller.cpp2
-rw-r--r--src/core/hle/service/sm/controller.h6
-rw-r--r--src/core/hle/service/sm/sm.cpp14
-rw-r--r--src/core/hle/service/sm/sm.h8
4 files changed, 19 insertions, 11 deletions
diff --git a/src/core/hle/service/sm/controller.cpp b/src/core/hle/service/sm/controller.cpp
index 972aaa6d9..916177efd 100644
--- a/src/core/hle/service/sm/controller.cpp
+++ b/src/core/hle/service/sm/controller.cpp
@@ -48,7 +48,7 @@ void Controller::QueryPointerBufferSize(Kernel::HLERequestContext& ctx) {
48} 48}
49 49
50// https://switchbrew.org/wiki/IPC_Marshalling 50// https://switchbrew.org/wiki/IPC_Marshalling
51Controller::Controller() : ServiceFramework("IpcController") { 51Controller::Controller(Core::System& system_) : ServiceFramework{system_, "IpcController"} {
52 static const FunctionInfo functions[] = { 52 static const FunctionInfo functions[] = {
53 {0, &Controller::ConvertCurrentObjectToDomain, "ConvertCurrentObjectToDomain"}, 53 {0, &Controller::ConvertCurrentObjectToDomain, "ConvertCurrentObjectToDomain"},
54 {1, nullptr, "CopyFromCurrentDomain"}, 54 {1, nullptr, "CopyFromCurrentDomain"},
diff --git a/src/core/hle/service/sm/controller.h b/src/core/hle/service/sm/controller.h
index 180c6da50..7494f898d 100644
--- a/src/core/hle/service/sm/controller.h
+++ b/src/core/hle/service/sm/controller.h
@@ -6,11 +6,15 @@
6 6
7#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace Service::SM { 13namespace Service::SM {
10 14
11class Controller final : public ServiceFramework<Controller> { 15class Controller final : public ServiceFramework<Controller> {
12public: 16public:
13 Controller(); 17 explicit Controller(Core::System& system_);
14 ~Controller() override; 18 ~Controller() override;
15 19
16private: 20private:
diff --git a/src/core/hle/service/sm/sm.cpp b/src/core/hle/service/sm/sm.cpp
index 9c1da361b..4da69f503 100644
--- a/src/core/hle/service/sm/sm.cpp
+++ b/src/core/hle/service/sm/sm.cpp
@@ -38,14 +38,13 @@ static ResultCode ValidateServiceName(const std::string& name) {
38 return RESULT_SUCCESS; 38 return RESULT_SUCCESS;
39} 39}
40 40
41void ServiceManager::InstallInterfaces(std::shared_ptr<ServiceManager> self, 41void ServiceManager::InstallInterfaces(std::shared_ptr<ServiceManager> self, Core::System& system) {
42 Kernel::KernelCore& kernel) {
43 ASSERT(self->sm_interface.expired()); 42 ASSERT(self->sm_interface.expired());
44 43
45 auto sm = std::make_shared<SM>(self, kernel); 44 auto sm = std::make_shared<SM>(self, system);
46 sm->InstallAsNamedPort(kernel); 45 sm->InstallAsNamedPort(system.Kernel());
47 self->sm_interface = sm; 46 self->sm_interface = sm;
48 self->controller_interface = std::make_unique<Controller>(); 47 self->controller_interface = std::make_unique<Controller>(system);
49} 48}
50 49
51ResultVal<std::shared_ptr<Kernel::ServerPort>> ServiceManager::RegisterService(std::string name, 50ResultVal<std::shared_ptr<Kernel::ServerPort>> ServiceManager::RegisterService(std::string name,
@@ -190,8 +189,9 @@ void SM::UnregisterService(Kernel::HLERequestContext& ctx) {
190 rb.Push(service_manager->UnregisterService(name)); 189 rb.Push(service_manager->UnregisterService(name));
191} 190}
192 191
193SM::SM(std::shared_ptr<ServiceManager> service_manager, Kernel::KernelCore& kernel) 192SM::SM(std::shared_ptr<ServiceManager> service_manager_, Core::System& system_)
194 : ServiceFramework{"sm:", 4}, service_manager{std::move(service_manager)}, kernel{kernel} { 193 : ServiceFramework{system_, "sm:", 4},
194 service_manager{std::move(service_manager_)}, kernel{system_.Kernel()} {
195 static const FunctionInfo functions[] = { 195 static const FunctionInfo functions[] = {
196 {0x00000000, &SM::Initialize, "Initialize"}, 196 {0x00000000, &SM::Initialize, "Initialize"},
197 {0x00000001, &SM::GetService, "GetService"}, 197 {0x00000001, &SM::GetService, "GetService"},
diff --git a/src/core/hle/service/sm/sm.h b/src/core/hle/service/sm/sm.h
index 6790c86f0..3f46ae44f 100644
--- a/src/core/hle/service/sm/sm.h
+++ b/src/core/hle/service/sm/sm.h
@@ -16,6 +16,10 @@
16#include "core/hle/result.h" 16#include "core/hle/result.h"
17#include "core/hle/service/service.h" 17#include "core/hle/service/service.h"
18 18
19namespace Core {
20class System;
21}
22
19namespace Kernel { 23namespace Kernel {
20class ClientPort; 24class ClientPort;
21class ClientSession; 25class ClientSession;
@@ -31,7 +35,7 @@ class Controller;
31/// Interface to "sm:" service 35/// Interface to "sm:" service
32class SM final : public ServiceFramework<SM> { 36class SM final : public ServiceFramework<SM> {
33public: 37public:
34 explicit SM(std::shared_ptr<ServiceManager> service_manager, Kernel::KernelCore& kernel); 38 explicit SM(std::shared_ptr<ServiceManager> service_manager_, Core::System& system_);
35 ~SM() override; 39 ~SM() override;
36 40
37private: 41private:
@@ -46,7 +50,7 @@ private:
46 50
47class ServiceManager { 51class ServiceManager {
48public: 52public:
49 static void InstallInterfaces(std::shared_ptr<ServiceManager> self, Kernel::KernelCore& kernel); 53 static void InstallInterfaces(std::shared_ptr<ServiceManager> self, Core::System& system);
50 54
51 explicit ServiceManager(Kernel::KernelCore& kernel_); 55 explicit ServiceManager(Kernel::KernelCore& kernel_);
52 ~ServiceManager(); 56 ~ServiceManager();