Qt: Fix mapping analog triggers (fixes #495)
Vicki Pfau vi@endrift.com
Sun, 14 Oct 2018 14:17:43 -0700
5 files changed,
6 insertions(+),
14 deletions(-)
M
CHANGES
→
CHANGES
@@ -129,6 +129,7 @@ - GB, GBA Savedata: Fix leaks when loading masked save (fixes mgba.io/i/1197)
- Qt: Fix focus issues with load/save state overlay - GB Video: Fix SGB border hole size - PSP2: Fix tearing issues (fixes mgba.io/i/1211) + - Qt: Fix mapping analog triggers (fixes mgba.io/i/495) Misc: - mGUI: Add SGB border configuration option - mGUI: Add support for different settings types
M
src/platform/qt/GBAKeyEditor.cpp
→
src/platform/qt/GBAKeyEditor.cpp
@@ -278,13 +278,13 @@ GBAKeyEditor* self = static_cast<GBAKeyEditor*>(user);
if (description->highDirection != GBA_KEY_NONE) { KeyEditor* key = self->keyById(static_cast<enum GBAKey>(description->highDirection)); if (key) { - key->setValueAxis(axis, description->deadHigh); + key->setValueAxis(axis, GamepadAxisEvent::POSITIVE); } } if (description->lowDirection != GBA_KEY_NONE) { KeyEditor* key = self->keyById(static_cast<enum GBAKey>(description->lowDirection)); if (key) { - key->setValueAxis(axis, description->deadLow); + key->setValueAxis(axis, GamepadAxisEvent::NEGATIVE); } } }, this);@@ -350,14 +350,6 @@ return m_currentKey != m_keyOrder.end();
} #ifdef BUILD_SDL -void GBAKeyEditor::setAxisValue(int axis, int32_t value) { - if (!findFocus()) { - return; - } - KeyEditor* focused = *m_currentKey; - focused->setValueAxis(axis, value); -} - void GBAKeyEditor::selectGamepad(int index) { m_controller->setGamepad(m_type, index); m_profile = m_profileSelect->currentText();
M
src/platform/qt/GBAKeyEditor.h
→
src/platform/qt/GBAKeyEditor.h
@@ -42,7 +42,6 @@ private slots:
void setNext(); void refresh(); #ifdef BUILD_SDL - void setAxisValue(int axis, int32_t value); void selectGamepad(int index); void updateJoysticks(); #endif
M
src/platform/qt/KeyEditor.cpp
→
src/platform/qt/KeyEditor.cpp
@@ -48,10 +48,10 @@ m_button = true;
setValue(button); } -void KeyEditor::setValueAxis(int axis, int32_t value) { +void KeyEditor::setValueAxis(int axis, GamepadAxisEvent::Direction direction) { m_button = true; m_axis = axis; - m_direction = value < 0 ? GamepadAxisEvent::NEGATIVE : GamepadAxisEvent::POSITIVE; + m_direction = direction; updateButtonText(); emit axisChanged(axis, m_direction); }
M
src/platform/qt/KeyEditor.h
→
src/platform/qt/KeyEditor.h
@@ -33,7 +33,7 @@ public slots:
void setValue(int key); void setValueKey(int key); void setValueButton(int button); - void setValueAxis(int axis, int32_t value); + void setValueAxis(int axis, GamepadAxisEvent::Direction value); void setValueHat(int hat, GamepadHatEvent::Direction value); void clearButton(); void clearAxis();