Added Steam Input API support for game controllers

Added support for getting the real controller info, as well as the function SDL_GameControllerGetSteamHandle() to get the Steam Input API handle, from the virtual gamepads provided by Steam.

Also added an event SDL_CONTROLLERSTEAMHANDLEUPDATED which is triggered when a controller's API handle changes, e.g. the controllers were reassigned slots in the Steam UI.

(cherry picked from commit c981a597dc)
This commit is contained in:
Sam Lantinga 2023-12-09 23:05:34 -08:00
parent 9720672374
commit 7bb0e839a6
41 changed files with 827 additions and 49 deletions

View file

@ -524,6 +524,20 @@ extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetFirmwareVersion(SDL_GameCont
*/
extern DECLSPEC const char * SDLCALL SDL_GameControllerGetSerial(SDL_GameController *gamecontroller);
/**
* Get the Steam Input handle of an opened controller, if available.
*
* Returns an InputHandle_t for the controller that can be used with Steam Input API:
* https://partner.steamgames.com/doc/api/ISteamInput
*
* \param gamecontroller the game controller object to query.
* \returns the gamepad handle, or 0 if unavailable.
*
* \since This function is available since SDL 2.30.0.
*/
extern DECLSPEC Uint64 SDLCALL SDL_GameControllerGetSteamHandle(SDL_GameController *gamecontroller);
/**
* Check if a controller has been opened and is currently connected.
*