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/am.cpp | 74 ++++++++++++---------- src/core/hle/service/am/am.h | 30 ++++----- src/core/hle/service/am/applet_ae.cpp | 49 +++++++------- src/core/hle/service/am/applet_ae.h | 5 +- src/core/hle/service/am/applet_oe.cpp | 24 +++---- src/core/hle/service/am/applet_oe.h | 5 +- src/core/hle/service/am/applets/controller.cpp | 4 +- src/core/hle/service/am/applets/controller.h | 1 + src/core/hle/service/am/applets/error.cpp | 4 +- .../hle/service/am/applets/general_backend.cpp | 24 +++---- src/core/hle/service/am/applets/general_backend.h | 3 +- src/core/hle/service/am/applets/profile_select.cpp | 6 +- src/core/hle/service/am/applets/profile_select.h | 1 + .../hle/service/am/applets/software_keyboard.cpp | 14 ++-- .../hle/service/am/applets/software_keyboard.h | 1 + src/core/hle/service/am/applets/web_browser.cpp | 2 +- src/core/hle/service/am/idle.cpp | 2 +- src/core/hle/service/am/idle.h | 6 +- src/core/hle/service/am/omm.cpp | 2 +- src/core/hle/service/am/omm.h | 6 +- src/core/hle/service/am/spsm.cpp | 2 +- src/core/hle/service/am/spsm.h | 6 +- src/core/hle/service/am/tcap.cpp | 2 +- src/core/hle/service/am/tcap.h | 6 +- 24 files changed, 149 insertions(+), 130 deletions(-) (limited to 'src/core/hle/service/am') diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 703a9b234..38d877f6e 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -64,7 +64,7 @@ struct LaunchParameterAccountPreselectedUser { static_assert(sizeof(LaunchParameterAccountPreselectedUser) == 0x88); IWindowController::IWindowController(Core::System& system_) - : ServiceFramework("IWindowController"), system{system_} { + : ServiceFramework{system_, "IWindowController"} { // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "CreateWindow"}, @@ -99,7 +99,8 @@ void IWindowController::AcquireForegroundRights(Kernel::HLERequestContext& ctx) rb.Push(RESULT_SUCCESS); } -IAudioController::IAudioController() : ServiceFramework("IAudioController") { +IAudioController::IAudioController(Core::System& system_) + : ServiceFramework{system_, "IAudioController"} { // clang-format off static const FunctionInfo functions[] = { {0, &IAudioController::SetExpectedMasterVolume, "SetExpectedMasterVolume"}, @@ -180,7 +181,8 @@ void IAudioController::SetTransparentAudioRate(Kernel::HLERequestContext& ctx) { rb.Push(RESULT_SUCCESS); } -IDisplayController::IDisplayController() : ServiceFramework("IDisplayController") { +IDisplayController::IDisplayController(Core::System& system_) + : ServiceFramework{system_, "IDisplayController"} { // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "GetLastForegroundCaptureImage"}, @@ -219,7 +221,8 @@ IDisplayController::IDisplayController() : ServiceFramework("IDisplayController" IDisplayController::~IDisplayController() = default; -IDebugFunctions::IDebugFunctions() : ServiceFramework{"IDebugFunctions"} { +IDebugFunctions::IDebugFunctions(Core::System& system_) + : ServiceFramework{system_, "IDebugFunctions"} { // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "NotifyMessageToHomeMenuForDebug"}, @@ -246,8 +249,8 @@ IDebugFunctions::IDebugFunctions() : ServiceFramework{"IDebugFunctions"} { IDebugFunctions::~IDebugFunctions() = default; -ISelfController::ISelfController(Core::System& system, NVFlinger::NVFlinger& nvflinger) - : ServiceFramework("ISelfController"), system(system), nvflinger(nvflinger) { +ISelfController::ISelfController(Core::System& system_, NVFlinger::NVFlinger& nvflinger_) + : ServiceFramework{system_, "ISelfController"}, nvflinger{nvflinger_} { // clang-format off static const FunctionInfo functions[] = { {0, &ISelfController::Exit, "Exit"}, @@ -605,9 +608,9 @@ void AppletMessageQueue::RequestExit() { PushMessage(AppletMessage::ExitRequested); } -ICommonStateGetter::ICommonStateGetter(Core::System& system, - std::shared_ptr msg_queue) - : ServiceFramework("ICommonStateGetter"), system(system), msg_queue(std::move(msg_queue)) { +ICommonStateGetter::ICommonStateGetter(Core::System& system_, + std::shared_ptr msg_queue_) + : ServiceFramework{system_, "ICommonStateGetter"}, msg_queue{std::move(msg_queue_)} { // clang-format off static const FunctionInfo functions[] = { {0, &ICommonStateGetter::GetEventHandle, "GetEventHandle"}, @@ -795,8 +798,9 @@ private: std::vector buffer; }; -IStorage::IStorage(std::vector&& buffer) - : ServiceFramework("IStorage"), impl{std::make_shared(std::move(buffer))} { +IStorage::IStorage(Core::System& system_, std::vector&& buffer) + : ServiceFramework{system_, "IStorage"}, impl{std::make_shared( + std::move(buffer))} { Register(); } @@ -819,7 +823,7 @@ void IStorage::Open(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface(*this); + rb.PushIpcInterface(system, *this); } void ICommonStateGetter::GetOperationMode(Kernel::HLERequestContext& ctx) { @@ -841,8 +845,8 @@ void ICommonStateGetter::GetPerformanceMode(Kernel::HLERequestContext& ctx) { class ILibraryAppletAccessor final : public ServiceFramework { public: - explicit ILibraryAppletAccessor(std::shared_ptr applet) - : ServiceFramework("ILibraryAppletAccessor"), applet(std::move(applet)) { + explicit ILibraryAppletAccessor(Core::System& system_, std::shared_ptr applet_) + : ServiceFramework{system_, "ILibraryAppletAccessor"}, applet{std::move(applet_)} { // clang-format off static const FunctionInfo functions[] = { {0, &ILibraryAppletAccessor::GetAppletStateChangedEvent, "GetAppletStateChangedEvent"}, @@ -997,8 +1001,8 @@ private: std::shared_ptr applet; }; -IStorageAccessor::IStorageAccessor(IStorage& storage) - : ServiceFramework("IStorageAccessor"), backing(storage) { +IStorageAccessor::IStorageAccessor(Core::System& system_, IStorage& backing_) + : ServiceFramework{system_, "IStorageAccessor"}, backing{backing_} { // clang-format off static const FunctionInfo functions[] = { {0, &IStorageAccessor::GetSize, "GetSize"}, @@ -1069,7 +1073,7 @@ void IStorageAccessor::Read(Kernel::HLERequestContext& ctx) { } ILibraryAppletCreator::ILibraryAppletCreator(Core::System& system_) - : ServiceFramework("ILibraryAppletCreator"), system{system_} { + : ServiceFramework{system_, "ILibraryAppletCreator"} { static const FunctionInfo functions[] = { {0, &ILibraryAppletCreator::CreateLibraryApplet, "CreateLibraryApplet"}, {1, nullptr, "TerminateAllLibraryApplets"}, @@ -1105,7 +1109,7 @@ void ILibraryAppletCreator::CreateLibraryApplet(Kernel::HLERequestContext& ctx) IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface(applet); + rb.PushIpcInterface(system, applet); } void ILibraryAppletCreator::CreateStorage(Kernel::HLERequestContext& ctx) { @@ -1117,7 +1121,7 @@ void ILibraryAppletCreator::CreateStorage(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface(std::move(buffer)); + rb.PushIpcInterface(system, std::move(buffer)); } void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContext& ctx) { @@ -1144,11 +1148,11 @@ void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContex IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface(std::move(memory)); + rb.PushIpcInterface(system, std::move(memory)); } IApplicationFunctions::IApplicationFunctions(Core::System& system_) - : ServiceFramework("IApplicationFunctions"), system{system_} { + : ServiceFramework{system_, "IApplicationFunctions"} { // clang-format off static const FunctionInfo functions[] = { {1, &IApplicationFunctions::PopLaunchParameter, "PopLaunchParameter"}, @@ -1300,7 +1304,7 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) { if (data.has_value()) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface(std::move(*data)); + rb.PushIpcInterface(system, std::move(*data)); launch_popped_application_specific = true; return; } @@ -1323,7 +1327,7 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) { std::vector buffer(sizeof(LaunchParameterAccountPreselectedUser)); std::memcpy(buffer.data(), ¶ms, buffer.size()); - rb.PushIpcInterface(std::move(buffer)); + rb.PushIpcInterface(system, std::move(buffer)); launch_popped_account_preselect = true; return; } @@ -1621,14 +1625,14 @@ void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger std::make_shared(nvflinger, message_queue, system)->InstallAsService(service_manager); std::make_shared(nvflinger, message_queue, system)->InstallAsService(service_manager); - std::make_shared()->InstallAsService(service_manager); - std::make_shared()->InstallAsService(service_manager); - std::make_shared()->InstallAsService(service_manager); - std::make_shared()->InstallAsService(service_manager); + std::make_shared(system)->InstallAsService(service_manager); + std::make_shared(system)->InstallAsService(service_manager); + std::make_shared(system)->InstallAsService(service_manager); + std::make_shared(system)->InstallAsService(service_manager); } -IHomeMenuFunctions::IHomeMenuFunctions(Kernel::KernelCore& kernel) - : ServiceFramework("IHomeMenuFunctions"), kernel(kernel) { +IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_) + : ServiceFramework{system_, "IHomeMenuFunctions"} { // clang-format off static const FunctionInfo functions[] = { {10, &IHomeMenuFunctions::RequestToGetForeground, "RequestToGetForeground"}, @@ -1647,7 +1651,7 @@ IHomeMenuFunctions::IHomeMenuFunctions(Kernel::KernelCore& kernel) RegisterHandlers(functions); pop_from_general_channel_event = Kernel::WritableEvent::CreateEventPair( - kernel, "IHomeMenuFunctions:PopFromGeneralChannelEvent"); + system.Kernel(), "IHomeMenuFunctions:PopFromGeneralChannelEvent"); } IHomeMenuFunctions::~IHomeMenuFunctions() = default; @@ -1667,7 +1671,8 @@ void IHomeMenuFunctions::GetPopFromGeneralChannelEvent(Kernel::HLERequestContext rb.PushCopyObjects(pop_from_general_channel_event.readable); } -IGlobalStateController::IGlobalStateController() : ServiceFramework("IGlobalStateController") { +IGlobalStateController::IGlobalStateController(Core::System& system_) + : ServiceFramework{system_, "IGlobalStateController"} { // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "RequestToEnterSleep"}, @@ -1690,7 +1695,8 @@ IGlobalStateController::IGlobalStateController() : ServiceFramework("IGlobalStat IGlobalStateController::~IGlobalStateController() = default; -IApplicationCreator::IApplicationCreator() : ServiceFramework("IApplicationCreator") { +IApplicationCreator::IApplicationCreator(Core::System& system_) + : ServiceFramework{system_, "IApplicationCreator"} { // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "CreateApplication"}, @@ -1705,8 +1711,8 @@ IApplicationCreator::IApplicationCreator() : ServiceFramework("IApplicationCreat IApplicationCreator::~IApplicationCreator() = default; -IProcessWindingController::IProcessWindingController() - : ServiceFramework("IProcessWindingController") { +IProcessWindingController::IProcessWindingController(Core::System& system_) + : ServiceFramework{system_, "IProcessWindingController"} { // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "GetLaunchReason"}, diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index af97c303a..b1da0d081 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h @@ -77,13 +77,11 @@ public: private: void GetAppletResourceUserId(Kernel::HLERequestContext& ctx); void AcquireForegroundRights(Kernel::HLERequestContext& ctx); - - Core::System& system; }; class IAudioController final : public ServiceFramework { public: - IAudioController(); + explicit IAudioController(Core::System& system_); ~IAudioController() override; private: @@ -109,13 +107,13 @@ private: class IDisplayController final : public ServiceFramework { public: - IDisplayController(); + explicit IDisplayController(Core::System& system_); ~IDisplayController() override; }; class IDebugFunctions final : public ServiceFramework { public: - IDebugFunctions(); + explicit IDebugFunctions(Core::System& system_); ~IDebugFunctions() override; }; @@ -154,7 +152,6 @@ private: Disable = 2, }; - Core::System& system; NVFlinger::NVFlinger& nvflinger; Kernel::EventPair launchable_event; Kernel::EventPair accumulated_suspended_tick_changed_event; @@ -167,8 +164,8 @@ private: class ICommonStateGetter final : public ServiceFramework { public: - explicit ICommonStateGetter(Core::System& system, - std::shared_ptr msg_queue); + explicit ICommonStateGetter(Core::System& system_, + std::shared_ptr msg_queue_); ~ICommonStateGetter() override; private: @@ -196,7 +193,6 @@ private: void GetDefaultDisplayResolution(Kernel::HLERequestContext& ctx); void SetCpuBoostMode(Kernel::HLERequestContext& ctx); - Core::System& system; std::shared_ptr msg_queue; bool vr_mode_state{}; }; @@ -211,7 +207,7 @@ public: class IStorage final : public ServiceFramework { public: - explicit IStorage(std::vector&& buffer); + explicit IStorage(Core::System& system_, std::vector&& buffer); ~IStorage() override; std::vector& GetData() { @@ -235,7 +231,7 @@ private: class IStorageAccessor final : public ServiceFramework { public: - explicit IStorageAccessor(IStorage& backing); + explicit IStorageAccessor(Core::System& system_, IStorage& backing_); ~IStorageAccessor() override; private: @@ -255,8 +251,6 @@ private: void CreateLibraryApplet(Kernel::HLERequestContext& ctx); void CreateStorage(Kernel::HLERequestContext& ctx); void CreateTransferMemoryStorage(Kernel::HLERequestContext& ctx); - - Core::System& system; }; class IApplicationFunctions final : public ServiceFramework { @@ -299,12 +293,11 @@ private: s32 previous_program_index{-1}; Kernel::EventPair gpu_error_detected_event; Kernel::EventPair friend_invitation_storage_channel_event; - Core::System& system; }; class IHomeMenuFunctions final : public ServiceFramework { public: - explicit IHomeMenuFunctions(Kernel::KernelCore& kernel); + explicit IHomeMenuFunctions(Core::System& system_); ~IHomeMenuFunctions() override; private: @@ -312,24 +305,23 @@ private: void GetPopFromGeneralChannelEvent(Kernel::HLERequestContext& ctx); Kernel::EventPair pop_from_general_channel_event; - Kernel::KernelCore& kernel; }; class IGlobalStateController final : public ServiceFramework { public: - IGlobalStateController(); + explicit IGlobalStateController(Core::System& system_); ~IGlobalStateController() override; }; class IApplicationCreator final : public ServiceFramework { public: - IApplicationCreator(); + explicit IApplicationCreator(Core::System& system_); ~IApplicationCreator() override; }; class IProcessWindingController final : public ServiceFramework { public: - IProcessWindingController(); + explicit IProcessWindingController(Core::System& system_); ~IProcessWindingController() override; }; 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"}, diff --git a/src/core/hle/service/am/applet_ae.h b/src/core/hle/service/am/applet_ae.h index 761844a1f..adb207349 100644 --- a/src/core/hle/service/am/applet_ae.h +++ b/src/core/hle/service/am/applet_ae.h @@ -23,8 +23,8 @@ class AppletMessageQueue; class AppletAE final : public ServiceFramework { public: - explicit AppletAE(NVFlinger::NVFlinger& nvflinger, - std::shared_ptr msg_queue, Core::System& system); + explicit AppletAE(NVFlinger::NVFlinger& nvflinger_, + std::shared_ptr msg_queue_, Core::System& system_); ~AppletAE() override; const std::shared_ptr& GetMessageQueue() const; @@ -36,7 +36,6 @@ private: NVFlinger::NVFlinger& nvflinger; std::shared_ptr msg_queue; - Core::System& system; }; } // namespace AM diff --git a/src/core/hle/service/am/applet_oe.cpp b/src/core/hle/service/am/applet_oe.cpp index 7bed86ec4..f9eba8f52 100644 --- a/src/core/hle/service/am/applet_oe.cpp +++ b/src/core/hle/service/am/applet_oe.cpp @@ -12,10 +12,11 @@ namespace Service::AM { class IApplicationProxy final : public ServiceFramework { public: - explicit IApplicationProxy(NVFlinger::NVFlinger& nvflinger, - std::shared_ptr msg_queue, Core::System& system) - : ServiceFramework("IApplicationProxy"), nvflinger(nvflinger), - msg_queue(std::move(msg_queue)), system(system) { + explicit IApplicationProxy(NVFlinger::NVFlinger& nvflinger_, + std::shared_ptr msg_queue_, + Core::System& system_) + : ServiceFramework{system_, "IApplicationProxy"}, nvflinger{nvflinger_}, + msg_queue{std::move(msg_queue_)} { // clang-format off static const FunctionInfo functions[] = { {0, &IApplicationProxy::GetCommonStateGetter, "GetCommonStateGetter"}, @@ -39,7 +40,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface(); + rb.PushIpcInterface(system); } void GetDisplayController(Kernel::HLERequestContext& ctx) { @@ -47,7 +48,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface(); + rb.PushIpcInterface(system); } void GetDebugFunctions(Kernel::HLERequestContext& ctx) { @@ -55,7 +56,7 @@ private: IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface(); + rb.PushIpcInterface(system); } void GetWindowController(Kernel::HLERequestContext& ctx) { @@ -100,7 +101,6 @@ private: NVFlinger::NVFlinger& nvflinger; std::shared_ptr msg_queue; - Core::System& system; }; void AppletOE::OpenApplicationProxy(Kernel::HLERequestContext& ctx) { @@ -111,10 +111,10 @@ void AppletOE::OpenApplicationProxy(Kernel::HLERequestContext& ctx) { rb.PushIpcInterface(nvflinger, msg_queue, system); } -AppletOE::AppletOE(NVFlinger::NVFlinger& nvflinger, std::shared_ptr msg_queue, - Core::System& system) - : ServiceFramework("appletOE"), nvflinger(nvflinger), msg_queue(std::move(msg_queue)), - system(system) { +AppletOE::AppletOE(NVFlinger::NVFlinger& nvflinger_, std::shared_ptr msg_queue_, + Core::System& system_) + : ServiceFramework{system_, "appletOE"}, nvflinger{nvflinger_}, msg_queue{ + std::move(msg_queue_)} { static const FunctionInfo functions[] = { {0, &AppletOE::OpenApplicationProxy, "OpenApplicationProxy"}, }; diff --git a/src/core/hle/service/am/applet_oe.h b/src/core/hle/service/am/applet_oe.h index 88906d354..6c1aa255a 100644 --- a/src/core/hle/service/am/applet_oe.h +++ b/src/core/hle/service/am/applet_oe.h @@ -23,8 +23,8 @@ class AppletMessageQueue; class AppletOE final : public ServiceFramework { public: - explicit AppletOE(NVFlinger::NVFlinger& nvflinger, - std::shared_ptr msg_queue, Core::System& system); + explicit AppletOE(NVFlinger::NVFlinger& nvflinger_, + std::shared_ptr msg_queue_, Core::System& system_); ~AppletOE() override; const std::shared_ptr& GetMessageQueue() const; @@ -34,7 +34,6 @@ private: NVFlinger::NVFlinger& nvflinger; std::shared_ptr msg_queue; - Core::System& system; }; } // namespace AM diff --git a/src/core/hle/service/am/applets/controller.cpp b/src/core/hle/service/am/applets/controller.cpp index 3ca63f020..e8ea4248b 100644 --- a/src/core/hle/service/am/applets/controller.cpp +++ b/src/core/hle/service/am/applets/controller.cpp @@ -46,7 +46,7 @@ static Core::Frontend::ControllerParameters ConvertToFrontendParameters( } Controller::Controller(Core::System& system_, const Core::Frontend::ControllerApplet& frontend_) - : Applet{system_.Kernel()}, frontend(frontend_) {} + : Applet{system_.Kernel()}, frontend{frontend_}, system{system_} {} Controller::~Controller() = default; @@ -245,7 +245,7 @@ void Controller::ConfigurationComplete() { complete = true; out_data = std::vector(sizeof(ControllerSupportResultInfo)); std::memcpy(out_data.data(), &result_info, out_data.size()); - broker.PushNormalDataFromApplet(std::make_shared(std::move(out_data))); + broker.PushNormalDataFromApplet(std::make_shared(system, std::move(out_data))); broker.SignalStateChanged(); } diff --git a/src/core/hle/service/am/applets/controller.h b/src/core/hle/service/am/applets/controller.h index a7a1f2b65..d4c9da7b1 100644 --- a/src/core/hle/service/am/applets/controller.h +++ b/src/core/hle/service/am/applets/controller.h @@ -120,6 +120,7 @@ public: private: const Core::Frontend::ControllerApplet& frontend; + Core::System& system; ControllerAppletVersion controller_applet_version; ControllerSupportArgPrivate controller_private_arg; diff --git a/src/core/hle/service/am/applets/error.cpp b/src/core/hle/service/am/applets/error.cpp index f12fd7f89..dcd4b2a35 100644 --- a/src/core/hle/service/am/applets/error.cpp +++ b/src/core/hle/service/am/applets/error.cpp @@ -87,7 +87,7 @@ ResultCode Decode64BitError(u64 error) { } // Anonymous namespace Error::Error(Core::System& system_, const Core::Frontend::ErrorApplet& frontend_) - : Applet{system_.Kernel()}, frontend(frontend_), system{system_} {} + : Applet{system_.Kernel()}, frontend{frontend_}, system{system_} {} Error::~Error() = default; @@ -186,7 +186,7 @@ void Error::Execute() { void Error::DisplayCompleted() { complete = true; - broker.PushNormalDataFromApplet(std::make_shared(std::vector{})); + broker.PushNormalDataFromApplet(std::make_shared(system, std::vector{})); broker.SignalStateChanged(); } diff --git a/src/core/hle/service/am/applets/general_backend.cpp b/src/core/hle/service/am/applets/general_backend.cpp index 104501ac5..bdb6fd464 100644 --- a/src/core/hle/service/am/applets/general_backend.cpp +++ b/src/core/hle/service/am/applets/general_backend.cpp @@ -38,7 +38,7 @@ static void LogCurrentStorage(AppletDataBroker& broker, std::string_view prefix) } Auth::Auth(Core::System& system_, Core::Frontend::ParentalControlsApplet& frontend_) - : Applet{system_.Kernel()}, frontend(frontend_) {} + : Applet{system_.Kernel()}, frontend{frontend_}, system{system_} {} Auth::~Auth() = default; @@ -135,8 +135,8 @@ void Auth::Execute() { } } -void Auth::AuthFinished(bool successful) { - this->successful = successful; +void Auth::AuthFinished(bool is_successful) { + this->successful = is_successful; struct Return { ResultCode result_code; @@ -148,12 +148,12 @@ void Auth::AuthFinished(bool successful) { std::vector out(sizeof(Return)); std::memcpy(out.data(), &return_, sizeof(Return)); - broker.PushNormalDataFromApplet(std::make_shared(std::move(out))); + broker.PushNormalDataFromApplet(std::make_shared(system, std::move(out))); broker.SignalStateChanged(); } PhotoViewer::PhotoViewer(Core::System& system_, const Core::Frontend::PhotoViewerApplet& frontend_) - : Applet{system_.Kernel()}, frontend(frontend_), system{system_} {} + : Applet{system_.Kernel()}, frontend{frontend_}, system{system_} {} PhotoViewer::~PhotoViewer() = default; @@ -198,12 +198,12 @@ void PhotoViewer::Execute() { } void PhotoViewer::ViewFinished() { - broker.PushNormalDataFromApplet(std::make_shared(std::vector{})); + broker.PushNormalDataFromApplet(std::make_shared(system, std::vector{})); broker.SignalStateChanged(); } StubApplet::StubApplet(Core::System& system_, AppletId id_) - : Applet{system_.Kernel()}, id(id_), system{system_} {} + : Applet{system_.Kernel()}, id{id_}, system{system_} {} StubApplet::~StubApplet() = default; @@ -234,8 +234,9 @@ void StubApplet::ExecuteInteractive() { LOG_WARNING(Service_AM, "called (STUBBED)"); LogCurrentStorage(broker, "ExecuteInteractive"); - broker.PushNormalDataFromApplet(std::make_shared(std::vector(0x1000))); - broker.PushInteractiveDataFromApplet(std::make_shared(std::vector(0x1000))); + broker.PushNormalDataFromApplet(std::make_shared(system, std::vector(0x1000))); + broker.PushInteractiveDataFromApplet( + std::make_shared(system, std::vector(0x1000))); broker.SignalStateChanged(); } @@ -243,8 +244,9 @@ void StubApplet::Execute() { LOG_WARNING(Service_AM, "called (STUBBED)"); LogCurrentStorage(broker, "Execute"); - broker.PushNormalDataFromApplet(std::make_shared(std::vector(0x1000))); - broker.PushInteractiveDataFromApplet(std::make_shared(std::vector(0x1000))); + broker.PushNormalDataFromApplet(std::make_shared(system, std::vector(0x1000))); + broker.PushInteractiveDataFromApplet( + std::make_shared(system, std::vector(0x1000))); broker.SignalStateChanged(); } diff --git a/src/core/hle/service/am/applets/general_backend.h b/src/core/hle/service/am/applets/general_backend.h index cfa2df369..ba76ae3d3 100644 --- a/src/core/hle/service/am/applets/general_backend.h +++ b/src/core/hle/service/am/applets/general_backend.h @@ -29,10 +29,11 @@ public: void ExecuteInteractive() override; void Execute() override; - void AuthFinished(bool successful = true); + void AuthFinished(bool is_successful = true); private: Core::Frontend::ParentalControlsApplet& frontend; + Core::System& system; bool complete = false; bool successful = false; diff --git a/src/core/hle/service/am/applets/profile_select.cpp b/src/core/hle/service/am/applets/profile_select.cpp index 70cc23552..77fba16c7 100644 --- a/src/core/hle/service/am/applets/profile_select.cpp +++ b/src/core/hle/service/am/applets/profile_select.cpp @@ -17,7 +17,7 @@ constexpr ResultCode ERR_USER_CANCELLED_SELECTION{ErrorModule::Account, 1}; ProfileSelect::ProfileSelect(Core::System& system_, const Core::Frontend::ProfileSelectApplet& frontend_) - : Applet{system_.Kernel()}, frontend(frontend_) {} + : Applet{system_.Kernel()}, frontend{frontend_}, system{system_} {} ProfileSelect::~ProfileSelect() = default; @@ -50,7 +50,7 @@ void ProfileSelect::ExecuteInteractive() { void ProfileSelect::Execute() { if (complete) { - broker.PushNormalDataFromApplet(std::make_shared(std::move(final_data))); + broker.PushNormalDataFromApplet(std::make_shared(system, std::move(final_data))); return; } @@ -71,7 +71,7 @@ void ProfileSelect::SelectionComplete(std::optional uuid) { final_data = std::vector(sizeof(UserSelectionOutput)); std::memcpy(final_data.data(), &output, final_data.size()); - broker.PushNormalDataFromApplet(std::make_shared(std::move(final_data))); + broker.PushNormalDataFromApplet(std::make_shared(system, std::move(final_data))); broker.SignalStateChanged(); } diff --git a/src/core/hle/service/am/applets/profile_select.h b/src/core/hle/service/am/applets/profile_select.h index 16364ead7..648d33a24 100644 --- a/src/core/hle/service/am/applets/profile_select.h +++ b/src/core/hle/service/am/applets/profile_select.h @@ -53,6 +53,7 @@ private: bool complete = false; ResultCode status = RESULT_SUCCESS; std::vector final_data; + Core::System& system; }; } // namespace Service::AM::Applets diff --git a/src/core/hle/service/am/applets/software_keyboard.cpp b/src/core/hle/service/am/applets/software_keyboard.cpp index bdeb0737a..3022438b1 100644 --- a/src/core/hle/service/am/applets/software_keyboard.cpp +++ b/src/core/hle/service/am/applets/software_keyboard.cpp @@ -53,7 +53,7 @@ static Core::Frontend::SoftwareKeyboardParameters ConvertToFrontendParameters( SoftwareKeyboard::SoftwareKeyboard(Core::System& system_, const Core::Frontend::SoftwareKeyboardApplet& frontend_) - : Applet{system_.Kernel()}, frontend(frontend_) {} + : Applet{system_.Kernel()}, frontend{frontend_}, system{system_} {} SoftwareKeyboard::~SoftwareKeyboard() = default; @@ -122,7 +122,7 @@ void SoftwareKeyboard::ExecuteInteractive() { switch (request) { case Request::Calc: { - broker.PushNormalDataFromApplet(std::make_shared(std::vector{1})); + broker.PushNormalDataFromApplet(std::make_shared(system, std::vector{1})); broker.SignalStateChanged(); break; } @@ -135,7 +135,7 @@ void SoftwareKeyboard::ExecuteInteractive() { void SoftwareKeyboard::Execute() { if (complete) { - broker.PushNormalDataFromApplet(std::make_shared(std::move(final_data))); + broker.PushNormalDataFromApplet(std::make_shared(system, std::move(final_data))); broker.SignalStateChanged(); return; } @@ -179,15 +179,17 @@ void SoftwareKeyboard::WriteText(std::optional text) { final_data = output_main; if (complete) { - broker.PushNormalDataFromApplet(std::make_shared(std::move(output_main))); + broker.PushNormalDataFromApplet( + std::make_shared(system, std::move(output_main))); broker.SignalStateChanged(); } else { - broker.PushInteractiveDataFromApplet(std::make_shared(std::move(output_sub))); + broker.PushInteractiveDataFromApplet( + std::make_shared(system, std::move(output_sub))); } } else { output_main[0] = 1; complete = true; - broker.PushNormalDataFromApplet(std::make_shared(std::move(output_main))); + broker.PushNormalDataFromApplet(std::make_shared(system, std::move(output_main))); broker.SignalStateChanged(); } } diff --git a/src/core/hle/service/am/applets/software_keyboard.h b/src/core/hle/service/am/applets/software_keyboard.h index 5a3824b5a..1d260fef8 100644 --- a/src/core/hle/service/am/applets/software_keyboard.h +++ b/src/core/hle/service/am/applets/software_keyboard.h @@ -80,6 +80,7 @@ private: bool complete = false; bool is_inline = false; std::vector final_data; + Core::System& system; }; } // namespace Service::AM::Applets diff --git a/src/core/hle/service/am/applets/web_browser.cpp b/src/core/hle/service/am/applets/web_browser.cpp index efe595c4f..c3b6b706a 100644 --- a/src/core/hle/service/am/applets/web_browser.cpp +++ b/src/core/hle/service/am/applets/web_browser.cpp @@ -290,7 +290,7 @@ void WebBrowser::Finalize() { std::vector data(sizeof(WebCommonReturnValue)); std::memcpy(data.data(), &out, sizeof(WebCommonReturnValue)); - broker.PushNormalDataFromApplet(std::make_shared(std::move(data))); + broker.PushNormalDataFromApplet(std::make_shared(system, std::move(data))); broker.SignalStateChanged(); if (!temporary_dir.empty() && Common::FS::IsDirectory(temporary_dir)) { diff --git a/src/core/hle/service/am/idle.cpp b/src/core/hle/service/am/idle.cpp index d256d57c8..6196773d5 100644 --- a/src/core/hle/service/am/idle.cpp +++ b/src/core/hle/service/am/idle.cpp @@ -6,7 +6,7 @@ namespace Service::AM { -IdleSys::IdleSys() : ServiceFramework{"idle:sys"} { +IdleSys::IdleSys(Core::System& system_) : ServiceFramework{system_, "idle:sys"} { // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "GetAutoPowerDownEvent"}, diff --git a/src/core/hle/service/am/idle.h b/src/core/hle/service/am/idle.h index c44e856b1..e290c30b1 100644 --- a/src/core/hle/service/am/idle.h +++ b/src/core/hle/service/am/idle.h @@ -6,11 +6,15 @@ #include "core/hle/service/service.h" +namespace Core { +class System; +} + namespace Service::AM { class IdleSys final : public ServiceFramework { public: - explicit IdleSys(); + explicit IdleSys(Core::System& system_); ~IdleSys() override; }; diff --git a/src/core/hle/service/am/omm.cpp b/src/core/hle/service/am/omm.cpp index 37389ccda..55de67e1d 100644 --- a/src/core/hle/service/am/omm.cpp +++ b/src/core/hle/service/am/omm.cpp @@ -6,7 +6,7 @@ namespace Service::AM { -OMM::OMM() : ServiceFramework{"omm"} { +OMM::OMM(Core::System& system_) : ServiceFramework{system_, "omm"} { // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "GetOperationMode"}, diff --git a/src/core/hle/service/am/omm.h b/src/core/hle/service/am/omm.h index 59dc91b72..3766150fe 100644 --- a/src/core/hle/service/am/omm.h +++ b/src/core/hle/service/am/omm.h @@ -6,11 +6,15 @@ #include "core/hle/service/service.h" +namespace Core { +class System; +} + namespace Service::AM { class OMM final : public ServiceFramework { public: - explicit OMM(); + explicit OMM(Core::System& system_); ~OMM() override; }; diff --git a/src/core/hle/service/am/spsm.cpp b/src/core/hle/service/am/spsm.cpp index f27729ce7..95218d9ee 100644 --- a/src/core/hle/service/am/spsm.cpp +++ b/src/core/hle/service/am/spsm.cpp @@ -6,7 +6,7 @@ namespace Service::AM { -SPSM::SPSM() : ServiceFramework{"spsm"} { +SPSM::SPSM(Core::System& system_) : ServiceFramework{system_, "spsm"} { // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "GetState"}, diff --git a/src/core/hle/service/am/spsm.h b/src/core/hle/service/am/spsm.h index 3a0b979fa..04bbf9e68 100644 --- a/src/core/hle/service/am/spsm.h +++ b/src/core/hle/service/am/spsm.h @@ -6,11 +6,15 @@ #include "core/hle/service/service.h" +namespace Core { +class System; +} + namespace Service::AM { class SPSM final : public ServiceFramework { public: - explicit SPSM(); + explicit SPSM(Core::System& system_); ~SPSM() override; }; diff --git a/src/core/hle/service/am/tcap.cpp b/src/core/hle/service/am/tcap.cpp index a75cbdda8..4d0971c03 100644 --- a/src/core/hle/service/am/tcap.cpp +++ b/src/core/hle/service/am/tcap.cpp @@ -6,7 +6,7 @@ namespace Service::AM { -TCAP::TCAP() : ServiceFramework{"tcap"} { +TCAP::TCAP(Core::System& system_) : ServiceFramework{system_, "tcap"} { // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "GetContinuousHighSkinTemperatureEvent"}, diff --git a/src/core/hle/service/am/tcap.h b/src/core/hle/service/am/tcap.h index 2021b55d1..e9578f16e 100644 --- a/src/core/hle/service/am/tcap.h +++ b/src/core/hle/service/am/tcap.h @@ -6,11 +6,15 @@ #include "core/hle/service/service.h" +namespace Core { +class System; +} + namespace Service::AM { class TCAP final : public ServiceFramework { public: - explicit TCAP(); + explicit TCAP(Core::System& system_); ~TCAP() override; }; -- cgit v1.2.3