From df28ffd72eb168bf392db7cf88a4c58218fe2923 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Sat, 10 Dec 2022 02:42:14 -0600 Subject: [PATCH] sdl: Yet more SDL rumble version-guards --- src/sdl/i_gamepad.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/sdl/i_gamepad.c b/src/sdl/i_gamepad.c index 109d37d4a..b2b50e43d 100644 --- a/src/sdl/i_gamepad.c +++ b/src/sdl/i_gamepad.c @@ -66,7 +66,11 @@ void I_InitGamepads(void) if (!InitGamepadSubsystems()) return; +#if SDL_VERSION_ATLEAST(2,0,9) rumble_supported = !M_CheckParm("-norumble"); +#else + rumble_supported = false; +#endif for (UINT8 i = 0; i < NUM_GAMEPADS; i++) controllers[i].info = &gamepads[i]; @@ -727,14 +731,20 @@ boolean I_RumbleSupported(void) static boolean Controller_Rumble(ControllerInfo *c) { +#if SDL_VERSION_ATLEAST(2,0,9) if (SDL_GameControllerRumble(c->dev, c->rumble.large_magnitude, c->rumble.small_magnitude, 0) == -1) return false; return true; +#else + (void)c; + return false; +#endif } void I_ToggleControllerRumble(boolean unpause) { +#if SDL_VERSION_ATLEAST(2,0,9) if (!I_RumbleSupported() || rumble_paused == !unpause) return; @@ -754,6 +764,10 @@ void I_ToggleControllerRumble(boolean unpause) controller->rumble.expiration = controller->rumble.time_left = 0; } } +#else + (void)unpause; + return; +#endif } void I_UpdateControllers(void)