Mercurial > repos > blastem
comparison nuklear_ui/blastem_nuklear.c @ 1604:68b05322d971
Don't redundantly store controller GUID when saving a mapping. Remove illegal chars from controller name
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 31 Jul 2018 23:19:39 -0700 |
parents | b452887f85b4 |
children | f7b1d983d5c0 |
comparison
equal
deleted
inserted
replaced
1603:c0727712d529 | 1604:68b05322d971 |
---|---|
837 last_axis = -1; | 837 last_axis = -1; |
838 SDL_Joystick *joy = render_get_joystick(selected_controller); | 838 SDL_Joystick *joy = render_get_joystick(selected_controller); |
839 const char *name = SDL_JoystickName(joy); | 839 const char *name = SDL_JoystickName(joy); |
840 size_t namesz = strlen(name); | 840 size_t namesz = strlen(name); |
841 mapping_string = malloc(512 + namesz); | 841 mapping_string = malloc(512 + namesz); |
842 SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(joy), mapping_string, 33); | 842 for (mapping_pos = 0; mapping_pos < namesz; mapping_pos++) |
843 mapping_string[32] = ','; | 843 { |
844 memcpy(mapping_string + 33, name, namesz); | 844 char c = name[mapping_pos]; |
845 mapping_pos = 33+namesz; | 845 if (c == ',' || c == '\n' || c == '\r') { |
846 c = ' '; | |
847 } | |
848 mapping_string[mapping_pos] = c; | |
849 } | |
846 | 850 |
847 push_view(view_controller_mappings); | 851 push_view(view_controller_mappings); |
848 } | 852 } |
849 } | 853 } |
850 } | 854 } |