comparison controller_info.c @ 1600:7f39c40b4b25

WIP UI for creating an SDL2 mapping for controllers that don't have one
author Michael Pavone <pavone@retrodev.com>
date Mon, 30 Jul 2018 09:38:01 -0700
parents 1fc61c844ec5
children c0727712d529
comparison
equal deleted inserted replaced
1599:1fc61c844ec5 1600:7f39c40b4b25
147 info_config = tern_insert_node(info_config, guid_string, existing); 147 info_config = tern_insert_node(info_config, guid_string, existing);
148 persist_config_at(info_config, "controller_types.cfg"); 148 persist_config_at(info_config, "controller_types.cfg");
149 149
150 } 150 }
151 151
152 void save_controller_mapping(int joystick, char *mapping_string)
153 {
154 char guid_string[33];
155 SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(render_get_joystick(joystick)), guid_string, sizeof(guid_string));
156 tern_node *existing = tern_find_node(info_config, guid_string);
157 existing = tern_insert_ptr(existing, "mapping", mapping_string);
158 info_config = tern_insert_node(info_config, guid_string, existing);
159 persist_config_at(info_config, "controller_types.cfg");
160 }
161
152 char const *labels_xbox[] = { 162 char const *labels_xbox[] = {
153 "A", "B", "X", "Y", "Back", NULL, "Start", "Click", "Click", "White", "Black", "LT", "RT" 163 "A", "B", "X", "Y", "Back", NULL, "Start", "Click", "Click", "White", "Black", "LT", "RT"
154 }; 164 };
155 char const *labels_360[] = { 165 char const *labels_360[] = {
156 "A", "B", "X", "Y", "Back", "Xbox", "Start", "Click", "Click", "LB", "RB", "LT", "RT" 166 "A", "B", "X", "Y", "Back", "Xbox", "Start", "Click", "Click", "LB", "RB", "LT", "RT"