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/am/applet_ae.cpp | 49 +++++++++++++++++------------------ 1 file changed, 24 insertions(+), 25 deletions(-) (limited to 'src/core/hle/service/am/applet_ae.cpp') diff --git a/src/core/hle/service/am/applet_ae.cpp b/src/core/hle/service/am/applet_ae.cpp index 7de506b70..5421e0da0 100644 --- a/src/core/hle/service/am/applet_ae.cpp +++ b/src/core/hle/service/am/applet_ae.cpp @@ -13,11 +13,11 @@ namespace Service::AM { class ILibraryAppletProxy final : public ServiceFramework { public: - explicit ILibraryAppletProxy(NVFlinger::NVFlinger& nvflinger, - std::shared_ptr msg_queue, - Core::System& system) - : ServiceFramework("ILibraryAppletProxy"), nvflinger(nvflinger), - msg_queue(std::move(msg_queue)), system(system) { + explicit ILibraryAppletProxy(NVFlinger::NVFlinger& nvflinger_, + std::shared_ptr msg_queue_, + Core::System& system_) + : ServiceFramework{system_, "ILibraryAppletProxy"}, nvflinger{nvflinger_}, + msg_queue{std::move(msg_queue_)} { // clang-format off static const FunctionInfo functions[] = { {0, &ILibraryAppletProxy::GetCommonStateGetter, "GetCommonStateGetter"}, @@ -66,7 +66,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface(); + rb.PushIpcInterface(system); } void GetDisplayController(Kernel::HLERequestContext& ctx) { @@ -74,7 +74,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface(); + rb.PushIpcInterface(system); } void GetProcessWindingController(Kernel::HLERequestContext& ctx) { @@ -82,7 +82,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface(); + rb.PushIpcInterface(system); } void GetDebugFunctions(Kernel::HLERequestContext& ctx) { @@ -90,7 +90,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface(); + rb.PushIpcInterface(system); } void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) { @@ -111,15 +111,15 @@ private: NVFlinger::NVFlinger& nvflinger; std::shared_ptr msg_queue; - Core::System& system; }; class ISystemAppletProxy final : public ServiceFramework { public: - explicit ISystemAppletProxy(NVFlinger::NVFlinger& nvflinger, - std::shared_ptr msg_queue, Core::System& system) - : ServiceFramework("ISystemAppletProxy"), nvflinger(nvflinger), - msg_queue(std::move(msg_queue)), system(system) { + explicit ISystemAppletProxy(NVFlinger::NVFlinger& nvflinger_, + std::shared_ptr msg_queue_, + Core::System& system_) + : ServiceFramework{system_, "ISystemAppletProxy"}, nvflinger{nvflinger_}, + msg_queue{std::move(msg_queue_)} { // clang-format off static const FunctionInfo functions[] = { {0, &ISystemAppletProxy::GetCommonStateGetter, "GetCommonStateGetter"}, @@ -170,7 +170,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface(); + rb.PushIpcInterface(system); } void GetDisplayController(Kernel::HLERequestContext& ctx) { @@ -178,7 +178,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface(); + rb.PushIpcInterface(system); } void GetDebugFunctions(Kernel::HLERequestContext& ctx) { @@ -186,7 +186,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface(); + rb.PushIpcInterface(system); } void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) { @@ -202,7 +202,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface(system.Kernel()); + rb.PushIpcInterface(system); } void GetGlobalStateController(Kernel::HLERequestContext& ctx) { @@ -210,7 +210,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface(); + rb.PushIpcInterface(system); } void GetApplicationCreator(Kernel::HLERequestContext& ctx) { @@ -218,12 +218,11 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface(); + rb.PushIpcInterface(system); } NVFlinger::NVFlinger& nvflinger; std::shared_ptr msg_queue; - Core::System& system; }; void AppletAE::OpenSystemAppletProxy(Kernel::HLERequestContext& ctx) { @@ -250,10 +249,10 @@ void AppletAE::OpenLibraryAppletProxyOld(Kernel::HLERequestContext& ctx) { rb.PushIpcInterface(nvflinger, msg_queue, system); } -AppletAE::AppletAE(NVFlinger::NVFlinger& nvflinger, std::shared_ptr msg_queue, - Core::System& system) - : ServiceFramework("appletAE"), nvflinger(nvflinger), msg_queue(std::move(msg_queue)), - system(system) { +AppletAE::AppletAE(NVFlinger::NVFlinger& nvflinger_, std::shared_ptr msg_queue_, + Core::System& system_) + : ServiceFramework{system_, "appletAE"}, nvflinger{nvflinger_}, msg_queue{ + std::move(msg_queue_)} { // clang-format off static const FunctionInfo functions[] = { {100, &AppletAE::OpenSystemAppletProxy, "OpenSystemAppletProxy"}, -- cgit v1.2.3