diff options
author | Michael Pavone <pavone@retrodev.com> | 2018-07-31 23:19:39 -0700 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2018-07-31 23:19:39 -0700 |
commit | e6728f5077492ff5bbf48890b263d1cbf972626a (patch) | |
tree | a2e33ea2bb86ebf4740b1fede27c581b34e28881 /controller_info.c | |
parent | d6335f0431dd0b57207922bfaf26a65dcc84154b (diff) |
Don't redundantly store controller GUID when saving a mapping. Remove illegal chars from controller name
Diffstat (limited to 'controller_info.c')
-rw-r--r-- | controller_info.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/controller_info.c b/controller_info.c index 12c90b3..c9ca1c7 100644 --- a/controller_info.c +++ b/controller_info.c @@ -2,6 +2,7 @@ #include "render_sdl.h" #include "controller_info.h" #include "config.h" +#include "util.h" typedef struct { char const *name; @@ -150,14 +151,19 @@ static void mappings_iter(char *key, tern_val val, uint8_t valtype, void *data) } char *mapping = tern_find_ptr(val.ptrval, "mapping"); if (mapping) { - SDL_GameControllerAddMapping(mapping); + const char *parts[] = {key, ",", mapping}; + char * full = alloc_concat_m(3, parts); + SDL_GameControllerAddMapping(full); + free(full); } } void controller_add_mappings(void) { load_ctype_config(); - tern_foreach(info_config, mappings_iter, NULL); + if (info_config) { + tern_foreach(info_config, mappings_iter, NULL); + } } void save_controller_info(int joystick, controller_info *info) |