all repos — mgba @ 924efefc3839a3745bf9e4e6da419bacdda9b4ef

mGBA Game Boy Advance Emulator

SDL: Allocate properly sized input maps
Jeffrey Pfau jeffrey@endrift.com
Wed, 06 May 2015 01:19:27 -0700
commit

924efefc3839a3745bf9e4e6da419bacdda9b4ef

parent

b079c3bd56a59e7303c94cfb22a6a20345a982d6

2 files changed, 4 insertions(+), 3 deletions(-)

jump to
M CHANGESCHANGES

@@ -44,6 +44,7 @@ - Debugger: Fix boundary conditions in tab completion

- Video: Fix an issue with very long filenames - SDL: Fix boundary conditions for joystick adjustments - Util: Fix a null-pointer issue when attempting to delete a key + - SDL: Allocate properly sized input maps Misc: - Qt: Show multiplayer numbers in window title - Qt: Handle saving input settings better
M src/gba/input.csrc/gba/input.c

@@ -95,7 +95,7 @@ map->maps = malloc(sizeof(*map->maps));

map->numMaps = 1; impl = &map->maps[0]; impl->type = type; - impl->map = calloc(GBA_KEY_MAX, sizeof(enum GBAKey)); + impl->map = calloc(GBA_KEY_MAX, sizeof(int)); TableInit(&impl->axes, 2, free); } else { impl = _lookupMap(map, type);

@@ -110,7 +110,7 @@ }

} if (impl) { impl->type = type; - impl->map = calloc(GBA_KEY_MAX, sizeof(enum GBAKey)); + impl->map = calloc(GBA_KEY_MAX, sizeof(int)); } else { map->maps = realloc(map->maps, sizeof(*map->maps) * map->numMaps * 2); for (m = map->numMaps * 2 - 1; m > map->numMaps; --m) {

@@ -120,7 +120,7 @@ }

map->numMaps *= 2; impl = &map->maps[m]; impl->type = type; - impl->map = calloc(GBA_KEY_MAX, sizeof(enum GBAKey)); + impl->map = calloc(GBA_KEY_MAX, sizeof(int)); } TableInit(&impl->axes, 2, free); }