Added a function to get the controller firmware version

This commit is contained in:
Sam Lantinga
2022-06-03 18:49:41 -07:00
parent d6143ab369
commit 423141bfca
8 changed files with 45 additions and 0 deletions

View File

@@ -841,3 +841,5 @@
++'_SDL_JoystickPathForIndex'.'SDL2.dll'.'SDL_JoystickPathForIndex'
++'_SDL_JoystickPath'.'SDL2.dll'.'SDL_JoystickPath'
++'_SDL_JoystickAttachVirtualEx'.'SDL2.dll'.'SDL_JoystickAttachVirtualEx'
++'_SDL_GameControllerGetFirmwareVersion'.'SDL2.dll'.'SDL_GameControllerGetFirmwareVersion'
++'_SDL_JoystickGetFirmwareVersion'.'SDL2.dll'.'SDL_JoystickGetFirmwareVersion'

View File

@@ -867,3 +867,5 @@
#define SDL_JoystickPathForIndex SDL_JoystickPathForIndex_REAL
#define SDL_JoystickPath SDL_JoystickPath_REAL
#define SDL_JoystickAttachVirtualEx SDL_JoystickAttachVirtualEx_REAL
#define SDL_GameControllerGetFirmwareVersion SDL_GameControllerGetFirmwareVersion_REAL
#define SDL_JoystickGetFirmwareVersion SDL_JoystickGetFirmwareVersion_REAL

View File

@@ -942,3 +942,5 @@ SDL_DYNAPI_PROC(const char*,SDL_GameControllerPath,(SDL_GameController *a),(a),r
SDL_DYNAPI_PROC(const char*,SDL_JoystickPathForIndex,(int a),(a),return)
SDL_DYNAPI_PROC(const char*,SDL_JoystickPath,(SDL_Joystick *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_JoystickAttachVirtualEx,(const SDL_VirtualJoystickDesc *a),(a),return)
SDL_DYNAPI_PROC(Uint16,SDL_GameControllerGetFirmwareVersion,(SDL_GameController *a),(a),return)
SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetFirmwareVersion,(SDL_Joystick *a),(a),return)

View File

@@ -2360,6 +2360,12 @@ SDL_GameControllerGetProductVersion(SDL_GameController *gamecontroller)
return SDL_JoystickGetProductVersion(SDL_GameControllerGetJoystick(gamecontroller));
}
Uint16
SDL_GameControllerGetFirmwareVersion(SDL_GameController *gamecontroller)
{
return SDL_JoystickGetFirmwareVersion(SDL_GameControllerGetJoystick(gamecontroller));
}
const char *
SDL_GameControllerGetSerial(SDL_GameController *gamecontroller)
{

View File

@@ -2702,6 +2702,14 @@ Uint16 SDL_JoystickGetProductVersion(SDL_Joystick *joystick)
return version;
}
Uint16 SDL_JoystickGetFirmwareVersion(SDL_Joystick *joystick)
{
if (!SDL_PrivateJoystickValid(joystick)) {
return 0;
}
return joystick->firmware_version;
}
const char *SDL_JoystickGetSerial(SDL_Joystick *joystick)
{
if (!SDL_PrivateJoystickValid(joystick)) {

View File

@@ -68,6 +68,7 @@ struct _SDL_Joystick
char *path; /* Joystick path - system dependent */
char *serial; /* Joystick serial */
SDL_JoystickGUID guid; /* Joystick guid */
Uint16 firmware_version; /* Firmware version, if available */
int naxes; /* Number of axis controls on the joystick */
SDL_JoystickAxisInfo *axes;