diff render_sdl.c @ 1608:419a0a133b5c

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
author Michael Pavone <pavone@retrodev.com>
date Fri, 03 Aug 2018 19:32:21 -0700
parents c0727712d529
children 18a946ec74c8
line wrap: on
line diff
--- a/render_sdl.c	Thu Aug 02 19:06:57 2018 -0700
+++ b/render_sdl.c	Fri Aug 03 19:32:21 2018 -0700
@@ -814,6 +814,17 @@
 	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) {