comparison nuklear_ui/blastem_nuklear.c @ 1806:396369ab481a

Skip buttons or axes in the mapping UI that have no label for the selected controller type
author Michael Pavone <pavone@retrodev.com>
date Tue, 26 Mar 2019 23:45:11 -0700
parents 34370330eaf3
children a218c253fcb3
comparison
equal deleted inserted replaced
1805:930c11348874 1806:396369ab481a
1226 } 1226 }
1227 added_mapping = 1; 1227 added_mapping = 1;
1228 } 1228 }
1229 } 1229 }
1230 1230
1231 if (added_mapping) { 1231 while (added_mapping) {
1232 quiet = QUIET_FRAMES; 1232 quiet = QUIET_FRAMES;
1233 if (current_button < SDL_CONTROLLER_BUTTON_MAX) { 1233 if (current_button < SDL_CONTROLLER_BUTTON_MAX) {
1234 current_button++; 1234 current_button++;
1235 if (current_button == SDL_CONTROLLER_BUTTON_MAX) { 1235 if (current_button == SDL_CONTROLLER_BUTTON_MAX) {
1236 current_axis = 0; 1236 current_axis = 0;
1237 if (get_axis_label(&selected_controller_info, current_axis)) {
1238 added_mapping = 0;
1239 }
1240 } else if (get_button_label(&selected_controller_info, current_button)) {
1241 added_mapping = 0;
1237 } 1242 }
1238 } else { 1243 } else {
1239 current_axis++; 1244 current_axis++;
1240 if (current_axis == SDL_CONTROLLER_AXIS_MAX) { 1245 if (current_axis == SDL_CONTROLLER_AXIS_MAX) {
1241 button_a = -1; 1246 button_a = -1;
1244 save_controller_mapping(selected_controller, mapping_string); 1249 save_controller_mapping(selected_controller, mapping_string);
1245 free(mapping_string); 1250 free(mapping_string);
1246 pop_view(); 1251 pop_view();
1247 push_view(view_controller_bindings); 1252 push_view(view_controller_bindings);
1248 controller_binding_changed = 0; 1253 controller_binding_changed = 0;
1254 added_mapping = 0;
1255 } else if (get_axis_label(&selected_controller_info, current_axis)) {
1256 added_mapping = 0;
1249 } 1257 }
1250 } 1258 }
1251 } 1259 }
1252 button_pressed = -1; 1260 button_pressed = -1;
1253 hat_moved = -1; 1261 hat_moved = -1;