From d1abe8e92afd6d03324af5733660aca2a77f134b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 11 Jul 2019 00:53:55 -0400 Subject: service/am: Remove usages of global system accessors Avoids the use of global accessors, removing the reliance on global state. This also makes dependencies explicit in the interface, as opposed to being hidden --- src/core/hle/service/am/am.h | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'src/core/hle/service/am/am.h') diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index cbc9da7b6..28f870302 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h @@ -10,12 +10,15 @@ #include "core/hle/kernel/writable_event.h" #include "core/hle/service/service.h" -namespace Service { -namespace NVFlinger { +namespace Kernel { +class KernelCore; +} + +namespace Service::NVFlinger { class NVFlinger; } -namespace AM { +namespace Service::AM { enum SystemLanguage { Japanese = 0, @@ -47,7 +50,7 @@ public: PerformanceModeChanged = 31, }; - AppletMessageQueue(); + explicit AppletMessageQueue(Kernel::KernelCore& kernel); ~AppletMessageQueue(); const Kernel::SharedPtr& GetMesssageRecieveEvent() const; @@ -65,12 +68,14 @@ private: class IWindowController final : public ServiceFramework { public: - IWindowController(); + explicit IWindowController(Core::System& system_); ~IWindowController() override; private: void GetAppletResourceUserId(Kernel::HLERequestContext& ctx); void AcquireForegroundRights(Kernel::HLERequestContext& ctx); + + Core::System& system; }; class IAudioController final : public ServiceFramework { @@ -113,7 +118,8 @@ public: class ISelfController final : public ServiceFramework { public: - explicit ISelfController(std::shared_ptr nvflinger); + explicit ISelfController(Core::System& system_, + std::shared_ptr nvflinger_); ~ISelfController() override; private: @@ -208,7 +214,7 @@ private: class ILibraryAppletCreator final : public ServiceFramework { public: - ILibraryAppletCreator(u64 current_process_title_id); + explicit ILibraryAppletCreator(Core::System& system_); ~ILibraryAppletCreator() override; private: @@ -216,12 +222,12 @@ private: void CreateStorage(Kernel::HLERequestContext& ctx); void CreateTransferMemoryStorage(Kernel::HLERequestContext& ctx); - u64 current_process_title_id; + Core::System& system; }; class IApplicationFunctions final : public ServiceFramework { public: - IApplicationFunctions(); + explicit IApplicationFunctions(Core::System& system_); ~IApplicationFunctions() override; private: @@ -245,6 +251,7 @@ private: void GetGpuErrorDetectedSystemEvent(Kernel::HLERequestContext& ctx); Kernel::EventPair gpu_error_detected_event; + Core::System& system; }; class IHomeMenuFunctions final : public ServiceFramework { @@ -278,5 +285,4 @@ public: void InstallInterfaces(SM::ServiceManager& service_manager, std::shared_ptr nvflinger, Core::System& system); -} // namespace AM -} // namespace Service +} // namespace Service::AM -- cgit v1.2.3