summaryrefslogtreecommitdiff
path: root/src/core/hle/service/nfc
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/nfc
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/nfc')
-rw-r--r--src/core/hle/service/nfc/nfc.cpp34
-rw-r--r--src/core/hle/service/nfc/nfc.h6
2 files changed, 22 insertions, 18 deletions
diff --git a/src/core/hle/service/nfc/nfc.cpp b/src/core/hle/service/nfc/nfc.cpp
index 780ea30fe..6ab35de47 100644
--- a/src/core/hle/service/nfc/nfc.cpp
+++ b/src/core/hle/service/nfc/nfc.cpp
@@ -16,7 +16,7 @@ namespace Service::NFC {
16 16
17class IAm final : public ServiceFramework<IAm> { 17class IAm final : public ServiceFramework<IAm> {
18public: 18public:
19 explicit IAm() : ServiceFramework{"NFC::IAm"} { 19 explicit IAm(Core::System& system_) : ServiceFramework{system_, "NFC::IAm"} {
20 // clang-format off 20 // clang-format off
21 static const FunctionInfo functions[] = { 21 static const FunctionInfo functions[] = {
22 {0, nullptr, "Initialize"}, 22 {0, nullptr, "Initialize"},
@@ -31,7 +31,7 @@ public:
31 31
32class NFC_AM final : public ServiceFramework<NFC_AM> { 32class NFC_AM final : public ServiceFramework<NFC_AM> {
33public: 33public:
34 explicit NFC_AM() : ServiceFramework{"nfc:am"} { 34 explicit NFC_AM(Core::System& system_) : ServiceFramework{system_, "nfc:am"} {
35 // clang-format off 35 // clang-format off
36 static const FunctionInfo functions[] = { 36 static const FunctionInfo functions[] = {
37 {0, &NFC_AM::CreateAmInterface, "CreateAmInterface"}, 37 {0, &NFC_AM::CreateAmInterface, "CreateAmInterface"},
@@ -47,13 +47,13 @@ private:
47 47
48 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 48 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
49 rb.Push(RESULT_SUCCESS); 49 rb.Push(RESULT_SUCCESS);
50 rb.PushIpcInterface<IAm>(); 50 rb.PushIpcInterface<IAm>(system);
51 } 51 }
52}; 52};
53 53
54class MFIUser final : public ServiceFramework<MFIUser> { 54class MFIUser final : public ServiceFramework<MFIUser> {
55public: 55public:
56 explicit MFIUser() : ServiceFramework{"NFC::MFIUser"} { 56 explicit MFIUser(Core::System& system_) : ServiceFramework{system_, "NFC::MFIUser"} {
57 // clang-format off 57 // clang-format off
58 static const FunctionInfo functions[] = { 58 static const FunctionInfo functions[] = {
59 {0, nullptr, "Initialize"}, 59 {0, nullptr, "Initialize"},
@@ -79,7 +79,7 @@ public:
79 79
80class NFC_MF_U final : public ServiceFramework<NFC_MF_U> { 80class NFC_MF_U final : public ServiceFramework<NFC_MF_U> {
81public: 81public:
82 explicit NFC_MF_U() : ServiceFramework{"nfc:mf:u"} { 82 explicit NFC_MF_U(Core::System& system_) : ServiceFramework{system_, "nfc:mf:u"} {
83 // clang-format off 83 // clang-format off
84 static const FunctionInfo functions[] = { 84 static const FunctionInfo functions[] = {
85 {0, &NFC_MF_U::CreateUserInterface, "CreateUserInterface"}, 85 {0, &NFC_MF_U::CreateUserInterface, "CreateUserInterface"},
@@ -95,13 +95,13 @@ private:
95 95
96 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 96 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
97 rb.Push(RESULT_SUCCESS); 97 rb.Push(RESULT_SUCCESS);
98 rb.PushIpcInterface<MFIUser>(); 98 rb.PushIpcInterface<MFIUser>(system);
99 } 99 }
100}; 100};
101 101
102class IUser final : public ServiceFramework<IUser> { 102class IUser final : public ServiceFramework<IUser> {
103public: 103public:
104 explicit IUser() : ServiceFramework{"NFC::IUser"} { 104 explicit IUser(Core::System& system_) : ServiceFramework{system_, "NFC::IUser"} {
105 // clang-format off 105 // clang-format off
106 static const FunctionInfo functions[] = { 106 static const FunctionInfo functions[] = {
107 {0, &IUser::InitializeOld, "InitializeOld"}, 107 {0, &IUser::InitializeOld, "InitializeOld"},
@@ -171,7 +171,7 @@ private:
171 171
172class NFC_U final : public ServiceFramework<NFC_U> { 172class NFC_U final : public ServiceFramework<NFC_U> {
173public: 173public:
174 explicit NFC_U() : ServiceFramework{"nfc:user"} { 174 explicit NFC_U(Core::System& system_) : ServiceFramework{system_, "nfc:user"} {
175 // clang-format off 175 // clang-format off
176 static const FunctionInfo functions[] = { 176 static const FunctionInfo functions[] = {
177 {0, &NFC_U::CreateUserInterface, "CreateUserInterface"}, 177 {0, &NFC_U::CreateUserInterface, "CreateUserInterface"},
@@ -187,13 +187,13 @@ private:
187 187
188 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 188 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
189 rb.Push(RESULT_SUCCESS); 189 rb.Push(RESULT_SUCCESS);
190 rb.PushIpcInterface<IUser>(); 190 rb.PushIpcInterface<IUser>(system);
191 } 191 }
192}; 192};
193 193
194class ISystem final : public ServiceFramework<ISystem> { 194class ISystem final : public ServiceFramework<ISystem> {
195public: 195public:
196 explicit ISystem() : ServiceFramework{"ISystem"} { 196 explicit ISystem(Core::System& system_) : ServiceFramework{system_, "ISystem"} {
197 // clang-format off 197 // clang-format off
198 static const FunctionInfo functions[] = { 198 static const FunctionInfo functions[] = {
199 {0, nullptr, "Initialize"}, 199 {0, nullptr, "Initialize"},
@@ -230,7 +230,7 @@ public:
230 230
231class NFC_SYS final : public ServiceFramework<NFC_SYS> { 231class NFC_SYS final : public ServiceFramework<NFC_SYS> {
232public: 232public:
233 explicit NFC_SYS() : ServiceFramework{"nfc:sys"} { 233 explicit NFC_SYS(Core::System& system_) : ServiceFramework{system_, "nfc:sys"} {
234 // clang-format off 234 // clang-format off
235 static const FunctionInfo functions[] = { 235 static const FunctionInfo functions[] = {
236 {0, &NFC_SYS::CreateSystemInterface, "CreateSystemInterface"}, 236 {0, &NFC_SYS::CreateSystemInterface, "CreateSystemInterface"},
@@ -246,15 +246,15 @@ private:
246 246
247 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 247 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
248 rb.Push(RESULT_SUCCESS); 248 rb.Push(RESULT_SUCCESS);
249 rb.PushIpcInterface<ISystem>(); 249 rb.PushIpcInterface<ISystem>(system);
250 } 250 }
251}; 251};
252 252
253void InstallInterfaces(SM::ServiceManager& sm) { 253void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
254 std::make_shared<NFC_AM>()->InstallAsService(sm); 254 std::make_shared<NFC_AM>(system)->InstallAsService(sm);
255 std::make_shared<NFC_MF_U>()->InstallAsService(sm); 255 std::make_shared<NFC_MF_U>(system)->InstallAsService(sm);
256 std::make_shared<NFC_U>()->InstallAsService(sm); 256 std::make_shared<NFC_U>(system)->InstallAsService(sm);
257 std::make_shared<NFC_SYS>()->InstallAsService(sm); 257 std::make_shared<NFC_SYS>(system)->InstallAsService(sm);
258} 258}
259 259
260} // namespace Service::NFC 260} // namespace Service::NFC
diff --git a/src/core/hle/service/nfc/nfc.h b/src/core/hle/service/nfc/nfc.h
index 4d2d815f9..5a94b076d 100644
--- a/src/core/hle/service/nfc/nfc.h
+++ b/src/core/hle/service/nfc/nfc.h
@@ -4,12 +4,16 @@
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}
10 14
11namespace Service::NFC { 15namespace Service::NFC {
12 16
13void InstallInterfaces(SM::ServiceManager& sm); 17void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
14 18
15} // namespace Service::NFC 19} // namespace Service::NFC