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/nifm | |
| 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/nifm')
| -rw-r--r-- | src/core/hle/service/nifm/nifm.cpp | 25 | ||||
| -rw-r--r-- | src/core/hle/service/nifm/nifm.h | 8 |
2 files changed, 15 insertions, 18 deletions
diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp index db7ec6d0e..ef5176bea 100644 --- a/src/core/hle/service/nifm/nifm.cpp +++ b/src/core/hle/service/nifm/nifm.cpp | |||
| @@ -23,7 +23,7 @@ enum class RequestState : u32 { | |||
| 23 | 23 | ||
| 24 | class IScanRequest final : public ServiceFramework<IScanRequest> { | 24 | class IScanRequest final : public ServiceFramework<IScanRequest> { |
| 25 | public: | 25 | public: |
| 26 | explicit IScanRequest() : ServiceFramework("IScanRequest") { | 26 | explicit IScanRequest(Core::System& system_) : ServiceFramework{system_, "IScanRequest"} { |
| 27 | // clang-format off | 27 | // clang-format off |
| 28 | static const FunctionInfo functions[] = { | 28 | static const FunctionInfo functions[] = { |
| 29 | {0, nullptr, "Submit"}, | 29 | {0, nullptr, "Submit"}, |
| @@ -40,7 +40,7 @@ public: | |||
| 40 | 40 | ||
| 41 | class IRequest final : public ServiceFramework<IRequest> { | 41 | class IRequest final : public ServiceFramework<IRequest> { |
| 42 | public: | 42 | public: |
| 43 | explicit IRequest(Core::System& system) : ServiceFramework("IRequest") { | 43 | explicit IRequest(Core::System& system_) : ServiceFramework{system_, "IRequest"} { |
| 44 | static const FunctionInfo functions[] = { | 44 | static const FunctionInfo functions[] = { |
| 45 | {0, &IRequest::GetRequestState, "GetRequestState"}, | 45 | {0, &IRequest::GetRequestState, "GetRequestState"}, |
| 46 | {1, &IRequest::GetResult, "GetResult"}, | 46 | {1, &IRequest::GetResult, "GetResult"}, |
| @@ -140,7 +140,7 @@ private: | |||
| 140 | 140 | ||
| 141 | class INetworkProfile final : public ServiceFramework<INetworkProfile> { | 141 | class INetworkProfile final : public ServiceFramework<INetworkProfile> { |
| 142 | public: | 142 | public: |
| 143 | explicit INetworkProfile() : ServiceFramework("INetworkProfile") { | 143 | explicit INetworkProfile(Core::System& system_) : ServiceFramework{system_, "INetworkProfile"} { |
| 144 | static const FunctionInfo functions[] = { | 144 | static const FunctionInfo functions[] = { |
| 145 | {0, nullptr, "Update"}, | 145 | {0, nullptr, "Update"}, |
| 146 | {1, nullptr, "PersistOld"}, | 146 | {1, nullptr, "PersistOld"}, |
| @@ -152,7 +152,7 @@ public: | |||
| 152 | 152 | ||
| 153 | class IGeneralService final : public ServiceFramework<IGeneralService> { | 153 | class IGeneralService final : public ServiceFramework<IGeneralService> { |
| 154 | public: | 154 | public: |
| 155 | IGeneralService(Core::System& system); | 155 | explicit IGeneralService(Core::System& system_); |
| 156 | 156 | ||
| 157 | private: | 157 | private: |
| 158 | void GetClientId(Kernel::HLERequestContext& ctx) { | 158 | void GetClientId(Kernel::HLERequestContext& ctx) { |
| @@ -169,7 +169,7 @@ private: | |||
| 169 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 169 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 170 | 170 | ||
| 171 | rb.Push(RESULT_SUCCESS); | 171 | rb.Push(RESULT_SUCCESS); |
| 172 | rb.PushIpcInterface<IScanRequest>(); | 172 | rb.PushIpcInterface<IScanRequest>(system); |
| 173 | } | 173 | } |
| 174 | void CreateRequest(Kernel::HLERequestContext& ctx) { | 174 | void CreateRequest(Kernel::HLERequestContext& ctx) { |
| 175 | LOG_DEBUG(Service_NIFM, "called"); | 175 | LOG_DEBUG(Service_NIFM, "called"); |
| @@ -207,7 +207,7 @@ private: | |||
| 207 | IPC::ResponseBuilder rb{ctx, 6, 0, 1}; | 207 | IPC::ResponseBuilder rb{ctx, 6, 0, 1}; |
| 208 | 208 | ||
| 209 | rb.Push(RESULT_SUCCESS); | 209 | rb.Push(RESULT_SUCCESS); |
| 210 | rb.PushIpcInterface<INetworkProfile>(); | 210 | rb.PushIpcInterface<INetworkProfile>(system); |
| 211 | rb.PushRaw<u128>(uuid); | 211 | rb.PushRaw<u128>(uuid); |
| 212 | } | 212 | } |
| 213 | void IsWirelessCommunicationEnabled(Kernel::HLERequestContext& ctx) { | 213 | void IsWirelessCommunicationEnabled(Kernel::HLERequestContext& ctx) { |
| @@ -239,11 +239,10 @@ private: | |||
| 239 | rb.Push<u8>(1); | 239 | rb.Push<u8>(1); |
| 240 | } | 240 | } |
| 241 | } | 241 | } |
| 242 | Core::System& system; | ||
| 243 | }; | 242 | }; |
| 244 | 243 | ||
| 245 | IGeneralService::IGeneralService(Core::System& system) | 244 | IGeneralService::IGeneralService(Core::System& system_) |
| 246 | : ServiceFramework("IGeneralService"), system(system) { | 245 | : ServiceFramework{system_, "IGeneralService"} { |
| 247 | // clang-format off | 246 | // clang-format off |
| 248 | static const FunctionInfo functions[] = { | 247 | static const FunctionInfo functions[] = { |
| 249 | {1, &IGeneralService::GetClientId, "GetClientId"}, | 248 | {1, &IGeneralService::GetClientId, "GetClientId"}, |
| @@ -296,8 +295,8 @@ IGeneralService::IGeneralService(Core::System& system) | |||
| 296 | 295 | ||
| 297 | class NetworkInterface final : public ServiceFramework<NetworkInterface> { | 296 | class NetworkInterface final : public ServiceFramework<NetworkInterface> { |
| 298 | public: | 297 | public: |
| 299 | explicit NetworkInterface(const char* name, Core::System& system) | 298 | explicit NetworkInterface(const char* name, Core::System& system_) |
| 300 | : ServiceFramework{name}, system(system) { | 299 | : ServiceFramework{system_, name} { |
| 301 | static const FunctionInfo functions[] = { | 300 | static const FunctionInfo functions[] = { |
| 302 | {4, &NetworkInterface::CreateGeneralServiceOld, "CreateGeneralServiceOld"}, | 301 | {4, &NetworkInterface::CreateGeneralServiceOld, "CreateGeneralServiceOld"}, |
| 303 | {5, &NetworkInterface::CreateGeneralService, "CreateGeneralService"}, | 302 | {5, &NetworkInterface::CreateGeneralService, "CreateGeneralService"}, |
| @@ -305,6 +304,7 @@ public: | |||
| 305 | RegisterHandlers(functions); | 304 | RegisterHandlers(functions); |
| 306 | } | 305 | } |
| 307 | 306 | ||
| 307 | private: | ||
| 308 | void CreateGeneralServiceOld(Kernel::HLERequestContext& ctx) { | 308 | void CreateGeneralServiceOld(Kernel::HLERequestContext& ctx) { |
| 309 | LOG_DEBUG(Service_NIFM, "called"); | 309 | LOG_DEBUG(Service_NIFM, "called"); |
| 310 | 310 | ||
| @@ -320,9 +320,6 @@ public: | |||
| 320 | rb.Push(RESULT_SUCCESS); | 320 | rb.Push(RESULT_SUCCESS); |
| 321 | rb.PushIpcInterface<IGeneralService>(system); | 321 | rb.PushIpcInterface<IGeneralService>(system); |
| 322 | } | 322 | } |
| 323 | |||
| 324 | private: | ||
| 325 | Core::System& system; | ||
| 326 | }; | 323 | }; |
| 327 | 324 | ||
| 328 | void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) { | 325 | void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) { |
diff --git a/src/core/hle/service/nifm/nifm.h b/src/core/hle/service/nifm/nifm.h index 6857e18f9..c3dd4f386 100644 --- a/src/core/hle/service/nifm/nifm.h +++ b/src/core/hle/service/nifm/nifm.h | |||
| @@ -4,14 +4,14 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | namespace Service::SM { | ||
| 8 | class ServiceManager; | ||
| 9 | } | ||
| 10 | |||
| 11 | namespace Core { | 7 | namespace Core { |
| 12 | class System; | 8 | class System; |
| 13 | } | 9 | } |
| 14 | 10 | ||
| 11 | namespace Service::SM { | ||
| 12 | class ServiceManager; | ||
| 13 | } | ||
| 14 | |||
| 15 | namespace Service::NIFM { | 15 | namespace Service::NIFM { |
| 16 | 16 | ||
| 17 | /// Registers all NIFM services with the specified service manager. | 17 | /// Registers all NIFM services with the specified service manager. |