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