Mercurial > repos > blastem
comparison controller_info.c @ 1645:84ef1eb2c96a
Added code for actually saving new controller bindings to an appropriate key in the config file
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 30 Nov 2018 00:35:05 -0800 |
parents | 419a0a133b5c |
children | 3a8c4ee68568 |
comparison
equal
deleted
inserted
replaced
1644:cf4e387a8db6 | 1645:84ef1eb2c96a |
---|---|
38 "ps4", | 38 "ps4", |
39 "wiiu", | 39 "wiiu", |
40 "switch", | 40 "switch", |
41 "genesis", | 41 "genesis", |
42 "saturn" | 42 "saturn" |
43 }; | |
44 static const char *subtype_human_names[] = { | |
45 "unknown", | |
46 "Xbos", | |
47 "Xbox 360", | |
48 "Xbox One", | |
49 "PS2", | |
50 "PS3", | |
51 "PS4", | |
52 "Wii-U", | |
53 "Switch", | |
54 "Genesis", | |
55 "Saturn" | |
43 }; | 56 }; |
44 static const char *variant_names[] = { | 57 static const char *variant_names[] = { |
45 "normal", | 58 "normal", |
46 "6b bumpers", | 59 "6b bumpers", |
47 "6b right" | 60 "6b right" |
293 } | 306 } |
294 } | 307 } |
295 return ret; | 308 return ret; |
296 } | 309 } |
297 | 310 |
311 char *make_human_readable_type_name(controller_info *info) | |
312 { | |
313 const char *base = subtype_human_names[info->subtype]; | |
314 char *prefix; | |
315 if (info->variant == VARIANT_NORMAL) { | |
316 prefix = "Normal "; | |
317 } else { | |
318 static const char *parts[] = {"6 button (", NULL, "/", NULL, ") "}; | |
319 if (info->variant == VARIANT_6B_BUMPERS) { | |
320 parts[1] = get_button_label(info, SDL_CONTROLLER_BUTTON_LEFTSHOULDER); | |
321 parts[3] = get_button_label(info, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER); | |
322 } else { | |
323 parts[1] = get_button_label(info, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER); | |
324 parts[3] = get_axis_label(info, SDL_CONTROLLER_AXIS_TRIGGERRIGHT); | |
325 } | |
326 prefix = alloc_concat_m(5, parts); | |
327 } | |
328 char *ret = alloc_concat(prefix, base); | |
329 if (info->variant != VARIANT_NORMAL) { | |
330 free(prefix); | |
331 } | |
332 return ret; | |
333 } | |
334 |