diff options
author | Michael Pavone <pavone@retrodev.com> | 2018-07-30 09:38:01 -0700 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2018-07-30 09:38:01 -0700 |
commit | fcb0dcce813d99f6f9b873a4b238765f33a2afd2 (patch) | |
tree | d91b05c40c2cb8f952c6ffe13ce6084c41406ee4 /controller_info.c | |
parent | 9938fca108d181de940ffc004aca78715fbce8f2 (diff) |
WIP UI for creating an SDL2 mapping for controllers that don't have one
Diffstat (limited to 'controller_info.c')
-rw-r--r-- | controller_info.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/controller_info.c b/controller_info.c index e8d3c18..630708f 100644 --- a/controller_info.c +++ b/controller_info.c @@ -149,6 +149,16 @@ void save_controller_info(int joystick, controller_info *info) } +void save_controller_mapping(int joystick, char *mapping_string) +{ + char guid_string[33]; + SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(render_get_joystick(joystick)), guid_string, sizeof(guid_string)); + tern_node *existing = tern_find_node(info_config, guid_string); + existing = tern_insert_ptr(existing, "mapping", mapping_string); + info_config = tern_insert_node(info_config, guid_string, existing); + persist_config_at(info_config, "controller_types.cfg"); +} + char const *labels_xbox[] = { "A", "B", "X", "Y", "Back", NULL, "Start", "Click", "Click", "White", "Black", "LT", "RT" }; |