mirror of https://github.com/mgba-emu/mgba.git
Qt: Fix inability to clear hat bindings
This commit is contained in:
parent
b6bc8d54e3
commit
b20739093f
1
CHANGES
1
CHANGES
|
@ -93,6 +93,7 @@ Other fixes:
|
|||
- Qt: Fix crashing when no OpenGL context can be obtained
|
||||
- Qt: Fix issues with I/O viewer not properly synchronizing state
|
||||
- Qt: Fix loading a new game crashing on Wayland (fixes mgba.io/i/1992)
|
||||
- Qt: Fix inability to clear hat bindings
|
||||
- SM83: Simplify register pair access on big endian
|
||||
- SM83: Disassemble STOP as one byte
|
||||
- Wii: Fix crash on unloading irregularly sized GBA ROMs
|
||||
|
|
|
@ -541,7 +541,6 @@ void mInputBindHat(struct mInputMap* map, uint32_t type, int id, const struct mI
|
|||
*mInputHatListGetPointer(&impl->hats, id) = *bindings;
|
||||
}
|
||||
|
||||
|
||||
bool mInputQueryHat(const struct mInputMap* map, uint32_t type, int id, struct mInputHatBindings* bindings) {
|
||||
const struct mInputMapImpl* impl = _lookupMapConst(map, type);
|
||||
if (!impl) {
|
||||
|
@ -559,18 +558,23 @@ void mInputUnbindHat(struct mInputMap* map, uint32_t type, int id) {
|
|||
if (!impl) {
|
||||
return;
|
||||
}
|
||||
if (mInputHatListSize(&impl->hats) && id + 1 == (ssize_t) mInputHatListSize(&impl->hats)) {
|
||||
mInputHatListResize(&impl->hats, -1);
|
||||
} else {
|
||||
struct mInputHatBindings* description = mInputHatListGetPointer(&impl->hats, id);
|
||||
memset(description, -1, sizeof(*description));
|
||||
if (id >= (ssize_t) mInputHatListSize(&impl->hats)) {
|
||||
return;
|
||||
}
|
||||
struct mInputHatBindings* description = mInputHatListGetPointer(&impl->hats, id);
|
||||
memset(description, -1, sizeof(*description));
|
||||
}
|
||||
|
||||
void mInputUnbindAllHats(struct mInputMap* map, uint32_t type) {
|
||||
struct mInputMapImpl* impl = _lookupMap(map, type);
|
||||
if (impl) {
|
||||
mInputHatListClear(&impl->hats);
|
||||
if (!impl) {
|
||||
return;
|
||||
}
|
||||
|
||||
size_t id;
|
||||
for (id = 0; id < mInputHatListSize(&impl->hats); ++id) {
|
||||
struct mInputHatBindings* description = mInputHatListGetPointer(&impl->hats, id);
|
||||
memset(description, -1, sizeof(*description));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -215,6 +215,7 @@ void GBAKeyEditor::setNext() {
|
|||
void GBAKeyEditor::save() {
|
||||
#ifdef BUILD_SDL
|
||||
m_controller->unbindAllAxes(m_type);
|
||||
m_controller->unbindAllHats(m_type);
|
||||
#endif
|
||||
|
||||
bindKey(m_keyDU, GBA_KEY_UP);
|
||||
|
|
|
@ -569,6 +569,10 @@ void InputController::bindHat(uint32_t type, int hat, GamepadHatEvent::Direction
|
|||
mInputBindHat(&m_inputMap, type, hat, &bindings);
|
||||
}
|
||||
|
||||
void InputController::unbindAllHats(uint32_t type) {
|
||||
mInputUnbindAllHats(&m_inputMap, type);
|
||||
}
|
||||
|
||||
void InputController::testGamepad(int type) {
|
||||
QWriteLocker l(&m_eventsLock);
|
||||
auto activeAxes = activeGamepadAxes(type);
|
||||
|
|
|
@ -80,6 +80,7 @@ public:
|
|||
void unbindAllAxes(uint32_t type);
|
||||
|
||||
void bindHat(uint32_t type, int hat, GamepadHatEvent::Direction, GBAKey);
|
||||
void unbindAllHats(uint32_t type);
|
||||
|
||||
QStringList connectedGamepads(uint32_t type) const;
|
||||
int gamepad(uint32_t type) const;
|
||||
|
|
Loading…
Reference in New Issue