summaryrefslogtreecommitdiff
path: root/src/core/hle/service/ldn
diff options
context:
space:
mode:
authorGravatar Lioncash2020-11-26 15:19:08 -0500
committerGravatar Lioncash2020-11-26 20:03:11 -0500
commit1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f (patch)
tree3593cd42e0ba676c3919561983f7e9766fcb641c /src/core/hle/service/ldn
parentMerge pull request #4975 from comex/invalid-syncpoint-id (diff)
downloadyuzu-1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f.tar.gz
yuzu-1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f.tar.xz
yuzu-1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f.zip
service: Eliminate usages of the global system instance
Completely removes all usages of the global system instance within the services code by passing in the using system instance to the services.
Diffstat (limited to 'src/core/hle/service/ldn')
-rw-r--r--src/core/hle/service/ldn/ldn.cpp29
-rw-r--r--src/core/hle/service/ldn/ldn.h6
2 files changed, 20 insertions, 15 deletions
diff --git a/src/core/hle/service/ldn/ldn.cpp b/src/core/hle/service/ldn/ldn.cpp
index 49972cd69..ee908f399 100644
--- a/src/core/hle/service/ldn/ldn.cpp
+++ b/src/core/hle/service/ldn/ldn.cpp
@@ -13,7 +13,7 @@ namespace Service::LDN {
13 13
14class IMonitorService final : public ServiceFramework<IMonitorService> { 14class IMonitorService final : public ServiceFramework<IMonitorService> {
15public: 15public:
16 explicit IMonitorService() : ServiceFramework{"IMonitorService"} { 16 explicit IMonitorService(Core::System& system_) : ServiceFramework{system_, "IMonitorService"} {
17 // clang-format off 17 // clang-format off
18 static const FunctionInfo functions[] = { 18 static const FunctionInfo functions[] = {
19 {0, nullptr, "GetStateForMonitor"}, 19 {0, nullptr, "GetStateForMonitor"},
@@ -33,7 +33,7 @@ public:
33 33
34class LDNM final : public ServiceFramework<LDNM> { 34class LDNM final : public ServiceFramework<LDNM> {
35public: 35public:
36 explicit LDNM() : ServiceFramework{"ldn:m"} { 36 explicit LDNM(Core::System& system_) : ServiceFramework{system_, "ldn:m"} {
37 // clang-format off 37 // clang-format off
38 static const FunctionInfo functions[] = { 38 static const FunctionInfo functions[] = {
39 {0, &LDNM::CreateMonitorService, "CreateMonitorService"} 39 {0, &LDNM::CreateMonitorService, "CreateMonitorService"}
@@ -48,15 +48,15 @@ public:
48 48
49 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 49 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
50 rb.Push(RESULT_SUCCESS); 50 rb.Push(RESULT_SUCCESS);
51 rb.PushIpcInterface<IMonitorService>(); 51 rb.PushIpcInterface<IMonitorService>(system);
52 } 52 }
53}; 53};
54 54
55class ISystemLocalCommunicationService final 55class ISystemLocalCommunicationService final
56 : public ServiceFramework<ISystemLocalCommunicationService> { 56 : public ServiceFramework<ISystemLocalCommunicationService> {
57public: 57public:
58 explicit ISystemLocalCommunicationService() 58 explicit ISystemLocalCommunicationService(Core::System& system_)
59 : ServiceFramework{"ISystemLocalCommunicationService"} { 59 : ServiceFramework{system_, "ISystemLocalCommunicationService"} {
60 // clang-format off 60 // clang-format off
61 static const FunctionInfo functions[] = { 61 static const FunctionInfo functions[] = {
62 {0, nullptr, "GetState"}, 62 {0, nullptr, "GetState"},
@@ -99,7 +99,8 @@ public:
99class IUserLocalCommunicationService final 99class IUserLocalCommunicationService final
100 : public ServiceFramework<IUserLocalCommunicationService> { 100 : public ServiceFramework<IUserLocalCommunicationService> {
101public: 101public:
102 explicit IUserLocalCommunicationService() : ServiceFramework{"IUserLocalCommunicationService"} { 102 explicit IUserLocalCommunicationService(Core::System& system_)
103 : ServiceFramework{system_, "IUserLocalCommunicationService"} {
103 // clang-format off 104 // clang-format off
104 static const FunctionInfo functions[] = { 105 static const FunctionInfo functions[] = {
105 {0, nullptr, "GetState"}, 106 {0, nullptr, "GetState"},
@@ -148,7 +149,7 @@ public:
148 149
149class LDNS final : public ServiceFramework<LDNS> { 150class LDNS final : public ServiceFramework<LDNS> {
150public: 151public:
151 explicit LDNS() : ServiceFramework{"ldn:s"} { 152 explicit LDNS(Core::System& system_) : ServiceFramework{system_, "ldn:s"} {
152 // clang-format off 153 // clang-format off
153 static const FunctionInfo functions[] = { 154 static const FunctionInfo functions[] = {
154 {0, &LDNS::CreateSystemLocalCommunicationService, "CreateSystemLocalCommunicationService"}, 155 {0, &LDNS::CreateSystemLocalCommunicationService, "CreateSystemLocalCommunicationService"},
@@ -163,13 +164,13 @@ public:
163 164
164 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 165 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
165 rb.Push(RESULT_SUCCESS); 166 rb.Push(RESULT_SUCCESS);
166 rb.PushIpcInterface<ISystemLocalCommunicationService>(); 167 rb.PushIpcInterface<ISystemLocalCommunicationService>(system);
167 } 168 }
168}; 169};
169 170
170class LDNU final : public ServiceFramework<LDNU> { 171class LDNU final : public ServiceFramework<LDNU> {
171public: 172public:
172 explicit LDNU() : ServiceFramework{"ldn:u"} { 173 explicit LDNU(Core::System& system_) : ServiceFramework{system_, "ldn:u"} {
173 // clang-format off 174 // clang-format off
174 static const FunctionInfo functions[] = { 175 static const FunctionInfo functions[] = {
175 {0, &LDNU::CreateUserLocalCommunicationService, "CreateUserLocalCommunicationService"}, 176 {0, &LDNU::CreateUserLocalCommunicationService, "CreateUserLocalCommunicationService"},
@@ -184,14 +185,14 @@ public:
184 185
185 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 186 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
186 rb.Push(RESULT_SUCCESS); 187 rb.Push(RESULT_SUCCESS);
187 rb.PushIpcInterface<IUserLocalCommunicationService>(); 188 rb.PushIpcInterface<IUserLocalCommunicationService>(system);
188 } 189 }
189}; 190};
190 191
191void InstallInterfaces(SM::ServiceManager& sm) { 192void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
192 std::make_shared<LDNM>()->InstallAsService(sm); 193 std::make_shared<LDNM>(system)->InstallAsService(sm);
193 std::make_shared<LDNS>()->InstallAsService(sm); 194 std::make_shared<LDNS>(system)->InstallAsService(sm);
194 std::make_shared<LDNU>()->InstallAsService(sm); 195 std::make_shared<LDNU>(system)->InstallAsService(sm);
195} 196}
196 197
197} // namespace Service::LDN 198} // namespace Service::LDN
diff --git a/src/core/hle/service/ldn/ldn.h b/src/core/hle/service/ldn/ldn.h
index 6b2a3c2b2..3ccd9738b 100644
--- a/src/core/hle/service/ldn/ldn.h
+++ b/src/core/hle/service/ldn/ldn.h
@@ -4,6 +4,10 @@
4 4
5#pragma once 5#pragma once
6 6
7namespace Core {
8class System;
9}
10
7namespace Service::SM { 11namespace Service::SM {
8class ServiceManager; 12class ServiceManager;
9} 13}
@@ -11,6 +15,6 @@ class ServiceManager;
11namespace Service::LDN { 15namespace Service::LDN {
12 16
13/// Registers all LDN services with the specified service manager. 17/// Registers all LDN services with the specified service manager.
14void InstallInterfaces(SM::ServiceManager& sm); 18void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
15 19
16} // namespace Service::LDN 20} // namespace Service::LDN