diff --git a/core/input/gamepad_device.cpp b/core/input/gamepad_device.cpp index 4213d42f1..a6fba966d 100644 --- a/core/input/gamepad_device.cpp +++ b/core/input/gamepad_device.cpp @@ -237,8 +237,11 @@ bool GamepadDevice::gamepad_axis_input(u32 code, int value) } else if ((key & DC_BTN_GROUP_MASK) == EMU_BUTTONS) // Map triggers to emu buttons { - // TODO hysteresis? - handleButtonInput(port, key, std::abs(v) >= 16384); + int lastValue = lastAxisValue[key]; + int newValue = std::abs(v); + if ((lastValue < 16384 && newValue >= 16384) || (lastValue >= 16384 && newValue < 16384)) + handleButtonInput(port, key, newValue >= 16384); + lastAxisValue[key] = newValue; } else return false; diff --git a/core/input/gamepad_device.h b/core/input/gamepad_device.h index 8d5fdaee9..3a73e6a3d 100644 --- a/core/input/gamepad_device.h +++ b/core/input/gamepad_device.h @@ -140,6 +140,7 @@ private: input_detected_cb _input_detected; bool _remappable; u32 digitalToAnalogState[4]; + std::map lastAxisValue; static std::vector> _gamepads; static std::mutex _gamepads_mutex; diff --git a/core/input/keyboard_device.h b/core/input/keyboard_device.h index 5155b1feb..8b995fe8a 100644 --- a/core/input/keyboard_device.h +++ b/core/input/keyboard_device.h @@ -41,6 +41,11 @@ public: set_button(DC_AXIS_RT, 25); // V set_button(EMU_BTN_MENU, 43); // TAB set_button(EMU_BTN_FFORWARD, 44); // Space + set_button(DC_AXIS_UP, 12); // I + set_button(DC_AXIS_DOWN, 14); // K + set_button(DC_AXIS_LEFT, 13); // J + set_button(DC_AXIS_RIGHT, 15); // L + set_button(DC_BTN_D, 4); // Q (Coin) dirty = false; }