GBA Input: Unbind axes at the appropriate time

This commit is contained in:
Jeffrey Pfau 2015-07-23 23:59:53 -07:00
parent e9c82df518
commit 500eeb7ee3
1 changed files with 2 additions and 1 deletions

View File

@ -366,7 +366,6 @@ void GBAInputUnbindKey(struct GBAInputMap* map, uint32_t type, enum GBAKey input
if (impl) {
impl->map[input] = GBA_NO_MAPPING;
}
TableEnumerate(&impl->axes, _unbindAxis, &input);
}
int GBAInputQueryBinding(const struct GBAInputMap* map, uint32_t type, enum GBAKey input) {
@ -420,6 +419,8 @@ int GBAInputClearAxis(const struct GBAInputMap* map, uint32_t type, int axis, in
void GBAInputBindAxis(struct GBAInputMap* map, uint32_t type, int axis, const struct GBAAxis* description) {
struct GBAInputMapImpl* impl = _guaranteeMap(map, type);
TableEnumerate(&impl->axes, _unbindAxis, &description->highDirection);
TableEnumerate(&impl->axes, _unbindAxis, &description->lowDirection);
struct GBAAxis* dup = malloc(sizeof(struct GBAAxis));
*dup = *description;
TableInsert(&impl->axes, axis, dup);