mirror of https://github.com/mgba-emu/mgba.git
SDL: Allocate properly sized input maps
This commit is contained in:
parent
b079c3bd56
commit
924efefc38
1
CHANGES
1
CHANGES
|
@ -44,6 +44,7 @@ Bugfixes:
|
||||||
- Video: Fix an issue with very long filenames
|
- Video: Fix an issue with very long filenames
|
||||||
- SDL: Fix boundary conditions for joystick adjustments
|
- SDL: Fix boundary conditions for joystick adjustments
|
||||||
- Util: Fix a null-pointer issue when attempting to delete a key
|
- Util: Fix a null-pointer issue when attempting to delete a key
|
||||||
|
- SDL: Allocate properly sized input maps
|
||||||
Misc:
|
Misc:
|
||||||
- Qt: Show multiplayer numbers in window title
|
- Qt: Show multiplayer numbers in window title
|
||||||
- Qt: Handle saving input settings better
|
- Qt: Handle saving input settings better
|
||||||
|
|
|
@ -95,7 +95,7 @@ static struct GBAInputMapImpl* _guaranteeMap(struct GBAInputMap* map, uint32_t t
|
||||||
map->numMaps = 1;
|
map->numMaps = 1;
|
||||||
impl = &map->maps[0];
|
impl = &map->maps[0];
|
||||||
impl->type = type;
|
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);
|
TableInit(&impl->axes, 2, free);
|
||||||
} else {
|
} else {
|
||||||
impl = _lookupMap(map, type);
|
impl = _lookupMap(map, type);
|
||||||
|
@ -110,7 +110,7 @@ static struct GBAInputMapImpl* _guaranteeMap(struct GBAInputMap* map, uint32_t t
|
||||||
}
|
}
|
||||||
if (impl) {
|
if (impl) {
|
||||||
impl->type = type;
|
impl->type = type;
|
||||||
impl->map = calloc(GBA_KEY_MAX, sizeof(enum GBAKey));
|
impl->map = calloc(GBA_KEY_MAX, sizeof(int));
|
||||||
} else {
|
} else {
|
||||||
map->maps = realloc(map->maps, sizeof(*map->maps) * map->numMaps * 2);
|
map->maps = realloc(map->maps, sizeof(*map->maps) * map->numMaps * 2);
|
||||||
for (m = map->numMaps * 2 - 1; m > map->numMaps; --m) {
|
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;
|
map->numMaps *= 2;
|
||||||
impl = &map->maps[m];
|
impl = &map->maps[m];
|
||||||
impl->type = type;
|
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);
|
TableInit(&impl->axes, 2, free);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue