Mercurial > repos > blastem
diff controller_info.c @ 1861:fc05f49075c2
Reprocess bindings when SDL2 mappings, controller types or controller order change
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 03 May 2019 18:56:12 -0700 |
parents | 52f136052ab0 |
children | 8a64d86cc362 |
line wrap: on
line diff
--- a/controller_info.c Fri May 03 18:40:13 2019 -0700 +++ b/controller_info.c Fri May 03 18:56:12 2019 -0700 @@ -7,6 +7,7 @@ #include "config.h" #include "util.h" #include "blastem.h" +#include "bindings.h" typedef struct { char const *name; @@ -199,6 +200,7 @@ existing = tern_insert_ptr(existing, "variant", strdup(variant_names[info->variant])); info_config = tern_insert_node(info_config, guid_string, existing); persist_config_at(config, info_config, "controller_types.cfg"); + handle_joy_added(joystick); #endif } @@ -211,6 +213,11 @@ existing = tern_insert_ptr(existing, "mapping", mapping_string); info_config = tern_insert_node(info_config, guid_string, existing); persist_config_at(config, info_config, "controller_types.cfg"); + const char *parts[] = {guid_string, ",", mapping_string}; + char * full = alloc_concat_m(3, parts); + SDL_GameControllerAddMapping(full); + free(full); + handle_joy_added(joystick); #endif }