summaryrefslogtreecommitdiff
path: root/controller_info.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2019-05-03 18:56:12 -0700
committerMichael Pavone <pavone@retrodev.com>2019-05-03 18:56:12 -0700
commitfb7c8ebe5b784e2bd5c8983565f4314ced2e58b7 (patch)
treeff082350f23f738e528a33e3136a209206aba6b9 /controller_info.c
parenta1d601525430ab4ac811b2d077716a02320d0e9a (diff)
Reprocess bindings when SDL2 mappings, controller types or controller order change
Diffstat (limited to 'controller_info.c')
-rw-r--r--controller_info.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/controller_info.c b/controller_info.c
index 554db56..f92b9dd 100644
--- a/controller_info.c
+++ b/controller_info.c
@@ -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 @@ void save_controller_info(int joystick, controller_info *info)
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 @@ void save_controller_mapping(int joystick, char *mapping_string)
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
}