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/nfc | |
| 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/nfc')
| -rw-r--r-- | src/core/hle/service/nfc/nfc.cpp | 34 | ||||
| -rw-r--r-- | src/core/hle/service/nfc/nfc.h | 6 |
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 | ||
| 17 | class IAm final : public ServiceFramework<IAm> { | 17 | class IAm final : public ServiceFramework<IAm> { |
| 18 | public: | 18 | public: |
| 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 | ||
| 32 | class NFC_AM final : public ServiceFramework<NFC_AM> { | 32 | class NFC_AM final : public ServiceFramework<NFC_AM> { |
| 33 | public: | 33 | public: |
| 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 | ||
| 54 | class MFIUser final : public ServiceFramework<MFIUser> { | 54 | class MFIUser final : public ServiceFramework<MFIUser> { |
| 55 | public: | 55 | public: |
| 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 | ||
| 80 | class NFC_MF_U final : public ServiceFramework<NFC_MF_U> { | 80 | class NFC_MF_U final : public ServiceFramework<NFC_MF_U> { |
| 81 | public: | 81 | public: |
| 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 | ||
| 102 | class IUser final : public ServiceFramework<IUser> { | 102 | class IUser final : public ServiceFramework<IUser> { |
| 103 | public: | 103 | public: |
| 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 | ||
| 172 | class NFC_U final : public ServiceFramework<NFC_U> { | 172 | class NFC_U final : public ServiceFramework<NFC_U> { |
| 173 | public: | 173 | public: |
| 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 | ||
| 194 | class ISystem final : public ServiceFramework<ISystem> { | 194 | class ISystem final : public ServiceFramework<ISystem> { |
| 195 | public: | 195 | public: |
| 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 | ||
| 231 | class NFC_SYS final : public ServiceFramework<NFC_SYS> { | 231 | class NFC_SYS final : public ServiceFramework<NFC_SYS> { |
| 232 | public: | 232 | public: |
| 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 | ||
| 253 | void InstallInterfaces(SM::ServiceManager& sm) { | 253 | void 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 | ||
| 7 | namespace Core { | ||
| 8 | class System; | ||
| 9 | } | ||
| 10 | |||
| 7 | namespace Service::SM { | 11 | namespace Service::SM { |
| 8 | class ServiceManager; | 12 | class ServiceManager; |
| 9 | } | 13 | } |
| 10 | 14 | ||
| 11 | namespace Service::NFC { | 15 | namespace Service::NFC { |
| 12 | 16 | ||
| 13 | void InstallInterfaces(SM::ServiceManager& sm); | 17 | void InstallInterfaces(SM::ServiceManager& sm, Core::System& system); |
| 14 | 18 | ||
| 15 | } // namespace Service::NFC | 19 | } // namespace Service::NFC |