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/ns | |
| 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/ns')
| -rw-r--r-- | src/core/hle/service/ns/ns.cpp | 45 | ||||
| -rw-r--r-- | src/core/hle/service/ns/ns.h | 20 | ||||
| -rw-r--r-- | src/core/hle/service/ns/pl_u.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/ns/pl_u.h | 3 |
4 files changed, 36 insertions, 36 deletions
diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp index 2594e6839..ef7584641 100644 --- a/src/core/hle/service/ns/ns.cpp +++ b/src/core/hle/service/ns/ns.cpp | |||
| @@ -18,7 +18,8 @@ | |||
| 18 | 18 | ||
| 19 | namespace Service::NS { | 19 | namespace Service::NS { |
| 20 | 20 | ||
| 21 | IAccountProxyInterface::IAccountProxyInterface() : ServiceFramework{"IAccountProxyInterface"} { | 21 | IAccountProxyInterface::IAccountProxyInterface(Core::System& system_) |
| 22 | : ServiceFramework{system_, "IAccountProxyInterface"} { | ||
| 22 | // clang-format off | 23 | // clang-format off |
| 23 | static const FunctionInfo functions[] = { | 24 | static const FunctionInfo functions[] = { |
| 24 | {0, nullptr, "CreateUserAccount"}, | 25 | {0, nullptr, "CreateUserAccount"}, |
| @@ -31,7 +32,7 @@ IAccountProxyInterface::IAccountProxyInterface() : ServiceFramework{"IAccountPro | |||
| 31 | IAccountProxyInterface::~IAccountProxyInterface() = default; | 32 | IAccountProxyInterface::~IAccountProxyInterface() = default; |
| 32 | 33 | ||
| 33 | IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_) | 34 | IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_) |
| 34 | : ServiceFramework{"IApplicationManagerInterface"}, system{system_} { | 35 | : ServiceFramework{system_, "IApplicationManagerInterface"} { |
| 35 | // clang-format off | 36 | // clang-format off |
| 36 | static const FunctionInfo functions[] = { | 37 | static const FunctionInfo functions[] = { |
| 37 | {0, nullptr, "ListApplicationRecord"}, | 38 | {0, nullptr, "ListApplicationRecord"}, |
| @@ -428,8 +429,8 @@ ResultVal<u64> IApplicationManagerInterface::ConvertApplicationLanguageToLanguag | |||
| 428 | return MakeResult(static_cast<u64>(*language_code)); | 429 | return MakeResult(static_cast<u64>(*language_code)); |
| 429 | } | 430 | } |
| 430 | 431 | ||
| 431 | IApplicationVersionInterface::IApplicationVersionInterface() | 432 | IApplicationVersionInterface::IApplicationVersionInterface(Core::System& system_) |
| 432 | : ServiceFramework{"IApplicationVersionInterface"} { | 433 | : ServiceFramework{system_, "IApplicationVersionInterface"} { |
| 433 | // clang-format off | 434 | // clang-format off |
| 434 | static const FunctionInfo functions[] = { | 435 | static const FunctionInfo functions[] = { |
| 435 | {0, nullptr, "GetLaunchRequiredVersion"}, | 436 | {0, nullptr, "GetLaunchRequiredVersion"}, |
| @@ -449,8 +450,8 @@ IApplicationVersionInterface::IApplicationVersionInterface() | |||
| 449 | 450 | ||
| 450 | IApplicationVersionInterface::~IApplicationVersionInterface() = default; | 451 | IApplicationVersionInterface::~IApplicationVersionInterface() = default; |
| 451 | 452 | ||
| 452 | IContentManagementInterface::IContentManagementInterface() | 453 | IContentManagementInterface::IContentManagementInterface(Core::System& system_) |
| 453 | : ServiceFramework{"IContentManagementInterface"} { | 454 | : ServiceFramework{system_, "IContentManagementInterface"} { |
| 454 | // clang-format off | 455 | // clang-format off |
| 455 | static const FunctionInfo functions[] = { | 456 | static const FunctionInfo functions[] = { |
| 456 | {11, nullptr, "CalculateApplicationOccupiedSize"}, | 457 | {11, nullptr, "CalculateApplicationOccupiedSize"}, |
| @@ -469,7 +470,8 @@ IContentManagementInterface::IContentManagementInterface() | |||
| 469 | 470 | ||
| 470 | IContentManagementInterface::~IContentManagementInterface() = default; | 471 | IContentManagementInterface::~IContentManagementInterface() = default; |
| 471 | 472 | ||
| 472 | IDocumentInterface::IDocumentInterface() : ServiceFramework{"IDocumentInterface"} { | 473 | IDocumentInterface::IDocumentInterface(Core::System& system_) |
| 474 | : ServiceFramework{system_, "IDocumentInterface"} { | ||
| 473 | // clang-format off | 475 | // clang-format off |
| 474 | static const FunctionInfo functions[] = { | 476 | static const FunctionInfo functions[] = { |
| 475 | {21, nullptr, "GetApplicationContentPath"}, | 477 | {21, nullptr, "GetApplicationContentPath"}, |
| @@ -483,7 +485,8 @@ IDocumentInterface::IDocumentInterface() : ServiceFramework{"IDocumentInterface" | |||
| 483 | 485 | ||
| 484 | IDocumentInterface::~IDocumentInterface() = default; | 486 | IDocumentInterface::~IDocumentInterface() = default; |
| 485 | 487 | ||
| 486 | IDownloadTaskInterface::IDownloadTaskInterface() : ServiceFramework{"IDownloadTaskInterface"} { | 488 | IDownloadTaskInterface::IDownloadTaskInterface(Core::System& system_) |
| 489 | : ServiceFramework{system_, "IDownloadTaskInterface"} { | ||
| 487 | // clang-format off | 490 | // clang-format off |
| 488 | static const FunctionInfo functions[] = { | 491 | static const FunctionInfo functions[] = { |
| 489 | {701, nullptr, "ClearTaskStatusList"}, | 492 | {701, nullptr, "ClearTaskStatusList"}, |
| @@ -503,7 +506,8 @@ IDownloadTaskInterface::IDownloadTaskInterface() : ServiceFramework{"IDownloadTa | |||
| 503 | 506 | ||
| 504 | IDownloadTaskInterface::~IDownloadTaskInterface() = default; | 507 | IDownloadTaskInterface::~IDownloadTaskInterface() = default; |
| 505 | 508 | ||
| 506 | IECommerceInterface::IECommerceInterface() : ServiceFramework{"IECommerceInterface"} { | 509 | IECommerceInterface::IECommerceInterface(Core::System& system_) |
| 510 | : ServiceFramework{system_, "IECommerceInterface"} { | ||
| 507 | // clang-format off | 511 | // clang-format off |
| 508 | static const FunctionInfo functions[] = { | 512 | static const FunctionInfo functions[] = { |
| 509 | {0, nullptr, "RequestLinkDevice"}, | 513 | {0, nullptr, "RequestLinkDevice"}, |
| @@ -521,8 +525,8 @@ IECommerceInterface::IECommerceInterface() : ServiceFramework{"IECommerceInterfa | |||
| 521 | 525 | ||
| 522 | IECommerceInterface::~IECommerceInterface() = default; | 526 | IECommerceInterface::~IECommerceInterface() = default; |
| 523 | 527 | ||
| 524 | IFactoryResetInterface::IFactoryResetInterface::IFactoryResetInterface() | 528 | IFactoryResetInterface::IFactoryResetInterface(Core::System& system_) |
| 525 | : ServiceFramework{"IFactoryResetInterface"} { | 529 | : ServiceFramework{system_, "IFactoryResetInterface"} { |
| 526 | // clang-format off | 530 | // clang-format off |
| 527 | static const FunctionInfo functions[] = { | 531 | static const FunctionInfo functions[] = { |
| 528 | {100, nullptr, "ResetToFactorySettings"}, | 532 | {100, nullptr, "ResetToFactorySettings"}, |
| @@ -540,7 +544,7 @@ IFactoryResetInterface::IFactoryResetInterface::IFactoryResetInterface() | |||
| 540 | 544 | ||
| 541 | IFactoryResetInterface::~IFactoryResetInterface() = default; | 545 | IFactoryResetInterface::~IFactoryResetInterface() = default; |
| 542 | 546 | ||
| 543 | NS::NS(const char* name, Core::System& system_) : ServiceFramework{name}, system{system_} { | 547 | NS::NS(const char* name, Core::System& system_) : ServiceFramework{system_, name} { |
| 544 | // clang-format off | 548 | // clang-format off |
| 545 | static const FunctionInfo functions[] = { | 549 | static const FunctionInfo functions[] = { |
| 546 | {7992, &NS::PushInterface<IECommerceInterface>, "GetECommerceInterface"}, | 550 | {7992, &NS::PushInterface<IECommerceInterface>, "GetECommerceInterface"}, |
| @@ -565,7 +569,7 @@ std::shared_ptr<IApplicationManagerInterface> NS::GetApplicationManagerInterface | |||
| 565 | 569 | ||
| 566 | class NS_DEV final : public ServiceFramework<NS_DEV> { | 570 | class NS_DEV final : public ServiceFramework<NS_DEV> { |
| 567 | public: | 571 | public: |
| 568 | explicit NS_DEV() : ServiceFramework{"ns:dev"} { | 572 | explicit NS_DEV(Core::System& system_) : ServiceFramework{system_, "ns:dev"} { |
| 569 | // clang-format off | 573 | // clang-format off |
| 570 | static const FunctionInfo functions[] = { | 574 | static const FunctionInfo functions[] = { |
| 571 | {0, nullptr, "LaunchProgram"}, | 575 | {0, nullptr, "LaunchProgram"}, |
| @@ -592,7 +596,8 @@ public: | |||
| 592 | 596 | ||
| 593 | class ISystemUpdateControl final : public ServiceFramework<ISystemUpdateControl> { | 597 | class ISystemUpdateControl final : public ServiceFramework<ISystemUpdateControl> { |
| 594 | public: | 598 | public: |
| 595 | explicit ISystemUpdateControl() : ServiceFramework{"ISystemUpdateControl"} { | 599 | explicit ISystemUpdateControl(Core::System& system_) |
| 600 | : ServiceFramework{system_, "ISystemUpdateControl"} { | ||
| 596 | // clang-format off | 601 | // clang-format off |
| 597 | static const FunctionInfo functions[] = { | 602 | static const FunctionInfo functions[] = { |
| 598 | {0, nullptr, "HasDownloaded"}, | 603 | {0, nullptr, "HasDownloaded"}, |
| @@ -627,7 +632,7 @@ public: | |||
| 627 | 632 | ||
| 628 | class NS_SU final : public ServiceFramework<NS_SU> { | 633 | class NS_SU final : public ServiceFramework<NS_SU> { |
| 629 | public: | 634 | public: |
| 630 | explicit NS_SU() : ServiceFramework{"ns:su"} { | 635 | explicit NS_SU(Core::System& system_) : ServiceFramework{system_, "ns:su"} { |
| 631 | // clang-format off | 636 | // clang-format off |
| 632 | static const FunctionInfo functions[] = { | 637 | static const FunctionInfo functions[] = { |
| 633 | {0, nullptr, "GetBackgroundNetworkUpdateState"}, | 638 | {0, nullptr, "GetBackgroundNetworkUpdateState"}, |
| @@ -659,13 +664,13 @@ private: | |||
| 659 | 664 | ||
| 660 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 665 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 661 | rb.Push(RESULT_SUCCESS); | 666 | rb.Push(RESULT_SUCCESS); |
| 662 | rb.PushIpcInterface<ISystemUpdateControl>(); | 667 | rb.PushIpcInterface<ISystemUpdateControl>(system); |
| 663 | } | 668 | } |
| 664 | }; | 669 | }; |
| 665 | 670 | ||
| 666 | class NS_VM final : public ServiceFramework<NS_VM> { | 671 | class NS_VM final : public ServiceFramework<NS_VM> { |
| 667 | public: | 672 | public: |
| 668 | explicit NS_VM() : ServiceFramework{"ns:vm"} { | 673 | explicit NS_VM(Core::System& system_) : ServiceFramework{system_, "ns:vm"} { |
| 669 | // clang-format off | 674 | // clang-format off |
| 670 | static const FunctionInfo functions[] = { | 675 | static const FunctionInfo functions[] = { |
| 671 | {1200, nullptr, "NeedsUpdateVulnerability"}, | 676 | {1200, nullptr, "NeedsUpdateVulnerability"}, |
| @@ -686,9 +691,9 @@ void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system | |||
| 686 | std::make_shared<NS>("ns:rt", system)->InstallAsService(service_manager); | 691 | std::make_shared<NS>("ns:rt", system)->InstallAsService(service_manager); |
| 687 | std::make_shared<NS>("ns:web", system)->InstallAsService(service_manager); | 692 | std::make_shared<NS>("ns:web", system)->InstallAsService(service_manager); |
| 688 | 693 | ||
| 689 | std::make_shared<NS_DEV>()->InstallAsService(service_manager); | 694 | std::make_shared<NS_DEV>(system)->InstallAsService(service_manager); |
| 690 | std::make_shared<NS_SU>()->InstallAsService(service_manager); | 695 | std::make_shared<NS_SU>(system)->InstallAsService(service_manager); |
| 691 | std::make_shared<NS_VM>()->InstallAsService(service_manager); | 696 | std::make_shared<NS_VM>(system)->InstallAsService(service_manager); |
| 692 | 697 | ||
| 693 | std::make_shared<PL_U>(system)->InstallAsService(service_manager); | 698 | std::make_shared<PL_U>(system)->InstallAsService(service_manager); |
| 694 | } | 699 | } |
diff --git a/src/core/hle/service/ns/ns.h b/src/core/hle/service/ns/ns.h index c90ccd755..991271f3e 100644 --- a/src/core/hle/service/ns/ns.h +++ b/src/core/hle/service/ns/ns.h | |||
| @@ -20,7 +20,7 @@ namespace NS { | |||
| 20 | 20 | ||
| 21 | class IAccountProxyInterface final : public ServiceFramework<IAccountProxyInterface> { | 21 | class IAccountProxyInterface final : public ServiceFramework<IAccountProxyInterface> { |
| 22 | public: | 22 | public: |
| 23 | explicit IAccountProxyInterface(); | 23 | explicit IAccountProxyInterface(Core::System& system_); |
| 24 | ~IAccountProxyInterface() override; | 24 | ~IAccountProxyInterface() override; |
| 25 | }; | 25 | }; |
| 26 | 26 | ||
| @@ -36,43 +36,41 @@ private: | |||
| 36 | void GetApplicationControlData(Kernel::HLERequestContext& ctx); | 36 | void GetApplicationControlData(Kernel::HLERequestContext& ctx); |
| 37 | void GetApplicationDesiredLanguage(Kernel::HLERequestContext& ctx); | 37 | void GetApplicationDesiredLanguage(Kernel::HLERequestContext& ctx); |
| 38 | void ConvertApplicationLanguageToLanguageCode(Kernel::HLERequestContext& ctx); | 38 | void ConvertApplicationLanguageToLanguageCode(Kernel::HLERequestContext& ctx); |
| 39 | |||
| 40 | Core::System& system; | ||
| 41 | }; | 39 | }; |
| 42 | 40 | ||
| 43 | class IApplicationVersionInterface final : public ServiceFramework<IApplicationVersionInterface> { | 41 | class IApplicationVersionInterface final : public ServiceFramework<IApplicationVersionInterface> { |
| 44 | public: | 42 | public: |
| 45 | explicit IApplicationVersionInterface(); | 43 | explicit IApplicationVersionInterface(Core::System& system_); |
| 46 | ~IApplicationVersionInterface() override; | 44 | ~IApplicationVersionInterface() override; |
| 47 | }; | 45 | }; |
| 48 | 46 | ||
| 49 | class IContentManagementInterface final : public ServiceFramework<IContentManagementInterface> { | 47 | class IContentManagementInterface final : public ServiceFramework<IContentManagementInterface> { |
| 50 | public: | 48 | public: |
| 51 | explicit IContentManagementInterface(); | 49 | explicit IContentManagementInterface(Core::System& system_); |
| 52 | ~IContentManagementInterface() override; | 50 | ~IContentManagementInterface() override; |
| 53 | }; | 51 | }; |
| 54 | 52 | ||
| 55 | class IDocumentInterface final : public ServiceFramework<IDocumentInterface> { | 53 | class IDocumentInterface final : public ServiceFramework<IDocumentInterface> { |
| 56 | public: | 54 | public: |
| 57 | explicit IDocumentInterface(); | 55 | explicit IDocumentInterface(Core::System& system_); |
| 58 | ~IDocumentInterface() override; | 56 | ~IDocumentInterface() override; |
| 59 | }; | 57 | }; |
| 60 | 58 | ||
| 61 | class IDownloadTaskInterface final : public ServiceFramework<IDownloadTaskInterface> { | 59 | class IDownloadTaskInterface final : public ServiceFramework<IDownloadTaskInterface> { |
| 62 | public: | 60 | public: |
| 63 | explicit IDownloadTaskInterface(); | 61 | explicit IDownloadTaskInterface(Core::System& system_); |
| 64 | ~IDownloadTaskInterface() override; | 62 | ~IDownloadTaskInterface() override; |
| 65 | }; | 63 | }; |
| 66 | 64 | ||
| 67 | class IECommerceInterface final : public ServiceFramework<IECommerceInterface> { | 65 | class IECommerceInterface final : public ServiceFramework<IECommerceInterface> { |
| 68 | public: | 66 | public: |
| 69 | explicit IECommerceInterface(); | 67 | explicit IECommerceInterface(Core::System& system_); |
| 70 | ~IECommerceInterface() override; | 68 | ~IECommerceInterface() override; |
| 71 | }; | 69 | }; |
| 72 | 70 | ||
| 73 | class IFactoryResetInterface final : public ServiceFramework<IFactoryResetInterface> { | 71 | class IFactoryResetInterface final : public ServiceFramework<IFactoryResetInterface> { |
| 74 | public: | 72 | public: |
| 75 | explicit IFactoryResetInterface(); | 73 | explicit IFactoryResetInterface(Core::System& system_); |
| 76 | ~IFactoryResetInterface() override; | 74 | ~IFactoryResetInterface() override; |
| 77 | }; | 75 | }; |
| 78 | 76 | ||
| @@ -90,7 +88,7 @@ private: | |||
| 90 | 88 | ||
| 91 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 89 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 92 | rb.Push(RESULT_SUCCESS); | 90 | rb.Push(RESULT_SUCCESS); |
| 93 | rb.PushIpcInterface<T>(); | 91 | rb.PushIpcInterface<T>(system); |
| 94 | } | 92 | } |
| 95 | 93 | ||
| 96 | void PushIApplicationManagerInterface(Kernel::HLERequestContext& ctx) { | 94 | void PushIApplicationManagerInterface(Kernel::HLERequestContext& ctx) { |
| @@ -108,8 +106,6 @@ private: | |||
| 108 | 106 | ||
| 109 | return std::make_shared<T>(std::forward<Args>(args)...); | 107 | return std::make_shared<T>(std::forward<Args>(args)...); |
| 110 | } | 108 | } |
| 111 | |||
| 112 | Core::System& system; | ||
| 113 | }; | 109 | }; |
| 114 | 110 | ||
| 115 | /// Registers all NS services with the specified service manager. | 111 | /// Registers all NS services with the specified service manager. |
diff --git a/src/core/hle/service/ns/pl_u.cpp b/src/core/hle/service/ns/pl_u.cpp index 5ccec2637..ccc137e40 100644 --- a/src/core/hle/service/ns/pl_u.cpp +++ b/src/core/hle/service/ns/pl_u.cpp | |||
| @@ -141,8 +141,8 @@ struct PL_U::Impl { | |||
| 141 | std::vector<FontRegion> shared_font_regions; | 141 | std::vector<FontRegion> shared_font_regions; |
| 142 | }; | 142 | }; |
| 143 | 143 | ||
| 144 | PL_U::PL_U(Core::System& system) | 144 | PL_U::PL_U(Core::System& system_) |
| 145 | : ServiceFramework("pl:u"), impl{std::make_unique<Impl>()}, system(system) { | 145 | : ServiceFramework{system_, "pl:u"}, impl{std::make_unique<Impl>()} { |
| 146 | // clang-format off | 146 | // clang-format off |
| 147 | static const FunctionInfo functions[] = { | 147 | static const FunctionInfo functions[] = { |
| 148 | {0, &PL_U::RequestLoad, "RequestLoad"}, | 148 | {0, &PL_U::RequestLoad, "RequestLoad"}, |
diff --git a/src/core/hle/service/ns/pl_u.h b/src/core/hle/service/ns/pl_u.h index 27161bd7a..224dcb997 100644 --- a/src/core/hle/service/ns/pl_u.h +++ b/src/core/hle/service/ns/pl_u.h | |||
| @@ -20,7 +20,7 @@ void EncryptSharedFont(const std::vector<u32>& input, std::vector<u8>& output, s | |||
| 20 | 20 | ||
| 21 | class PL_U final : public ServiceFramework<PL_U> { | 21 | class PL_U final : public ServiceFramework<PL_U> { |
| 22 | public: | 22 | public: |
| 23 | explicit PL_U(Core::System& system); | 23 | explicit PL_U(Core::System& system_); |
| 24 | ~PL_U() override; | 24 | ~PL_U() override; |
| 25 | 25 | ||
| 26 | private: | 26 | private: |
| @@ -33,7 +33,6 @@ private: | |||
| 33 | 33 | ||
| 34 | struct Impl; | 34 | struct Impl; |
| 35 | std::unique_ptr<Impl> impl; | 35 | std::unique_ptr<Impl> impl; |
| 36 | Core::System& system; | ||
| 37 | }; | 36 | }; |
| 38 | 37 | ||
| 39 | } // namespace NS | 38 | } // namespace NS |