Added SDL_HINT_JOYSTICK_ENHANCED_REPORTS

This hint defaults on, enabling advanced controller features.

This replaces SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE and SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, and is supported by PlayStation and Nintendo Switch controllers.

Fixes https://github.com/libsdl-org/SDL/issues/10086
This commit is contained in:
Sam Lantinga 2025-01-02 14:27:38 -08:00
parent 95d44f11c7
commit 2c0a8363a5
7 changed files with 254 additions and 187 deletions
include/SDL3

View file

@ -1264,6 +1264,25 @@ extern "C" {
*/
#define SDL_HINT_JOYSTICK_DEVICE "SDL_JOYSTICK_DEVICE"
/**
* A variable controlling whether enhanced reports should be used for controllers when using the HIDAPI driver.
*
* Enhanced reports allow rumble and effects on Bluetooth PlayStation controllers and gyro on Nintendo Switch controllers, but break Windows DirectInput for other applications that don't use SDL.
*
* Once enhanced reports are enabled, they can't be disabled on PlayStation controllers without power cycling the controller.
*
* The variable can be set to the following values:
*
* - "0": enhanced reports are not enabled.
* - "1": enhanced reports are enabled. (default)
* - "auto": enhanced features are advertised to the application, but SDL doesn't change the controller report mode unless the application uses them.
*
* This hint can be enabled anytime.
*
* \since This hint is available since SDL 3.1.3.
*/
#define SDL_HINT_JOYSTICK_ENHANCED_REPORTS "SDL_JOYSTICK_ENHANCED_REPORTS"
/**
* A variable containing a list of flightstick style controllers.
*
@ -1571,32 +1590,6 @@ extern "C" {
*/
#define SDL_HINT_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL "SDL_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL"
/**
* A variable controlling whether extended input reports should be used for
* PS4 controllers when using the HIDAPI driver.
*
* The variable can be set to the following values:
*
* - "0": extended reports are not enabled. (default)
* - "1": extended reports are enabled.
*
* Extended input reports allow rumble on Bluetooth PS4 controllers, but break
* DirectInput handling for applications that don't use SDL.
*
* Once extended reports are enabled, they can not be disabled without power
* cycling the controller.
*
* For compatibility with applications written for versions of SDL prior to
* the introduction of PS5 controller support, this value will also control
* the state of extended reports on PS5 controllers when the
* SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE hint is not explicitly set.
*
* This hint can be enabled anytime.
*
* \since This hint is available since SDL 3.1.3.
*/
#define SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE "SDL_JOYSTICK_HIDAPI_PS4_RUMBLE"
/**
* A variable controlling whether the HIDAPI driver for PS5 controllers should
* be used.
@ -1627,31 +1620,6 @@ extern "C" {
*/
#define SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED "SDL_JOYSTICK_HIDAPI_PS5_PLAYER_LED"
/**
* A variable controlling whether extended input reports should be used for
* PS5 controllers when using the HIDAPI driver.
*
* The variable can be set to the following values:
*
* - "0": extended reports are not enabled. (default)
* - "1": extended reports.
*
* Extended input reports allow rumble on Bluetooth PS5 controllers, but break
* DirectInput handling for applications that don't use SDL.
*
* Once extended reports are enabled, they can not be disabled without power
* cycling the controller.
*
* For compatibility with applications written for versions of SDL prior to
* the introduction of PS5 controller support, this value defaults to the
* value of SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE.
*
* This hint can be enabled anytime.
*
* \since This hint is available since SDL 3.1.3.
*/
#define SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE "SDL_JOYSTICK_HIDAPI_PS5_RUMBLE"
/**
* A variable controlling whether the HIDAPI driver for NVIDIA SHIELD
* controllers should be used.