diff render_sdl.c @ 1596:437e80a700aa

Initial heuristics for detecting controller types and showing different labels in UI. Modified controller settings view to first display a list of controllers, only showing mapping after selecting controller
author Michael Pavone <pavone@retrodev.com>
date Sun, 22 Jul 2018 17:48:46 -0700
parents 24508cb54f87
children 7f39c40b4b25
line wrap: on
line diff
--- a/render_sdl.c	Fri Jul 06 17:39:59 2018 -0700
+++ b/render_sdl.c	Sun Jul 22 17:48:46 2018 -0700
@@ -805,6 +805,22 @@
 	return -1;
 }
 
+SDL_Joystick *render_get_joystick(int index)
+{
+	if (index >= MAX_JOYSTICKS) {
+		return NULL;
+	}
+	return joysticks[index];
+}
+
+SDL_GameController *render_get_controller(int index)
+{
+	if (index >= MAX_JOYSTICKS) {
+		return NULL;
+	}
+	return SDL_GameControllerOpen(joystick_sdl_index[index]);
+}
+
 static uint32_t overscan_top[NUM_VID_STD] = {2, 21};
 static uint32_t overscan_bot[NUM_VID_STD] = {1, 17};
 static uint32_t overscan_left[NUM_VID_STD] = {13, 13};