diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/configuration/configure_input_player.cpp | 15 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input_simple.cpp | 9 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_mouse_advanced.cpp | 15 |
3 files changed, 21 insertions, 18 deletions
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp index 96dec50e2..15ac30f12 100644 --- a/src/yuzu/configuration/configure_input_player.cpp +++ b/src/yuzu/configuration/configure_input_player.cpp | |||
| @@ -541,18 +541,19 @@ void ConfigureInputPlayer::HandleClick( | |||
| 541 | button->setText(tr("[press key]")); | 541 | button->setText(tr("[press key]")); |
| 542 | button->setFocus(); | 542 | button->setFocus(); |
| 543 | 543 | ||
| 544 | const auto iter = std::find(button_map.begin(), button_map.end(), button); | 544 | // Keyboard keys can only be used as button devices |
| 545 | ASSERT(iter != button_map.end()); | 545 | want_keyboard_keys = type == InputCommon::Polling::DeviceType::Button; |
| 546 | const auto index = std::distance(button_map.begin(), iter); | 546 | if (want_keyboard_keys) { |
| 547 | ASSERT(index < Settings::NativeButton::NumButtons && index >= 0); | 547 | const auto iter = std::find(button_map.begin(), button_map.end(), button); |
| 548 | ASSERT(iter != button_map.end()); | ||
| 549 | const auto index = std::distance(button_map.begin(), iter); | ||
| 550 | ASSERT(index < Settings::NativeButton::NumButtons && index >= 0); | ||
| 551 | } | ||
| 548 | 552 | ||
| 549 | input_setter = new_input_setter; | 553 | input_setter = new_input_setter; |
| 550 | 554 | ||
| 551 | device_pollers = InputCommon::Polling::GetPollers(type); | 555 | device_pollers = InputCommon::Polling::GetPollers(type); |
| 552 | 556 | ||
| 553 | // Keyboard keys can only be used as button devices | ||
| 554 | want_keyboard_keys = type == InputCommon::Polling::DeviceType::Button; | ||
| 555 | |||
| 556 | for (auto& poller : device_pollers) { | 557 | for (auto& poller : device_pollers) { |
| 557 | poller->Start(); | 558 | poller->Start(); |
| 558 | } | 559 | } |
diff --git a/src/yuzu/configuration/configure_input_simple.cpp b/src/yuzu/configuration/configure_input_simple.cpp index ab3a11d30..0e0e8f113 100644 --- a/src/yuzu/configuration/configure_input_simple.cpp +++ b/src/yuzu/configuration/configure_input_simple.cpp | |||
| @@ -35,6 +35,7 @@ void CallConfigureDialog(ConfigureInputSimple* caller, Args&&... args) { | |||
| 35 | // - Open any dialogs | 35 | // - Open any dialogs |
| 36 | // - Block in any way | 36 | // - Block in any way |
| 37 | 37 | ||
| 38 | constexpr std::size_t PLAYER_0_INDEX = 0; | ||
| 38 | constexpr std::size_t HANDHELD_INDEX = 8; | 39 | constexpr std::size_t HANDHELD_INDEX = 8; |
| 39 | 40 | ||
| 40 | void HandheldOnProfileSelect() { | 41 | void HandheldOnProfileSelect() { |
| @@ -53,8 +54,8 @@ void HandheldOnProfileSelect() { | |||
| 53 | } | 54 | } |
| 54 | 55 | ||
| 55 | void DualJoyconsDockedOnProfileSelect() { | 56 | void DualJoyconsDockedOnProfileSelect() { |
| 56 | Settings::values.players[0].connected = true; | 57 | Settings::values.players[PLAYER_0_INDEX].connected = true; |
| 57 | Settings::values.players[0].type = Settings::ControllerType::DualJoycon; | 58 | Settings::values.players[PLAYER_0_INDEX].type = Settings::ControllerType::DualJoycon; |
| 58 | 59 | ||
| 59 | for (std::size_t player = 1; player <= HANDHELD_INDEX; ++player) { | 60 | for (std::size_t player = 1; player <= HANDHELD_INDEX; ++player) { |
| 60 | Settings::values.players[player].connected = false; | 61 | Settings::values.players[player].connected = false; |
| @@ -64,7 +65,7 @@ void DualJoyconsDockedOnProfileSelect() { | |||
| 64 | Settings::values.keyboard_enabled = false; | 65 | Settings::values.keyboard_enabled = false; |
| 65 | Settings::values.mouse_enabled = false; | 66 | Settings::values.mouse_enabled = false; |
| 66 | Settings::values.debug_pad_enabled = false; | 67 | Settings::values.debug_pad_enabled = false; |
| 67 | Settings::values.touchscreen.enabled = false; | 68 | Settings::values.touchscreen.enabled = true; |
| 68 | } | 69 | } |
| 69 | 70 | ||
| 70 | // Name, OnProfileSelect (called when selected in drop down), OnConfigure (called when configure | 71 | // Name, OnProfileSelect (called when selected in drop down), OnConfigure (called when configure |
| @@ -78,7 +79,7 @@ constexpr std::array<InputProfile, 3> INPUT_PROFILES{{ | |||
| 78 | }}, | 79 | }}, |
| 79 | {QT_TR_NOOP("Single Player - Dual Joycons - Docked"), DualJoyconsDockedOnProfileSelect, | 80 | {QT_TR_NOOP("Single Player - Dual Joycons - Docked"), DualJoyconsDockedOnProfileSelect, |
| 80 | [](ConfigureInputSimple* caller) { | 81 | [](ConfigureInputSimple* caller) { |
| 81 | CallConfigureDialog<ConfigureInputPlayer>(caller, 1, false); | 82 | CallConfigureDialog<ConfigureInputPlayer>(caller, PLAYER_0_INDEX, false); |
| 82 | }}, | 83 | }}, |
| 83 | {QT_TR_NOOP("Custom"), [] {}, CallConfigureDialog<ConfigureInput>}, | 84 | {QT_TR_NOOP("Custom"), [] {}, CallConfigureDialog<ConfigureInput>}, |
| 84 | }}; | 85 | }}; |
diff --git a/src/yuzu/configuration/configure_mouse_advanced.cpp b/src/yuzu/configuration/configure_mouse_advanced.cpp index 0a4abe34f..e0647ea5b 100644 --- a/src/yuzu/configuration/configure_mouse_advanced.cpp +++ b/src/yuzu/configuration/configure_mouse_advanced.cpp | |||
| @@ -184,18 +184,19 @@ void ConfigureMouseAdvanced::HandleClick( | |||
| 184 | button->setText(tr("[press key]")); | 184 | button->setText(tr("[press key]")); |
| 185 | button->setFocus(); | 185 | button->setFocus(); |
| 186 | 186 | ||
| 187 | const auto iter = std::find(button_map.begin(), button_map.end(), button); | 187 | // Keyboard keys can only be used as button devices |
| 188 | ASSERT(iter != button_map.end()); | 188 | want_keyboard_keys = type == InputCommon::Polling::DeviceType::Button; |
| 189 | const auto index = std::distance(button_map.begin(), iter); | 189 | if (want_keyboard_keys) { |
| 190 | ASSERT(index < Settings::NativeButton::NumButtons && index >= 0); | 190 | const auto iter = std::find(button_map.begin(), button_map.end(), button); |
| 191 | ASSERT(iter != button_map.end()); | ||
| 192 | const auto index = std::distance(button_map.begin(), iter); | ||
| 193 | ASSERT(index < Settings::NativeButton::NumButtons && index >= 0); | ||
| 194 | } | ||
| 191 | 195 | ||
| 192 | input_setter = new_input_setter; | 196 | input_setter = new_input_setter; |
| 193 | 197 | ||
| 194 | device_pollers = InputCommon::Polling::GetPollers(type); | 198 | device_pollers = InputCommon::Polling::GetPollers(type); |
| 195 | 199 | ||
| 196 | // Keyboard keys can only be used as button devices | ||
| 197 | want_keyboard_keys = type == InputCommon::Polling::DeviceType::Button; | ||
| 198 | |||
| 199 | for (auto& poller : device_pollers) { | 200 | for (auto& poller : device_pollers) { |
| 200 | poller->Start(); | 201 | poller->Start(); |
| 201 | } | 202 | } |