diff options
| author | 2018-12-04 22:01:01 -0500 | |
|---|---|---|
| committer | 2018-12-05 14:05:57 -0500 | |
| commit | c07059e7fdead17b47acea02ab1a6ac13c8f4d9c (patch) | |
| tree | 8598abb9cdc8da336307f130a48a140aa56db9b6 /src | |
| parent | configure_input: Add ConfigureInputSimple as default input UI config (diff) | |
| download | yuzu-c07059e7fdead17b47acea02ab1a6ac13c8f4d9c.tar.gz yuzu-c07059e7fdead17b47acea02ab1a6ac13c8f4d9c.tar.xz yuzu-c07059e7fdead17b47acea02ab1a6ac13c8f4d9c.zip | |
configure_input_simple: Properly signal docked mode change
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/configuration/configure_input.cpp | 58 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input.h | 4 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input_simple.cpp | 2 |
3 files changed, 31 insertions, 33 deletions
diff --git a/src/yuzu/configuration/configure_input.cpp b/src/yuzu/configuration/configure_input.cpp index 3e78802ce..f39d57998 100644 --- a/src/yuzu/configuration/configure_input.cpp +++ b/src/yuzu/configuration/configure_input.cpp | |||
| @@ -20,6 +20,33 @@ | |||
| 20 | #include "yuzu/configuration/configure_input_player.h" | 20 | #include "yuzu/configuration/configure_input_player.h" |
| 21 | #include "yuzu/configuration/configure_mouse_advanced.h" | 21 | #include "yuzu/configuration/configure_mouse_advanced.h" |
| 22 | 22 | ||
| 23 | void OnDockedModeChanged(bool last_state, bool new_state) { | ||
| 24 | if (last_state == new_state) { | ||
| 25 | return; | ||
| 26 | } | ||
| 27 | |||
| 28 | Core::System& system{Core::System::GetInstance()}; | ||
| 29 | if (!system.IsPoweredOn()) { | ||
| 30 | return; | ||
| 31 | } | ||
| 32 | Service::SM::ServiceManager& sm = system.ServiceManager(); | ||
| 33 | |||
| 34 | // Message queue is shared between these services, we just need to signal an operation | ||
| 35 | // change to one and it will handle both automatically | ||
| 36 | auto applet_oe = sm.GetService<Service::AM::AppletOE>("appletOE"); | ||
| 37 | auto applet_ae = sm.GetService<Service::AM::AppletAE>("appletAE"); | ||
| 38 | bool has_signalled = false; | ||
| 39 | |||
| 40 | if (applet_oe != nullptr) { | ||
| 41 | applet_oe->GetMessageQueue()->OperationModeChanged(); | ||
| 42 | has_signalled = true; | ||
| 43 | } | ||
| 44 | |||
| 45 | if (applet_ae != nullptr && !has_signalled) { | ||
| 46 | applet_ae->GetMessageQueue()->OperationModeChanged(); | ||
| 47 | } | ||
| 48 | } | ||
| 49 | |||
| 23 | namespace { | 50 | namespace { |
| 24 | template <typename Dialog, typename... Args> | 51 | template <typename Dialog, typename... Args> |
| 25 | void CallConfigureDialog(ConfigureInput& parent, Args&&... args) { | 52 | void CallConfigureDialog(ConfigureInput& parent, Args&&... args) { |
| @@ -90,37 +117,6 @@ ConfigureInput::ConfigureInput(QWidget* parent) | |||
| 90 | 117 | ||
| 91 | ConfigureInput::~ConfigureInput() = default; | 118 | ConfigureInput::~ConfigureInput() = default; |
| 92 | 119 | ||
| 93 | void ConfigureInput::OnDockedModeChanged(bool last_state, bool new_state) { | ||
| 94 | if (ui->use_docked_mode->isChecked() && ui->handheld_connected->isChecked()) { | ||
| 95 | ui->handheld_connected->setChecked(false); | ||
| 96 | } | ||
| 97 | |||
| 98 | if (last_state == new_state) { | ||
| 99 | return; | ||
| 100 | } | ||
| 101 | |||
| 102 | Core::System& system{Core::System::GetInstance()}; | ||
| 103 | if (!system.IsPoweredOn()) { | ||
| 104 | return; | ||
| 105 | } | ||
| 106 | Service::SM::ServiceManager& sm = system.ServiceManager(); | ||
| 107 | |||
| 108 | // Message queue is shared between these services, we just need to signal an operation | ||
| 109 | // change to one and it will handle both automatically | ||
| 110 | auto applet_oe = sm.GetService<Service::AM::AppletOE>("appletOE"); | ||
| 111 | auto applet_ae = sm.GetService<Service::AM::AppletAE>("appletAE"); | ||
| 112 | bool has_signalled = false; | ||
| 113 | |||
| 114 | if (applet_oe != nullptr) { | ||
| 115 | applet_oe->GetMessageQueue()->OperationModeChanged(); | ||
| 116 | has_signalled = true; | ||
| 117 | } | ||
| 118 | |||
| 119 | if (applet_ae != nullptr && !has_signalled) { | ||
| 120 | applet_ae->GetMessageQueue()->OperationModeChanged(); | ||
| 121 | } | ||
| 122 | } | ||
| 123 | |||
| 124 | void ConfigureInput::applyConfiguration() { | 120 | void ConfigureInput::applyConfiguration() { |
| 125 | for (std::size_t i = 0; i < players_controller.size(); ++i) { | 121 | for (std::size_t i = 0; i < players_controller.size(); ++i) { |
| 126 | const auto controller_type_index = players_controller[i]->currentIndex(); | 122 | const auto controller_type_index = players_controller[i]->currentIndex(); |
diff --git a/src/yuzu/configuration/configure_input.h b/src/yuzu/configuration/configure_input.h index b5005e3ea..b8e62cc2b 100644 --- a/src/yuzu/configuration/configure_input.h +++ b/src/yuzu/configuration/configure_input.h | |||
| @@ -20,6 +20,8 @@ namespace Ui { | |||
| 20 | class ConfigureInput; | 20 | class ConfigureInput; |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | void OnDockedModeChanged(bool last_state, bool new_state); | ||
| 24 | |||
| 23 | class ConfigureInput : public QDialog { | 25 | class ConfigureInput : public QDialog { |
| 24 | Q_OBJECT | 26 | Q_OBJECT |
| 25 | 27 | ||
| @@ -33,8 +35,6 @@ public: | |||
| 33 | private: | 35 | private: |
| 34 | void updateUIEnabled(); | 36 | void updateUIEnabled(); |
| 35 | 37 | ||
| 36 | void OnDockedModeChanged(bool last_state, bool new_state); | ||
| 37 | |||
| 38 | /// Load configuration settings. | 38 | /// Load configuration settings. |
| 39 | void loadConfiguration(); | 39 | void loadConfiguration(); |
| 40 | /// Restore all buttons to their default values. | 40 | /// Restore all buttons to their default values. |
diff --git a/src/yuzu/configuration/configure_input_simple.cpp b/src/yuzu/configuration/configure_input_simple.cpp index 10c804388..b4f3724bd 100644 --- a/src/yuzu/configuration/configure_input_simple.cpp +++ b/src/yuzu/configuration/configure_input_simple.cpp | |||
| @@ -132,7 +132,9 @@ void ConfigureInputSimple::loadConfiguration() { | |||
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | void ConfigureInputSimple::OnSelectProfile(int index) { | 134 | void ConfigureInputSimple::OnSelectProfile(int index) { |
| 135 | const auto old_docked = Settings::values.use_docked_mode; | ||
| 135 | ApplyInputProfileConfiguration(index); | 136 | ApplyInputProfileConfiguration(index); |
| 137 | OnDockedModeChanged(old_docked, Settings::values.use_docked_mode); | ||
| 136 | } | 138 | } |
| 137 | 139 | ||
| 138 | void ConfigureInputSimple::OnConfigure() { | 140 | void ConfigureInputSimple::OnConfigure() { |