diff options
author | Michael Pavone <pavone@retrodev.com> | 2018-08-03 19:32:21 -0700 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2018-08-03 19:32:21 -0700 |
commit | 9a48ad9033ec167dd8eafa8e3e9e8173b1acf363 (patch) | |
tree | 4fde12f82a2661b23979c1f17aa889321d9b7a7a /render_sdl.c | |
parent | 242137754a79f868401e2f6695ed3a6db3a94327 (diff) |
Allow a gamepad mapping to apply to all controllers, controllers of a particular type (i.e.e 6-button PS4 controllers) or specific controllers (based on SDL2 GUID) in addition to the controller in a certain slot
Diffstat (limited to 'render_sdl.c')
-rwxr-xr-x | render_sdl.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/render_sdl.c b/render_sdl.c index ca5cce5..7168752 100755 --- a/render_sdl.c +++ b/render_sdl.c @@ -814,6 +814,17 @@ SDL_Joystick *render_get_joystick(int index) return joysticks[index]; } +char* render_joystick_type_id(int index) +{ + SDL_Joystick *stick = render_get_joystick(index); + if (!stick) { + return NULL; + } + char *guid_string = malloc(33); + SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(stick), guid_string, 33); + return guid_string; +} + SDL_GameController *render_get_controller(int index) { if (index >= MAX_JOYSTICKS) { |