diff options
author | Liam <byteslice@airmail.cc> | 2024-01-02 18:29:03 -0500 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2024-01-29 20:17:33 -0500 |
commit | 182137a9a4b09c8188d2cbffa312550c5dc83641 (patch) | |
tree | af62d2ecf774e7790c227cb0984e5392deca5afe /src/yuzu | |
parent | 3155f4e96d10904f4a207e465f20fb4b25043f5c (diff) |
am: migrate global state to per-applet state structure
Diffstat (limited to 'src/yuzu')
-rw-r--r-- | src/yuzu/configuration/configure_input.cpp | 17 | ||||
-rw-r--r-- | src/yuzu/main.cpp | 28 |
2 files changed, 4 insertions, 41 deletions
diff --git a/src/yuzu/configuration/configure_input.cpp b/src/yuzu/configuration/configure_input.cpp index 718534ba1..e28df10bd 100644 --- a/src/yuzu/configuration/configure_input.cpp +++ b/src/yuzu/configuration/configure_input.cpp @@ -9,6 +9,7 @@ #include "core/core.h" #include "core/hle/service/am/am.h" #include "core/hle/service/am/applet_ae.h" +#include "core/hle/service/am/applet_manager.h" #include "core/hle/service/am/applet_message_queue.h" #include "core/hle/service/am/applet_oe.h" #include "core/hle/service/sm/sm.h" @@ -48,22 +49,8 @@ void OnDockedModeChanged(bool last_state, bool new_state, Core::System& system) if (!system.IsPoweredOn()) { return; } - Service::SM::ServiceManager& sm = system.ServiceManager(); - // Message queue is shared between these services, we just need to signal an operation - // change to one and it will handle both automatically - auto applet_oe = sm.GetService<Service::AM::AppletOE>("appletOE"); - auto applet_ae = sm.GetService<Service::AM::AppletAE>("appletAE"); - bool has_signalled = false; - - if (applet_oe != nullptr) { - applet_oe->GetMessageQueue()->OperationModeChanged(); - has_signalled = true; - } - - if (applet_ae != nullptr && !has_signalled) { - applet_ae->GetMessageQueue()->OperationModeChanged(); - } + system.GetAppletManager().OperationModeChanged(); } ConfigureInput::ConfigureInput(Core::System& system_, QWidget* parent) diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 02508b20d..4e5c4da53 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -4783,36 +4783,12 @@ void GMainWindow::RequestGameExit() { return; } - auto& sm{system->ServiceManager()}; - auto applet_oe = sm.GetService<Service::AM::AppletOE>("appletOE"); - auto applet_ae = sm.GetService<Service::AM::AppletAE>("appletAE"); - bool has_signalled = false; - system->SetExitRequested(true); - - if (applet_oe != nullptr) { - applet_oe->GetMessageQueue()->RequestExit(); - has_signalled = true; - } - - if (applet_ae != nullptr && !has_signalled) { - applet_ae->GetMessageQueue()->RequestExit(); - } + system->GetAppletManager().RequestExit(); } void GMainWindow::RequestGameResume() { - auto& sm{system->ServiceManager()}; - auto applet_oe = sm.GetService<Service::AM::AppletOE>("appletOE"); - auto applet_ae = sm.GetService<Service::AM::AppletAE>("appletAE"); - - if (applet_oe != nullptr) { - applet_oe->GetMessageQueue()->RequestResume(); - return; - } - - if (applet_ae != nullptr) { - applet_ae->GetMessageQueue()->RequestResume(); - } + system->GetAppletManager().RequestResume(); } void GMainWindow::filterBarSetChecked(bool state) { |