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/pcv/pcv.cpp | 14 +++++++------- src/core/hle/service/pcv/pcv.h | 6 +++++- 2 files changed, 12 insertions(+), 8 deletions(-) (limited to 'src/core/hle/service/pcv') diff --git a/src/core/hle/service/pcv/pcv.cpp b/src/core/hle/service/pcv/pcv.cpp index 8bfc0276e..68b2c4178 100644 --- a/src/core/hle/service/pcv/pcv.cpp +++ b/src/core/hle/service/pcv/pcv.cpp @@ -12,7 +12,7 @@ namespace Service::PCV { class PCV final : public ServiceFramework { public: - explicit PCV() : ServiceFramework{"pcv"} { + explicit PCV(Core::System& system_) : ServiceFramework{system_, "pcv"} { // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "SetPowerEnabled"}, @@ -54,7 +54,7 @@ public: class PCV_ARB final : public ServiceFramework { public: - explicit PCV_ARB() : ServiceFramework{"pcv:arb"} { + explicit PCV_ARB(Core::System& system_) : ServiceFramework{system_, "pcv:arb"} { // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "ReleaseControl"}, @@ -67,7 +67,7 @@ public: class PCV_IMM final : public ServiceFramework { public: - explicit PCV_IMM() : ServiceFramework{"pcv:imm"} { + explicit PCV_IMM(Core::System& system_) : ServiceFramework{system_, "pcv:imm"} { // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "SetClockRate"}, @@ -78,10 +78,10 @@ public: } }; -void InstallInterfaces(SM::ServiceManager& sm) { - std::make_shared()->InstallAsService(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); + std::make_shared(system)->InstallAsService(sm); } } // namespace Service::PCV diff --git a/src/core/hle/service/pcv/pcv.h b/src/core/hle/service/pcv/pcv.h index 219a893c3..c61a0b591 100644 --- a/src/core/hle/service/pcv/pcv.h +++ b/src/core/hle/service/pcv/pcv.h @@ -4,12 +4,16 @@ #pragma once +namespace Core { +class System; +} + namespace Service::SM { class ServiceManager; } namespace Service::PCV { -void InstallInterfaces(SM::ServiceManager& sm); +void InstallInterfaces(SM::ServiceManager& sm, Core::System& system); } // namespace Service::PCV -- cgit v1.2.3