diff options
| author | Maran Br <maranbr@outlook.com> | 2024-03-21 11:20:49 +0000 |
|---|---|---|
| committer | JPikachu <jpikachu@noreply.localhost> | 2025-05-09 14:20:53 +0000 |
| commit | 8f5a65bdb09b3460cfe399b472f1ecadacfe0a50 (patch) | |
| tree | 91168a0f01c895dcb94b532abe024fc222faa71b /src/hid_core/frontend | |
| parent | aa333e6fb1b68dc15811bf7c858b20a0b07c8acc (diff) | |
Fixes second controller not detected in DKTF and possibly other games
Diffstat (limited to 'src/hid_core/frontend')
| -rw-r--r-- | src/hid_core/frontend/emulated_controller.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/hid_core/frontend/emulated_controller.cpp b/src/hid_core/frontend/emulated_controller.cpp index 9aa08d5cc9..5bdad4a0ad 100644 --- a/src/hid_core/frontend/emulated_controller.cpp +++ b/src/hid_core/frontend/emulated_controller.cpp @@ -760,11 +760,14 @@ void EmulatedController::StartMotionCalibration() { } } -void EmulatedController::SetButton(const Common::Input::CallbackStatus& callback, std::size_t index, - Common::UUID uuid) { - if (index >= controller.button_values.size()) { +void EmulatedController::SetButton(const Common::Input::CallbackStatus& callback, std::size_t index, Common::UUID uuid) { + const auto player_index = Service::HID::NpadIdTypeToIndex(npad_id_type); + const auto& player = Settings::values.players.GetValue()[player_index]; + + if (index >= controller.button_values.size()) { return; } + std::unique_lock lock{mutex}; bool value_changed = false; const auto new_status = TransformToButton(callback); @@ -917,13 +920,8 @@ void EmulatedController::SetButton(const Common::Input::CallbackStatus& callback lock.unlock(); - if (!is_connected) { - if (npad_id_type == NpadIdType::Player1 && npad_type != NpadStyleIndex::Handheld) { - Connect(); - } - if (npad_id_type == NpadIdType::Handheld && npad_type == NpadStyleIndex::Handheld) { - Connect(); - } + if (player.connected) { + Connect(); } TriggerOnChange(ControllerTriggerType::Button, true); } |
