From 13d02c14e0fd42a6e421df2916e6d576a74ff3c3 Mon Sep 17 00:00:00 2001 From: Steveice10 <1269164+Steveice10@users.noreply.github.com> Date: Fri, 10 Nov 2023 13:14:40 -0800 Subject: [PATCH] input_common: Set SDL hints to enable DualShock 4 / DualSense motion. (#7121) --- src/input_common/sdl/sdl_impl.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/input_common/sdl/sdl_impl.cpp b/src/input_common/sdl/sdl_impl.cpp index f110819be..1e6d105d9 100644 --- a/src/input_common/sdl/sdl_impl.cpp +++ b/src/input_common/sdl/sdl_impl.cpp @@ -835,6 +835,19 @@ SDLState::SDLState() { #endif #endif + // Prevent SDL from adding undesired axis +#ifdef SDL_HINT_ACCELEROMETER_AS_JOYSTICK + SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0"); +#endif + + // Enable HIDAPI rumble. This prevents SDL from disabling motion on PS4 and PS5 controllers +#ifdef SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE + SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE, "1"); +#endif +#ifdef SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE + SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, "1"); +#endif + SDL_AddEventWatch(&SDLEventWatcher, this); initialized = true;