From 4375e7029f0c872b5686ff43d3b55063c301e939 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Wed, 11 May 2016 23:09:22 -0700 Subject: [PATCH] SDL: Fix SDL 1.2 build --- CHANGES | 1 + src/platform/sdl/sdl-events.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 131e37e75..866b6125c 100644 --- a/CHANGES +++ b/CHANGES @@ -23,6 +23,7 @@ Bugfixes: - GBA Memory: Fix executing code from OBJ region of VRAM - Util: Fix socket bind addresses - All: Fix instruction tables getting zeroed when linking sometimes + - SDL: Fix SDL 1.2 build Misc: - GBA: Slightly optimize GBAProcessEvents - Qt: Add preset for DualShock 4 diff --git a/src/platform/sdl/sdl-events.c b/src/platform/sdl/sdl-events.c index 9a5d9fb28..bc3365c38 100644 --- a/src/platform/sdl/sdl-events.c +++ b/src/platform/sdl/sdl-events.c @@ -68,10 +68,12 @@ bool mSDLInitEvents(struct mSDLEvents* context) { for (i = 0; i < nJoysticks; ++i) { struct SDL_JoystickCombo* joystick = SDL_JoystickListAppend(&context->joysticks); joystick->joystick = SDL_JoystickOpen(i); - joystick->id = SDL_JoystickInstanceID(joystick->joystick); joystick->index = SDL_JoystickListSize(&context->joysticks) - 1; #if SDL_VERSION_ATLEAST(2, 0, 0) + joystick->id = SDL_JoystickInstanceID(joystick->joystick); joystick->haptic = SDL_HapticOpenFromJoystick(joystick->joystick); +#else + joystick->id = SDL_JoystickIndex(joystick->joystick); #endif } }