From 1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 26 Nov 2020 15:19:08 -0500 Subject: 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. --- src/core/hle/service/ncm/ncm.cpp | 20 +++++++++++--------- src/core/hle/service/ncm/ncm.h | 6 +++++- 2 files changed, 16 insertions(+), 10 deletions(-) (limited to 'src/core/hle/service/ncm') diff --git a/src/core/hle/service/ncm/ncm.cpp b/src/core/hle/service/ncm/ncm.cpp index e38dea1f4..b8d627ca8 100644 --- a/src/core/hle/service/ncm/ncm.cpp +++ b/src/core/hle/service/ncm/ncm.cpp @@ -14,8 +14,8 @@ namespace Service::NCM { class ILocationResolver final : public ServiceFramework { public: - explicit ILocationResolver(FileSys::StorageId id) - : ServiceFramework{"ILocationResolver"}, storage(id) { + explicit ILocationResolver(Core::System& system_, FileSys::StorageId id) + : ServiceFramework{system_, "ILocationResolver"}, storage{id} { // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "ResolveProgramPath"}, @@ -50,7 +50,8 @@ private: class IRegisteredLocationResolver final : public ServiceFramework { public: - explicit IRegisteredLocationResolver() : ServiceFramework{"IRegisteredLocationResolver"} { + explicit IRegisteredLocationResolver(Core::System& system_) + : ServiceFramework{system_, "IRegisteredLocationResolver"} { // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "ResolveProgramPath"}, @@ -72,7 +73,8 @@ public: class IAddOnContentLocationResolver final : public ServiceFramework { public: - explicit IAddOnContentLocationResolver() : ServiceFramework{"IAddOnContentLocationResolver"} { + explicit IAddOnContentLocationResolver(Core::System& system_) + : ServiceFramework{system_, "IAddOnContentLocationResolver"} { // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "ResolveAddOnContentPath"}, @@ -89,7 +91,7 @@ public: class LR final : public ServiceFramework { public: - explicit LR() : ServiceFramework{"lr"} { + explicit LR(Core::System& system_) : ServiceFramework{system_, "lr"} { // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "OpenLocationResolver"}, @@ -105,7 +107,7 @@ public: class NCM final : public ServiceFramework { public: - explicit NCM() : ServiceFramework{"ncm"} { + explicit NCM(Core::System& system_) : ServiceFramework{system_, "ncm"} { // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "CreateContentStorage"}, @@ -130,9 +132,9 @@ public: } }; -void InstallInterfaces(SM::ServiceManager& sm) { - std::make_shared()->InstallAsService(sm); - std::make_shared()->InstallAsService(sm); +void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) { + std::make_shared(system)->InstallAsService(sm); + std::make_shared(system)->InstallAsService(sm); } } // namespace Service::NCM diff --git a/src/core/hle/service/ncm/ncm.h b/src/core/hle/service/ncm/ncm.h index 7bc8518a6..ee01eddc0 100644 --- a/src/core/hle/service/ncm/ncm.h +++ b/src/core/hle/service/ncm/ncm.h @@ -4,12 +4,16 @@ #pragma once +namespace Core { +class System; +} + namespace Service::SM { class ServiceManager; } namespace Service::NCM { -void InstallInterfaces(SM::ServiceManager& sm); +void InstallInterfaces(SM::ServiceManager& sm, Core::System& system); } // namespace Service::NCM -- cgit v1.2.3