From cdf2ad1e13056f98d44ca60510567a7bbc7b14ee Mon Sep 17 00:00:00 2001 From: Thomas Jentzsch Date: Mon, 23 Dec 2019 17:08:51 +0100 Subject: [PATCH] fix for #552 (analog/digital part) (TODO: test!) --- src/common/PJoystickHandler.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/common/PJoystickHandler.cxx b/src/common/PJoystickHandler.cxx index e6e4cfba2..88e3eff6d 100644 --- a/src/common/PJoystickHandler.cxx +++ b/src/common/PJoystickHandler.cxx @@ -615,12 +615,13 @@ void PhysicalJoystickHandler::handleAxisEvent(int stick, int axis, int value) if(myHandler.state() == EventHandlerState::EMULATION) { + Event::Type eventAxisAnalog; + // Check for analog events, which are handled differently // A value change lower than ~90% indicates analog input - if(abs(j->axisLastValue[axis] - value) < 30000) + if((abs(j->axisLastValue[axis] - value) < 30000) + && (eventAxisAnalog = j->joyMap.get(EventMode::kEmulationMode, button, JoyAxis(axis), JoyDir::ANALOG)) != Event::Type::NoType) { - Event::Type eventAxisAnalog = j->joyMap.get(EventMode::kEmulationMode, button, JoyAxis(axis), JoyDir::ANALOG); - myHandler.handleEvent(eventAxisAnalog, value); } else