VERY experimental Nintendo Switch 2 emulator
C++
configure_input_simple: Properly signal docked mode change
Zach Hilman885644cdcfcc
diff --git a/src/yuzu/configuration/configure_input.cpp b/src/yuzu/configuration/configure_input.cppindex 3e78802ce3..f39d57998a 100644--- a/src/yuzu/configuration/configure_input.cpp+++ b/src/yuzu/configuration/configure_input.cpp@@ -20,6 +20,33 @@#include "yuzu/configuration/configure_input_player.h"#include "yuzu/configuration/configure_mouse_advanced.h"+void OnDockedModeChanged(bool last_state, bool new_state) {+ if (last_state == new_state) {+ return;+ }++ Core::System& system{Core::System::GetInstance()};+ 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();+ }+}+namespace {template <typename Dialog, typename... Args>void CallConfigureDialog(ConfigureInput& parent, Args&&... args) {@@ -90,37 +117,6 @@ ConfigureInput::ConfigureInput(QWidget* parent)ConfigureInput::~ConfigureInput() = default;-void ConfigureInput::OnDockedModeChanged(bool last_state, bool new_state) {- if (ui->use_docked_mode->isChecked() && ui->handheld_connected->isChecked()) {- ui->handheld_connected->setChecked(false);- }-- if (last_state == new_state) {- return;- }-- Core::System& system{Core::System::GetInstance()};- 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();- }-}-void ConfigureInput::applyConfiguration() {for (std::size_t i = 0; i < players_controller.size(); ++i) {const auto controller_type_index = players_controller[i]->currentIndex();diff --git a/src/yuzu/configuration/configure_input.h b/src/yuzu/configuration/configure_input.hindex b5005e3ea6..b8e62cc2b6 100644--- a/src/yuzu/configuration/configure_input.h+++ b/src/yuzu/configuration/configure_input.h@@ -20,6 +20,8 @@ namespace Ui {class ConfigureInput;}+void OnDockedModeChanged(bool last_state, bool new_state);+class ConfigureInput : public QDialog {Q_OBJECT@@ -33,8 +35,6 @@ public:private:void updateUIEnabled();- void OnDockedModeChanged(bool last_state, bool new_state);-/// Load configuration settings.void loadConfiguration();/// Restore all buttons to their default values.diff --git a/src/yuzu/configuration/configure_input_simple.cpp b/src/yuzu/configuration/configure_input_simple.cppindex 10c804388f..b4f3724bd6 100644--- a/src/yuzu/configuration/configure_input_simple.cpp+++ b/src/yuzu/configuration/configure_input_simple.cpp@@ -132,7 +132,9 @@ void ConfigureInputSimple::loadConfiguration() {}void ConfigureInputSimple::OnSelectProfile(int index) {+ const auto old_docked = Settings::values.use_docked_mode;ApplyInputProfileConfiguration(index);+ OnDockedModeChanged(old_docked, Settings::values.use_docked_mode);}void ConfigureInputSimple::OnConfigure() {