mirror of https://github.com/mgba-emu/mgba.git
Qt: Fix some potential crashes with the gamepad mapping
This commit is contained in:
parent
1f76168317
commit
baccd4ef2f
1
CHANGES
1
CHANGES
|
@ -27,6 +27,7 @@ Bugfixes:
|
|||
- Util: Fix excessive memory allocation when decoding a PNG
|
||||
- GBA: Fix Iridion II savetype
|
||||
- Libretro: Fix aspect ratio
|
||||
- Qt: Fix some potential crashes with the gamepad mapping
|
||||
Misc:
|
||||
- Qt: Window size command line options are now supported
|
||||
- Qt: Increase usability of key mapper
|
||||
|
|
|
@ -280,7 +280,7 @@ void GBAKeyEditor::lookupAxes(const GBAInputMap* map) {
|
|||
|
||||
void GBAKeyEditor::bindKey(const KeyEditor* keyEditor, GBAKey key) {
|
||||
#ifdef BUILD_SDL
|
||||
if (m_type == SDL_BINDING_BUTTON) {
|
||||
if (m_type == SDL_BINDING_BUTTON && keyEditor->axis() >= 0) {
|
||||
m_controller->bindAxis(m_type, keyEditor->axis(), keyEditor->direction(), key);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -399,14 +399,19 @@ void InputController::bindAxis(uint32_t type, int axis, GamepadAxisEvent::Direct
|
|||
if (old) {
|
||||
description = *old;
|
||||
}
|
||||
int deadzone = 0;
|
||||
if (m_deadzones.size() > axis) {
|
||||
deadzone = m_deadzones[axis];
|
||||
}
|
||||
switch (direction) {
|
||||
case GamepadAxisEvent::NEGATIVE:
|
||||
description.lowDirection = key;
|
||||
description.deadLow = m_deadzones[axis] - AXIS_THRESHOLD;
|
||||
|
||||
description.deadLow = deadzone - AXIS_THRESHOLD;
|
||||
break;
|
||||
case GamepadAxisEvent::POSITIVE:
|
||||
description.highDirection = key;
|
||||
description.deadHigh = m_deadzones[axis] + AXIS_THRESHOLD;
|
||||
description.deadHigh = deadzone + AXIS_THRESHOLD;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue