aboutsummaryrefslogtreecommitdiff
path: root/src/hid_core/frontend/emulated_controller.cpp
diff options
context:
space:
mode:
authorMaranBr <maranbr@outlook.com>2025-10-16 20:33:38 +0200
committercrueter <crueter@eden-emu.dev>2025-10-16 20:33:38 +0200
commitb7021afff6c32cc832f891fbf07aedd92b6ddf76 (patch)
tree781b4d65d5fcde6b889a805d730f54db9899bcf1 /src/hid_core/frontend/emulated_controller.cpp
parentbfc10723bc175ee9cf5671c95ed51d41d4449485 (diff)
[hid_core] Quick fix for PR 2747 (#2753)
Ensures that only the controllers enabled in the settings remain active when the game is running. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2753 Reviewed-by: Lizzie <lizzie@eden-emu.dev> Co-authored-by: MaranBr <maranbr@outlook.com> Co-committed-by: MaranBr <maranbr@outlook.com>
Diffstat (limited to 'src/hid_core/frontend/emulated_controller.cpp')
-rw-r--r--src/hid_core/frontend/emulated_controller.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/hid_core/frontend/emulated_controller.cpp b/src/hid_core/frontend/emulated_controller.cpp
index 6c1fc63821..37a892c37f 100644
--- a/src/hid_core/frontend/emulated_controller.cpp
+++ b/src/hid_core/frontend/emulated_controller.cpp
@@ -765,9 +765,13 @@ void EmulatedController::StartMotionCalibration() {
void EmulatedController::SetButton(const Common::Input::CallbackStatus& callback, std::size_t index,
Common::UUID uuid) {
- if (index >= controller.button_values.size()) {
+ 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);
@@ -920,10 +924,11 @@ void EmulatedController::SetButton(const Common::Input::CallbackStatus& callback
lock.unlock();
- const auto player_index = Service::HID::NpadIdTypeToIndex(npad_id_type);
if (!is_connected && !controller_connected[player_index]) {
- Connect();
- controller_connected[player_index] = true;
+ if (player.connected) {
+ Connect();
+ controller_connected[player_index] = true;
+ }
}
TriggerOnChange(ControllerTriggerType::Button, true);