From 47d77ef9201c0ebe2c443a98d53b563657d9f7ed Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Sun, 22 Jul 2018 17:48:46 -0700 Subject: 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 --- render_sdl.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'render_sdl.c') diff --git a/render_sdl.c b/render_sdl.c index 3296581..1c9aecf 100755 --- a/render_sdl.c +++ b/render_sdl.c @@ -805,6 +805,22 @@ static int lowest_unused_joystick_index() 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}; -- cgit v1.2.3