It's been introduced in SDL2 2.0.9, released on 2018/11/31.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- configure.ac | 4 +++- dlls/winebus.sys/bus_sdl.c | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac index 15b7c2add2a..4d87d516bd1 100644 --- a/configure.ac +++ b/configure.ac @@ -1701,7 +1701,9 @@ if test "x$with_sdl" != "xno" then WINE_PACKAGE_FLAGS(SDL2,[sdl2],[-lSDL2],,, [AC_CHECK_HEADERS([SDL.h], - [WINE_CHECK_SONAME(SDL2,SDL_Init,,,[$SDL2_LIBS],[[libSDL2-2.0*]])])]) + [WINE_CHECK_SONAME(SDL2,SDL_Init,,,[$SDL2_LIBS],[[libSDL2-2.0*]])]) + WINE_CHECK_LIB_FUNCS([SDL_JoystickRumble], [$SDL2_LIBS]) + ]) fi WINE_NOTICE_WITH(sdl,[test "x$ac_cv_lib_soname_SDL2" = "x"], [libSDL2 ${notice_platform}development files not found, SDL2 won't be supported.]) diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index 31915a9fa0d..6e7c359deea 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -102,7 +102,9 @@ MAKE_FUNCPTR(SDL_HapticRumbleSupported); MAKE_FUNCPTR(SDL_HapticRunEffect); MAKE_FUNCPTR(SDL_HapticStopAll); MAKE_FUNCPTR(SDL_JoystickIsHaptic); +#ifdef HAVE_SDL_JOYSTICKRUMBLE MAKE_FUNCPTR(SDL_JoystickRumble); +#endif MAKE_FUNCPTR(SDL_memset); MAKE_FUNCPTR(SDL_GameControllerAddMapping); MAKE_FUNCPTR(SDL_RegisterEvents); @@ -181,8 +183,10 @@ static BOOL descriptor_add_haptic(struct sdl_device *impl) pSDL_HapticRumbleInit(impl->sdl_haptic); }
+#ifdef HAVE_SDL_JOYSTICKRUMBLE if (!pSDL_JoystickRumble(impl->sdl_joystick, 0, 0, 0)) impl->effect_support |= WINE_SDL_JOYSTICK_RUMBLE; +#endif
if (impl->effect_support & EFFECT_SUPPORT_HAPTICS) { @@ -365,8 +369,10 @@ NTSTATUS sdl_device_haptics_start(struct unix_device *iface, DWORD duration_ms, effect.leftright.small_magnitude = buzz_intensity;
if (impl->sdl_haptic) pSDL_HapticStopAll(impl->sdl_haptic); +#ifdef HAVE_SDL_JOYSTICKRUMBLE if (impl->effect_support & WINE_SDL_JOYSTICK_RUMBLE) pSDL_JoystickRumble(impl->sdl_joystick, 0, 0, 0); +#endif if (!effect.leftright.large_magnitude && !effect.leftright.small_magnitude) return STATUS_SUCCESS;
@@ -383,11 +389,13 @@ NTSTATUS sdl_device_haptics_start(struct unix_device *iface, DWORD duration_ms, float magnitude = (effect.leftright.large_magnitude + effect.leftright.small_magnitude) / 2.0 / 32767.0; pSDL_HapticRumblePlay(impl->sdl_haptic, magnitude, effect.leftright.length); } +#ifdef HAVE_SDL_JOYSTICKRUMBLE else if (impl->effect_support & WINE_SDL_JOYSTICK_RUMBLE) { pSDL_JoystickRumble(impl->sdl_joystick, effect.leftright.large_magnitude, effect.leftright.small_magnitude, -1); } +#endif
return STATUS_SUCCESS; } @@ -658,7 +666,9 @@ NTSTATUS sdl_bus_init(void *args) LOAD_FUNCPTR(SDL_HapticRunEffect); LOAD_FUNCPTR(SDL_HapticStopAll); LOAD_FUNCPTR(SDL_JoystickIsHaptic); +#ifdef HAVE_SDL_JOYSTICKRUMBLE LOAD_FUNCPTR(SDL_JoystickRumble); +#endif LOAD_FUNCPTR(SDL_memset); LOAD_FUNCPTR(SDL_GameControllerAddMapping); LOAD_FUNCPTR(SDL_RegisterEvents);