From 1d9d628855eac2953c5bc8bcbd36f8f1b1d98361 Mon Sep 17 00:00:00 2001 From: "auria.mg" Date: Mon, 15 Jan 2018 20:52:53 -0500 Subject: [PATCH 1/2] Try to fix #3099 --- src/input/device_manager.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/input/device_manager.cpp b/src/input/device_manager.cpp index 069121c3b..0e82bfbaf 100644 --- a/src/input/device_manager.cpp +++ b/src/input/device_manager.cpp @@ -388,6 +388,13 @@ InputDevice *DeviceManager::mapGamepadInput(Input::InputType type, if (gPad != NULL) { + // Ignore deadzone events if this isn't the latest used device + if (m_latest_used_device != gPad && *value > -250 && *value < 250 /* TODO: use deadzone config */) + { + *player = NULL; + return NULL; + } + if (gPad->processAndMapInput(type, button_id, mode, action, value)) { if (m_single_player != NULL) From 10831b210e0d232f00373a1d481c9017d55f65d1 Mon Sep 17 00:00:00 2001 From: "auria.mg" Date: Mon, 15 Jan 2018 20:58:05 -0500 Subject: [PATCH 2/2] Improve fix for #3099 --- src/input/device_manager.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/input/device_manager.cpp b/src/input/device_manager.cpp index 0e82bfbaf..eb5f77d06 100644 --- a/src/input/device_manager.cpp +++ b/src/input/device_manager.cpp @@ -388,8 +388,11 @@ InputDevice *DeviceManager::mapGamepadInput(Input::InputType type, if (gPad != NULL) { - // Ignore deadzone events if this isn't the latest used device - if (m_latest_used_device != gPad && *value > -250 && *value < 250 /* TODO: use deadzone config */) + // Ignore deadzone events if this isn't the latest used device in + // single-player mode (allowing the player to switch device at any time) + int dz = static_cast(gPad->getConfiguration())->getDeadzone(); + if (m_single_player != NULL && m_latest_used_device != gPad + && *value > -dz && *value < dz) { *player = NULL; return NULL;