summaryrefslogtreecommitdiff
path: root/src/core/hle/service/acc
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/acc
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/acc')
-rw-r--r--src/core/hle/service/acc/acc.cpp88
-rw-r--r--src/core/hle/service/acc/acc.h5
2 files changed, 50 insertions, 43 deletions
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp
index c2c11dbcb..6981f8ee7 100644
--- a/src/core/hle/service/acc/acc.cpp
+++ b/src/core/hle/service/acc/acc.cpp
@@ -47,8 +47,8 @@ static constexpr u32 SanitizeJPEGSize(std::size_t size) {
47 47
48class IManagerForSystemService final : public ServiceFramework<IManagerForSystemService> { 48class IManagerForSystemService final : public ServiceFramework<IManagerForSystemService> {
49public: 49public:
50 explicit IManagerForSystemService(Common::UUID user_id) 50 explicit IManagerForSystemService(Core::System& system_, Common::UUID)
51 : ServiceFramework("IManagerForSystemService") { 51 : ServiceFramework{system_, "IManagerForSystemService"} {
52 // clang-format off 52 // clang-format off
53 static const FunctionInfo functions[] = { 53 static const FunctionInfo functions[] = {
54 {0, nullptr, "CheckAvailability"}, 54 {0, nullptr, "CheckAvailability"},
@@ -83,8 +83,8 @@ public:
83// 3.0.0+ 83// 3.0.0+
84class IFloatingRegistrationRequest final : public ServiceFramework<IFloatingRegistrationRequest> { 84class IFloatingRegistrationRequest final : public ServiceFramework<IFloatingRegistrationRequest> {
85public: 85public:
86 explicit IFloatingRegistrationRequest(Common::UUID user_id) 86 explicit IFloatingRegistrationRequest(Core::System& system_, Common::UUID)
87 : ServiceFramework("IFloatingRegistrationRequest") { 87 : ServiceFramework{system_, "IFloatingRegistrationRequest"} {
88 // clang-format off 88 // clang-format off
89 static const FunctionInfo functions[] = { 89 static const FunctionInfo functions[] = {
90 {0, nullptr, "GetSessionId"}, 90 {0, nullptr, "GetSessionId"},
@@ -108,7 +108,8 @@ public:
108 108
109class IAdministrator final : public ServiceFramework<IAdministrator> { 109class IAdministrator final : public ServiceFramework<IAdministrator> {
110public: 110public:
111 explicit IAdministrator(Common::UUID user_id) : ServiceFramework("IAdministrator") { 111 explicit IAdministrator(Core::System& system_, Common::UUID)
112 : ServiceFramework{system_, "IAdministrator"} {
112 // clang-format off 113 // clang-format off
113 static const FunctionInfo functions[] = { 114 static const FunctionInfo functions[] = {
114 {0, nullptr, "CheckAvailability"}, 115 {0, nullptr, "CheckAvailability"},
@@ -165,8 +166,8 @@ public:
165 166
166class IAuthorizationRequest final : public ServiceFramework<IAuthorizationRequest> { 167class IAuthorizationRequest final : public ServiceFramework<IAuthorizationRequest> {
167public: 168public:
168 explicit IAuthorizationRequest(Common::UUID user_id) 169 explicit IAuthorizationRequest(Core::System& system_, Common::UUID)
169 : ServiceFramework("IAuthorizationRequest") { 170 : ServiceFramework{system_, "IAuthorizationRequest"} {
170 // clang-format off 171 // clang-format off
171 static const FunctionInfo functions[] = { 172 static const FunctionInfo functions[] = {
172 {0, nullptr, "GetSessionId"}, 173 {0, nullptr, "GetSessionId"},
@@ -184,7 +185,8 @@ public:
184 185
185class IOAuthProcedure final : public ServiceFramework<IOAuthProcedure> { 186class IOAuthProcedure final : public ServiceFramework<IOAuthProcedure> {
186public: 187public:
187 explicit IOAuthProcedure(Common::UUID user_id) : ServiceFramework("IOAuthProcedure") { 188 explicit IOAuthProcedure(Core::System& system_, Common::UUID)
189 : ServiceFramework{system_, "IOAuthProcedure"} {
188 // clang-format off 190 // clang-format off
189 static const FunctionInfo functions[] = { 191 static const FunctionInfo functions[] = {
190 {0, nullptr, "PrepareAsync"}, 192 {0, nullptr, "PrepareAsync"},
@@ -202,8 +204,8 @@ public:
202// 3.0.0+ 204// 3.0.0+
203class IOAuthProcedureForExternalNsa final : public ServiceFramework<IOAuthProcedureForExternalNsa> { 205class IOAuthProcedureForExternalNsa final : public ServiceFramework<IOAuthProcedureForExternalNsa> {
204public: 206public:
205 explicit IOAuthProcedureForExternalNsa(Common::UUID user_id) 207 explicit IOAuthProcedureForExternalNsa(Core::System& system_, Common::UUID)
206 : ServiceFramework("IOAuthProcedureForExternalNsa") { 208 : ServiceFramework{system_, "IOAuthProcedureForExternalNsa"} {
207 // clang-format off 209 // clang-format off
208 static const FunctionInfo functions[] = { 210 static const FunctionInfo functions[] = {
209 {0, nullptr, "PrepareAsync"}, 211 {0, nullptr, "PrepareAsync"},
@@ -225,8 +227,8 @@ public:
225class IOAuthProcedureForNintendoAccountLinkage final 227class IOAuthProcedureForNintendoAccountLinkage final
226 : public ServiceFramework<IOAuthProcedureForNintendoAccountLinkage> { 228 : public ServiceFramework<IOAuthProcedureForNintendoAccountLinkage> {
227public: 229public:
228 explicit IOAuthProcedureForNintendoAccountLinkage(Common::UUID user_id) 230 explicit IOAuthProcedureForNintendoAccountLinkage(Core::System& system_, Common::UUID)
229 : ServiceFramework("IOAuthProcedureForNintendoAccountLinkage") { 231 : ServiceFramework{system_, "IOAuthProcedureForNintendoAccountLinkage"} {
230 // clang-format off 232 // clang-format off
231 static const FunctionInfo functions[] = { 233 static const FunctionInfo functions[] = {
232 {0, nullptr, "PrepareAsync"}, 234 {0, nullptr, "PrepareAsync"},
@@ -246,7 +248,8 @@ public:
246 248
247class INotifier final : public ServiceFramework<INotifier> { 249class INotifier final : public ServiceFramework<INotifier> {
248public: 250public:
249 explicit INotifier(Common::UUID user_id) : ServiceFramework("INotifier") { 251 explicit INotifier(Core::System& system_, Common::UUID)
252 : ServiceFramework{system_, "INotifier"} {
250 // clang-format off 253 // clang-format off
251 static const FunctionInfo functions[] = { 254 static const FunctionInfo functions[] = {
252 {0, nullptr, "GetSystemEvent"}, 255 {0, nullptr, "GetSystemEvent"},
@@ -259,9 +262,9 @@ public:
259 262
260class IProfileCommon : public ServiceFramework<IProfileCommon> { 263class IProfileCommon : public ServiceFramework<IProfileCommon> {
261public: 264public:
262 explicit IProfileCommon(const char* name, bool editor_commands, Common::UUID user_id, 265 explicit IProfileCommon(Core::System& system_, const char* name, bool editor_commands,
263 ProfileManager& profile_manager) 266 Common::UUID user_id_, ProfileManager& profile_manager_)
264 : ServiceFramework(name), profile_manager(profile_manager), user_id(user_id) { 267 : ServiceFramework{system_, name}, profile_manager{profile_manager_}, user_id{user_id_} {
265 static const FunctionInfo functions[] = { 268 static const FunctionInfo functions[] = {
266 {0, &IProfileCommon::Get, "Get"}, 269 {0, &IProfileCommon::Get, "Get"},
267 {1, &IProfileCommon::GetBase, "GetBase"}, 270 {1, &IProfileCommon::GetBase, "GetBase"},
@@ -427,19 +430,21 @@ protected:
427 430
428class IProfile final : public IProfileCommon { 431class IProfile final : public IProfileCommon {
429public: 432public:
430 IProfile(Common::UUID user_id, ProfileManager& profile_manager) 433 explicit IProfile(Core::System& system_, Common::UUID user_id_,
431 : IProfileCommon("IProfile", false, user_id, profile_manager) {} 434 ProfileManager& profile_manager_)
435 : IProfileCommon{system_, "IProfile", false, user_id_, profile_manager_} {}
432}; 436};
433 437
434class IProfileEditor final : public IProfileCommon { 438class IProfileEditor final : public IProfileCommon {
435public: 439public:
436 IProfileEditor(Common::UUID user_id, ProfileManager& profile_manager) 440 explicit IProfileEditor(Core::System& system_, Common::UUID user_id_,
437 : IProfileCommon("IProfileEditor", true, user_id, profile_manager) {} 441 ProfileManager& profile_manager_)
442 : IProfileCommon{system_, "IProfileEditor", true, user_id_, profile_manager_} {}
438}; 443};
439 444
440class IAsyncContext final : public ServiceFramework<IAsyncContext> { 445class IAsyncContext final : public ServiceFramework<IAsyncContext> {
441public: 446public:
442 explicit IAsyncContext(Common::UUID user_id) : ServiceFramework("IAsyncContext") { 447 explicit IAsyncContext(Core::System& system_) : ServiceFramework{system_, "IAsyncContext"} {
443 // clang-format off 448 // clang-format off
444 static const FunctionInfo functions[] = { 449 static const FunctionInfo functions[] = {
445 {0, nullptr, "GetSystemEvent"}, 450 {0, nullptr, "GetSystemEvent"},
@@ -455,7 +460,8 @@ public:
455 460
456class ISessionObject final : public ServiceFramework<ISessionObject> { 461class ISessionObject final : public ServiceFramework<ISessionObject> {
457public: 462public:
458 explicit ISessionObject(Common::UUID user_id) : ServiceFramework("ISessionObject") { 463 explicit ISessionObject(Core::System& system_, Common::UUID)
464 : ServiceFramework{system_, "ISessionObject"} {
459 // clang-format off 465 // clang-format off
460 static const FunctionInfo functions[] = { 466 static const FunctionInfo functions[] = {
461 {999, nullptr, "Dummy"}, 467 {999, nullptr, "Dummy"},
@@ -468,7 +474,8 @@ public:
468 474
469class IGuestLoginRequest final : public ServiceFramework<IGuestLoginRequest> { 475class IGuestLoginRequest final : public ServiceFramework<IGuestLoginRequest> {
470public: 476public:
471 explicit IGuestLoginRequest(Common::UUID) : ServiceFramework("IGuestLoginRequest") { 477 explicit IGuestLoginRequest(Core::System& system_, Common::UUID)
478 : ServiceFramework{system_, "IGuestLoginRequest"} {
472 // clang-format off 479 // clang-format off
473 static const FunctionInfo functions[] = { 480 static const FunctionInfo functions[] = {
474 {0, nullptr, "GetSessionId"}, 481 {0, nullptr, "GetSessionId"},
@@ -487,8 +494,8 @@ public:
487 494
488class IManagerForApplication final : public ServiceFramework<IManagerForApplication> { 495class IManagerForApplication final : public ServiceFramework<IManagerForApplication> {
489public: 496public:
490 explicit IManagerForApplication(Common::UUID user_id) 497 explicit IManagerForApplication(Core::System& system_, Common::UUID user_id_)
491 : ServiceFramework("IManagerForApplication"), user_id(user_id) { 498 : ServiceFramework{system_, "IManagerForApplication"}, user_id{user_id_} {
492 // clang-format off 499 // clang-format off
493 static const FunctionInfo functions[] = { 500 static const FunctionInfo functions[] = {
494 {0, &IManagerForApplication::CheckAvailability, "CheckAvailability"}, 501 {0, &IManagerForApplication::CheckAvailability, "CheckAvailability"},
@@ -534,8 +541,8 @@ private:
534class IAsyncNetworkServiceLicenseKindContext final 541class IAsyncNetworkServiceLicenseKindContext final
535 : public ServiceFramework<IAsyncNetworkServiceLicenseKindContext> { 542 : public ServiceFramework<IAsyncNetworkServiceLicenseKindContext> {
536public: 543public:
537 explicit IAsyncNetworkServiceLicenseKindContext(Common::UUID user_id) 544 explicit IAsyncNetworkServiceLicenseKindContext(Core::System& system_, Common::UUID)
538 : ServiceFramework("IAsyncNetworkServiceLicenseKindContext") { 545 : ServiceFramework{system_, "IAsyncNetworkServiceLicenseKindContext"} {
539 // clang-format off 546 // clang-format off
540 static const FunctionInfo functions[] = { 547 static const FunctionInfo functions[] = {
541 {0, nullptr, "GetSystemEvent"}, 548 {0, nullptr, "GetSystemEvent"},
@@ -554,8 +561,8 @@ public:
554class IOAuthProcedureForUserRegistration final 561class IOAuthProcedureForUserRegistration final
555 : public ServiceFramework<IOAuthProcedureForUserRegistration> { 562 : public ServiceFramework<IOAuthProcedureForUserRegistration> {
556public: 563public:
557 explicit IOAuthProcedureForUserRegistration(Common::UUID user_id) 564 explicit IOAuthProcedureForUserRegistration(Core::System& system_, Common::UUID)
558 : ServiceFramework("IOAuthProcedureForUserRegistration") { 565 : ServiceFramework{system_, "IOAuthProcedureForUserRegistration"} {
559 // clang-format off 566 // clang-format off
560 static const FunctionInfo functions[] = { 567 static const FunctionInfo functions[] = {
561 {0, nullptr, "PrepareAsync"}, 568 {0, nullptr, "PrepareAsync"},
@@ -578,7 +585,7 @@ public:
578 585
579class DAUTH_O final : public ServiceFramework<DAUTH_O> { 586class DAUTH_O final : public ServiceFramework<DAUTH_O> {
580public: 587public:
581 explicit DAUTH_O(Common::UUID) : ServiceFramework("dauth:o") { 588 explicit DAUTH_O(Core::System& system_, Common::UUID) : ServiceFramework{system_, "dauth:o"} {
582 // clang-format off 589 // clang-format off
583 static const FunctionInfo functions[] = { 590 static const FunctionInfo functions[] = {
584 {0, nullptr, "EnsureAuthenticationTokenCacheAsync"}, // [5.0.0-5.1.0] GeneratePostData 591 {0, nullptr, "EnsureAuthenticationTokenCacheAsync"}, // [5.0.0-5.1.0] GeneratePostData
@@ -597,7 +604,8 @@ public:
597// 6.0.0+ 604// 6.0.0+
598class IAsyncResult final : public ServiceFramework<IAsyncResult> { 605class IAsyncResult final : public ServiceFramework<IAsyncResult> {
599public: 606public:
600 explicit IAsyncResult(Common::UUID user_id) : ServiceFramework("IAsyncResult") { 607 explicit IAsyncResult(Core::System& system_, Common::UUID)
608 : ServiceFramework{system_, "IAsyncResult"} {
601 // clang-format off 609 // clang-format off
602 static const FunctionInfo functions[] = { 610 static const FunctionInfo functions[] = {
603 {0, nullptr, "GetResult"}, 611 {0, nullptr, "GetResult"},
@@ -656,7 +664,7 @@ void Module::Interface::GetProfile(Kernel::HLERequestContext& ctx) {
656 664
657 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 665 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
658 rb.Push(RESULT_SUCCESS); 666 rb.Push(RESULT_SUCCESS);
659 rb.PushIpcInterface<IProfile>(user_id, *profile_manager); 667 rb.PushIpcInterface<IProfile>(system, user_id, *profile_manager);
660} 668}
661 669
662void Module::Interface::IsUserRegistrationRequestPermitted(Kernel::HLERequestContext& ctx) { 670void Module::Interface::IsUserRegistrationRequestPermitted(Kernel::HLERequestContext& ctx) {
@@ -731,7 +739,7 @@ void Module::Interface::GetBaasAccountManagerForApplication(Kernel::HLERequestCo
731 LOG_DEBUG(Service_ACC, "called"); 739 LOG_DEBUG(Service_ACC, "called");
732 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 740 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
733 rb.Push(RESULT_SUCCESS); 741 rb.Push(RESULT_SUCCESS);
734 rb.PushIpcInterface<IManagerForApplication>(profile_manager->GetLastOpenedUser()); 742 rb.PushIpcInterface<IManagerForApplication>(system, profile_manager->GetLastOpenedUser());
735} 743}
736 744
737void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx) { 745void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx) {
@@ -769,7 +777,7 @@ void Module::Interface::GetProfileEditor(Kernel::HLERequestContext& ctx) {
769 777
770 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 778 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
771 rb.Push(RESULT_SUCCESS); 779 rb.Push(RESULT_SUCCESS);
772 rb.PushIpcInterface<IProfileEditor>(user_id, *profile_manager); 780 rb.PushIpcInterface<IProfileEditor>(system, user_id, *profile_manager);
773} 781}
774 782
775void Module::Interface::ListQualifiedUsers(Kernel::HLERequestContext& ctx) { 783void Module::Interface::ListQualifiedUsers(Kernel::HLERequestContext& ctx) {
@@ -791,7 +799,7 @@ void Module::Interface::LoadOpenContext(Kernel::HLERequestContext& ctx) {
791 // TODO: Find the differences between this and GetBaasAccountManagerForApplication 799 // TODO: Find the differences between this and GetBaasAccountManagerForApplication
792 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 800 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
793 rb.Push(RESULT_SUCCESS); 801 rb.Push(RESULT_SUCCESS);
794 rb.PushIpcInterface<IManagerForApplication>(profile_manager->GetLastOpenedUser()); 802 rb.PushIpcInterface<IManagerForApplication>(system, profile_manager->GetLastOpenedUser());
795} 803}
796 804
797void Module::Interface::ListOpenContextStoredUsers(Kernel::HLERequestContext& ctx) { 805void Module::Interface::ListOpenContextStoredUsers(Kernel::HLERequestContext& ctx) {
@@ -827,11 +835,11 @@ void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContex
827 rb.PushRaw<u128>(profile_manager->GetUser(0)->uuid); 835 rb.PushRaw<u128>(profile_manager->GetUser(0)->uuid);
828} 836}
829 837
830Module::Interface::Interface(std::shared_ptr<Module> module, 838Module::Interface::Interface(std::shared_ptr<Module> module_,
831 std::shared_ptr<ProfileManager> profile_manager, Core::System& system, 839 std::shared_ptr<ProfileManager> profile_manager_,
832 const char* name) 840 Core::System& system_, const char* name)
833 : ServiceFramework(name), module(std::move(module)), 841 : ServiceFramework{system_, name}, module{std::move(module_)}, profile_manager{std::move(
834 profile_manager(std::move(profile_manager)), system(system) {} 842 profile_manager_)} {}
835 843
836Module::Interface::~Interface() = default; 844Module::Interface::~Interface() = default;
837 845
diff --git a/src/core/hle/service/acc/acc.h b/src/core/hle/service/acc/acc.h
index c611efd89..ab8edc049 100644
--- a/src/core/hle/service/acc/acc.h
+++ b/src/core/hle/service/acc/acc.h
@@ -15,8 +15,8 @@ class Module final {
15public: 15public:
16 class Interface : public ServiceFramework<Interface> { 16 class Interface : public ServiceFramework<Interface> {
17 public: 17 public:
18 explicit Interface(std::shared_ptr<Module> module, 18 explicit Interface(std::shared_ptr<Module> module_,
19 std::shared_ptr<ProfileManager> profile_manager, Core::System& system, 19 std::shared_ptr<ProfileManager> profile_manager_, Core::System& system_,
20 const char* name); 20 const char* name);
21 ~Interface() override; 21 ~Interface() override;
22 22
@@ -60,7 +60,6 @@ public:
60 protected: 60 protected:
61 std::shared_ptr<Module> module; 61 std::shared_ptr<Module> module;
62 std::shared_ptr<ProfileManager> profile_manager; 62 std::shared_ptr<ProfileManager> profile_manager;
63 Core::System& system;
64 }; 63 };
65}; 64};
66 65