diff options
| author | 2020-11-26 15:19:08 -0500 | |
|---|---|---|
| committer | 2020-11-26 20:03:11 -0500 | |
| commit | 1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f (patch) | |
| tree | 3593cd42e0ba676c3919561983f7e9766fcb641c /src/core/hle/service/ldn | |
| parent | Merge pull request #4975 from comex/invalid-syncpoint-id (diff) | |
| download | yuzu-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.cpp | 29 | ||||
| -rw-r--r-- | src/core/hle/service/ldn/ldn.h | 6 |
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 | ||
| 14 | class IMonitorService final : public ServiceFramework<IMonitorService> { | 14 | class IMonitorService final : public ServiceFramework<IMonitorService> { |
| 15 | public: | 15 | public: |
| 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 | ||
| 34 | class LDNM final : public ServiceFramework<LDNM> { | 34 | class LDNM final : public ServiceFramework<LDNM> { |
| 35 | public: | 35 | public: |
| 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 | ||
| 55 | class ISystemLocalCommunicationService final | 55 | class ISystemLocalCommunicationService final |
| 56 | : public ServiceFramework<ISystemLocalCommunicationService> { | 56 | : public ServiceFramework<ISystemLocalCommunicationService> { |
| 57 | public: | 57 | public: |
| 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: | |||
| 99 | class IUserLocalCommunicationService final | 99 | class IUserLocalCommunicationService final |
| 100 | : public ServiceFramework<IUserLocalCommunicationService> { | 100 | : public ServiceFramework<IUserLocalCommunicationService> { |
| 101 | public: | 101 | public: |
| 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 | ||
| 149 | class LDNS final : public ServiceFramework<LDNS> { | 150 | class LDNS final : public ServiceFramework<LDNS> { |
| 150 | public: | 151 | public: |
| 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 | ||
| 170 | class LDNU final : public ServiceFramework<LDNU> { | 171 | class LDNU final : public ServiceFramework<LDNU> { |
| 171 | public: | 172 | public: |
| 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 | ||
| 191 | void InstallInterfaces(SM::ServiceManager& sm) { | 192 | void 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 | ||
| 7 | namespace Core { | ||
| 8 | class System; | ||
| 9 | } | ||
| 10 | |||
| 7 | namespace Service::SM { | 11 | namespace Service::SM { |
| 8 | class ServiceManager; | 12 | class ServiceManager; |
| 9 | } | 13 | } |
| @@ -11,6 +15,6 @@ class ServiceManager; | |||
| 11 | namespace Service::LDN { | 15 | namespace Service::LDN { |
| 12 | 16 | ||
| 13 | /// Registers all LDN services with the specified service manager. | 17 | /// Registers all LDN services with the specified service manager. |
| 14 | void InstallInterfaces(SM::ServiceManager& sm); | 18 | void InstallInterfaces(SM::ServiceManager& sm, Core::System& system); |
| 15 | 19 | ||
| 16 | } // namespace Service::LDN | 20 | } // namespace Service::LDN |