From 4a721e6a966b8749e67e851e68de0af419d164e1 Mon Sep 17 00:00:00 2001 From: Nomagno Date: Sun, 3 Aug 2025 22:11:14 +0200 Subject: [PATCH] Revert commit that broke digital bindings to analog axis. This reverts commit dd464af2e6d4c1e17e4ec450c4059c07af124aa7. --- src/input/device_config.hpp | 3 ++- src/input/gamepad_device.cpp | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/input/device_config.hpp b/src/input/device_config.hpp index fc3c5e6a470..d88fb34fce3 100644 --- a/src/input/device_config.hpp +++ b/src/input/device_config.hpp @@ -103,7 +103,8 @@ class DeviceConfig : public NoCopy virtual bool load(const XMLNode *config); // ------------------------------------------------------------------------ - /** Returns true if this device has an analog axis. */ + /** Returns true if this device has analog axis, so that steering values + * will not be affected by time-full-steer delays. */ virtual bool isAnalog(Input::InputType type, int id) const { return false;} // ------------------------------------------------------------------------ /** Returns true if this device should desensitize its input at values diff --git a/src/input/gamepad_device.cpp b/src/input/gamepad_device.cpp index ac9d7b78942..630be6c076a 100644 --- a/src/input/gamepad_device.cpp +++ b/src/input/gamepad_device.cpp @@ -146,6 +146,18 @@ bool GamePadDevice::processAndMapInput(Input::InputType type, const int id, { if (!m_configuration->isEnabled()) return false; + // A digital input value is 32767 or -32768 (which then triggers + // time-full-steer to be used to adjust actual steering values. + // To prevent this delay for analog gamesticks, make sure that + // 32767/-32768 are never used. + if(m_configuration->isAnalog(type, id)) + { + if(*value==32767) + *value = 32766; + else if(*value==-32768) + *value = -32767; + } + // Desensitizing means to map an input in the range x in [0,1] to // x^2. This results in changes close to 0 to have less impact // (less sensitive).