SDL: Allocate properly sized input maps

This commit is contained in:
Jeffrey Pfau 2015-05-06 01:19:27 -07:00
parent b079c3bd56
commit 924efefc38
2 changed files with 4 additions and 3 deletions

View File

@ -44,6 +44,7 @@ Bugfixes:
- 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

View File

@ -95,7 +95,7 @@ static struct GBAInputMapImpl* _guaranteeMap(struct GBAInputMap* map, uint32_t t
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 @@ static struct GBAInputMapImpl* _guaranteeMap(struct GBAInputMap* map, uint32_t t
}
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 @@ static struct GBAInputMapImpl* _guaranteeMap(struct GBAInputMap* map, uint32_t t
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);
}