summaryrefslogtreecommitdiff
path: root/src/core/hle/service/nifm
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/nifm
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/nifm')
-rw-r--r--src/core/hle/service/nifm/nifm.cpp25
-rw-r--r--src/core/hle/service/nifm/nifm.h8
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
24class IScanRequest final : public ServiceFramework<IScanRequest> { 24class IScanRequest final : public ServiceFramework<IScanRequest> {
25public: 25public:
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
41class IRequest final : public ServiceFramework<IRequest> { 41class IRequest final : public ServiceFramework<IRequest> {
42public: 42public:
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
141class INetworkProfile final : public ServiceFramework<INetworkProfile> { 141class INetworkProfile final : public ServiceFramework<INetworkProfile> {
142public: 142public:
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
153class IGeneralService final : public ServiceFramework<IGeneralService> { 153class IGeneralService final : public ServiceFramework<IGeneralService> {
154public: 154public:
155 IGeneralService(Core::System& system); 155 explicit IGeneralService(Core::System& system_);
156 156
157private: 157private:
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
245IGeneralService::IGeneralService(Core::System& system) 244IGeneralService::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
297class NetworkInterface final : public ServiceFramework<NetworkInterface> { 296class NetworkInterface final : public ServiceFramework<NetworkInterface> {
298public: 297public:
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
307private:
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
324private:
325 Core::System& system;
326}; 323};
327 324
328void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) { 325void 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
7namespace Service::SM {
8class ServiceManager;
9}
10
11namespace Core { 7namespace Core {
12class System; 8class System;
13} 9}
14 10
11namespace Service::SM {
12class ServiceManager;
13}
14
15namespace Service::NIFM { 15namespace Service::NIFM {
16 16
17/// Registers all NIFM services with the specified service manager. 17/// Registers all NIFM services with the specified service manager.