SDLControllerInterface: Fix compilation on older SDL versions (ugh)

This commit is contained in:
Connor McLaughlin 2021-09-08 11:46:04 +10:00
parent 4b31806bc9
commit d1977b20a4

View file

@ -43,10 +43,14 @@ bool SDLControllerInterface::Initialize(CommonHostInterface* host_interface)
if (ds4_rumble_enabled) if (ds4_rumble_enabled)
{ {
Log_InfoPrintf("Enabling PS4/PS5 enhanced mode."); Log_InfoPrintf("Enabling PS4/PS5 enhanced mode.");
#if SDL_VERSION_ATLEAST(2, 0, 9)
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS4, "true"); SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS4, "true");
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE, "true"); SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE, "true");
#endif
#if SDL_VERSION_ATLEAST(2, 0, 16)
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5, "true"); SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5, "true");
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, "true"); SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, "true");
#endif
} }
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER | SDL_INIT_HAPTIC) < 0) if (SDL_InitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER | SDL_INIT_HAPTIC) < 0)