summaryrefslogtreecommitdiff
path: root/src/core/hle/service/nim
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/nim
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/nim')
-rw-r--r--src/core/hle/service/nim/nim.cpp34
-rw-r--r--src/core/hle/service/nim/nim.h8
2 files changed, 22 insertions, 20 deletions
diff --git a/src/core/hle/service/nim/nim.cpp b/src/core/hle/service/nim/nim.cpp
index 11aa74828..d33b26129 100644
--- a/src/core/hle/service/nim/nim.cpp
+++ b/src/core/hle/service/nim/nim.cpp
@@ -17,7 +17,8 @@ namespace Service::NIM {
17 17
18class IShopServiceAsync final : public ServiceFramework<IShopServiceAsync> { 18class IShopServiceAsync final : public ServiceFramework<IShopServiceAsync> {
19public: 19public:
20 IShopServiceAsync() : ServiceFramework("IShopServiceAsync") { 20 explicit IShopServiceAsync(Core::System& system_)
21 : ServiceFramework{system_, "IShopServiceAsync"} {
21 // clang-format off 22 // clang-format off
22 static const FunctionInfo functions[] = { 23 static const FunctionInfo functions[] = {
23 {0, nullptr, "Cancel"}, 24 {0, nullptr, "Cancel"},
@@ -35,7 +36,8 @@ public:
35 36
36class IShopServiceAccessor final : public ServiceFramework<IShopServiceAccessor> { 37class IShopServiceAccessor final : public ServiceFramework<IShopServiceAccessor> {
37public: 38public:
38 IShopServiceAccessor() : ServiceFramework("IShopServiceAccessor") { 39 explicit IShopServiceAccessor(Core::System& system_)
40 : ServiceFramework{system_, "IShopServiceAccessor"} {
39 // clang-format off 41 // clang-format off
40 static const FunctionInfo functions[] = { 42 static const FunctionInfo functions[] = {
41 {0, &IShopServiceAccessor::CreateAsyncInterface, "CreateAsyncInterface"}, 43 {0, &IShopServiceAccessor::CreateAsyncInterface, "CreateAsyncInterface"},
@@ -50,13 +52,14 @@ private:
50 LOG_WARNING(Service_NIM, "(STUBBED) called"); 52 LOG_WARNING(Service_NIM, "(STUBBED) called");
51 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 53 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
52 rb.Push(RESULT_SUCCESS); 54 rb.Push(RESULT_SUCCESS);
53 rb.PushIpcInterface<IShopServiceAsync>(); 55 rb.PushIpcInterface<IShopServiceAsync>(system);
54 } 56 }
55}; 57};
56 58
57class IShopServiceAccessServer final : public ServiceFramework<IShopServiceAccessServer> { 59class IShopServiceAccessServer final : public ServiceFramework<IShopServiceAccessServer> {
58public: 60public:
59 IShopServiceAccessServer() : ServiceFramework("IShopServiceAccessServer") { 61 explicit IShopServiceAccessServer(Core::System& system_)
62 : ServiceFramework{system_, "IShopServiceAccessServer"} {
60 // clang-format off 63 // clang-format off
61 static const FunctionInfo functions[] = { 64 static const FunctionInfo functions[] = {
62 {0, &IShopServiceAccessServer::CreateAccessorInterface, "CreateAccessorInterface"}, 65 {0, &IShopServiceAccessServer::CreateAccessorInterface, "CreateAccessorInterface"},
@@ -71,13 +74,13 @@ private:
71 LOG_WARNING(Service_NIM, "(STUBBED) called"); 74 LOG_WARNING(Service_NIM, "(STUBBED) called");
72 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 75 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
73 rb.Push(RESULT_SUCCESS); 76 rb.Push(RESULT_SUCCESS);
74 rb.PushIpcInterface<IShopServiceAccessor>(); 77 rb.PushIpcInterface<IShopServiceAccessor>(system);
75 } 78 }
76}; 79};
77 80
78class NIM final : public ServiceFramework<NIM> { 81class NIM final : public ServiceFramework<NIM> {
79public: 82public:
80 explicit NIM() : ServiceFramework{"nim"} { 83 explicit NIM(Core::System& system_) : ServiceFramework{system_, "nim"} {
81 // clang-format off 84 // clang-format off
82 static const FunctionInfo functions[] = { 85 static const FunctionInfo functions[] = {
83 {0, nullptr, "CreateSystemUpdateTask"}, 86 {0, nullptr, "CreateSystemUpdateTask"},
@@ -207,7 +210,7 @@ public:
207 210
208class NIM_ECA final : public ServiceFramework<NIM_ECA> { 211class NIM_ECA final : public ServiceFramework<NIM_ECA> {
209public: 212public:
210 explicit NIM_ECA() : ServiceFramework{"nim:eca"} { 213 explicit NIM_ECA(Core::System& system_) : ServiceFramework{system_, "nim:eca"} {
211 // clang-format off 214 // clang-format off
212 static const FunctionInfo functions[] = { 215 static const FunctionInfo functions[] = {
213 {0, &NIM_ECA::CreateServerInterface, "CreateServerInterface"}, 216 {0, &NIM_ECA::CreateServerInterface, "CreateServerInterface"},
@@ -226,13 +229,13 @@ private:
226 LOG_WARNING(Service_NIM, "(STUBBED) called"); 229 LOG_WARNING(Service_NIM, "(STUBBED) called");
227 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 230 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
228 rb.Push(RESULT_SUCCESS); 231 rb.Push(RESULT_SUCCESS);
229 rb.PushIpcInterface<IShopServiceAccessServer>(); 232 rb.PushIpcInterface<IShopServiceAccessServer>(system);
230 } 233 }
231}; 234};
232 235
233class NIM_SHP final : public ServiceFramework<NIM_SHP> { 236class NIM_SHP final : public ServiceFramework<NIM_SHP> {
234public: 237public:
235 explicit NIM_SHP() : ServiceFramework{"nim:shp"} { 238 explicit NIM_SHP(Core::System& system_) : ServiceFramework{system_, "nim:shp"} {
236 // clang-format off 239 // clang-format off
237 static const FunctionInfo functions[] = { 240 static const FunctionInfo functions[] = {
238 {0, nullptr, "RequestDeviceAuthenticationToken"}, 241 {0, nullptr, "RequestDeviceAuthenticationToken"},
@@ -272,8 +275,8 @@ public:
272class IEnsureNetworkClockAvailabilityService final 275class IEnsureNetworkClockAvailabilityService final
273 : public ServiceFramework<IEnsureNetworkClockAvailabilityService> { 276 : public ServiceFramework<IEnsureNetworkClockAvailabilityService> {
274public: 277public:
275 explicit IEnsureNetworkClockAvailabilityService(Core::System& system) 278 explicit IEnsureNetworkClockAvailabilityService(Core::System& system_)
276 : ServiceFramework("IEnsureNetworkClockAvailabilityService") { 279 : ServiceFramework{system_, "IEnsureNetworkClockAvailabilityService"} {
277 static const FunctionInfo functions[] = { 280 static const FunctionInfo functions[] = {
278 {0, &IEnsureNetworkClockAvailabilityService::StartTask, "StartTask"}, 281 {0, &IEnsureNetworkClockAvailabilityService::StartTask, "StartTask"},
279 {1, &IEnsureNetworkClockAvailabilityService::GetFinishNotificationEvent, 282 {1, &IEnsureNetworkClockAvailabilityService::GetFinishNotificationEvent,
@@ -345,7 +348,7 @@ private:
345 348
346class NTC final : public ServiceFramework<NTC> { 349class NTC final : public ServiceFramework<NTC> {
347public: 350public:
348 explicit NTC(Core::System& system) : ServiceFramework{"ntc"}, system(system) { 351 explicit NTC(Core::System& system_) : ServiceFramework{system_, "ntc"} {
349 // clang-format off 352 // clang-format off
350 static const FunctionInfo functions[] = { 353 static const FunctionInfo functions[] = {
351 {0, &NTC::OpenEnsureNetworkClockAvailabilityService, "OpenEnsureNetworkClockAvailabilityService"}, 354 {0, &NTC::OpenEnsureNetworkClockAvailabilityService, "OpenEnsureNetworkClockAvailabilityService"},
@@ -380,13 +383,12 @@ private:
380 IPC::ResponseBuilder rb{ctx, 2}; 383 IPC::ResponseBuilder rb{ctx, 2};
381 rb.Push(RESULT_SUCCESS); 384 rb.Push(RESULT_SUCCESS);
382 } 385 }
383 Core::System& system;
384}; 386};
385 387
386void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) { 388void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
387 std::make_shared<NIM>()->InstallAsService(sm); 389 std::make_shared<NIM>(system)->InstallAsService(sm);
388 std::make_shared<NIM_ECA>()->InstallAsService(sm); 390 std::make_shared<NIM_ECA>(system)->InstallAsService(sm);
389 std::make_shared<NIM_SHP>()->InstallAsService(sm); 391 std::make_shared<NIM_SHP>(system)->InstallAsService(sm);
390 std::make_shared<NTC>(system)->InstallAsService(sm); 392 std::make_shared<NTC>(system)->InstallAsService(sm);
391} 393}
392 394
diff --git a/src/core/hle/service/nim/nim.h b/src/core/hle/service/nim/nim.h
index dbe25dc01..571153fe6 100644
--- a/src/core/hle/service/nim/nim.h
+++ b/src/core/hle/service/nim/nim.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::NIM { 15namespace Service::NIM {
16 16
17void InstallInterfaces(SM::ServiceManager& sm, Core::System& system); 17void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);