input: don't register multiple button presses when holding axis
keyboard: map left stick and coin button by default
This commit is contained in:
parent
51ad6094e8
commit
c419654a11
|
@ -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;
|
||||
|
|
|
@ -140,6 +140,7 @@ private:
|
|||
input_detected_cb _input_detected;
|
||||
bool _remappable;
|
||||
u32 digitalToAnalogState[4];
|
||||
std::map<DreamcastKey, int> lastAxisValue;
|
||||
|
||||
static std::vector<std::shared_ptr<GamepadDevice>> _gamepads;
|
||||
static std::mutex _gamepads_mutex;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue