SDL_GUIDToString() follows the SDL_GetStringRule

Also removed the distinction between SDL_GUID and SDL_JoystickGUID
This commit is contained in:
Sam Lantinga 2024-07-19 09:08:17 -07:00
parent 892df4bf4b
commit 61a7a0e579
44 changed files with 182 additions and 260 deletions

View File

@ -1353,12 +1353,7 @@ typedef SDL_GameControllerButton, SDL_GamepadButton;
@@
@@
- SDL_JoystickGetGUIDFromString
+ SDL_GetJoystickGUIDFromString
(...)
@@
@@
- SDL_JoystickGetGUIDString
+ SDL_GetJoystickGUIDString
+ SDL_GUIDFromString
(...)
@@
@@
@ -3581,3 +3576,8 @@ typedef SDL_Colour, SDL_Color;
- SDL_AndroidSendMessage
+ SDL_SendAndroidMessage
(...)
@@
typedef SDL_JoystickGUID, SDL_GUID;
@@
- SDL_JoystickGUID
+ SDL_GUID

View File

@ -860,8 +860,7 @@ The following functions have been renamed:
* SDL_JoystickGetButton() => SDL_GetJoystickButton()
* SDL_JoystickGetFirmwareVersion() => SDL_GetJoystickFirmwareVersion()
* SDL_JoystickGetGUID() => SDL_GetJoystickGUID()
* SDL_JoystickGetGUIDFromString() => SDL_GetJoystickGUIDFromString()
* SDL_JoystickGetGUIDString() => SDL_GetJoystickGUIDString()
* SDL_JoystickGetGUIDFromString() => SDL_GUIDFromString()
* SDL_JoystickGetHat() => SDL_GetJoystickHat()
* SDL_JoystickGetPlayerIndex() => SDL_GetJoystickPlayerIndex()
* SDL_JoystickGetProduct() => SDL_GetJoystickProduct()
@ -902,6 +901,7 @@ The following functions have been removed:
* SDL_JoystickGetDeviceProductVersion() - replaced with SDL_GetJoystickProductVersionForID()
* SDL_JoystickGetDeviceType() - replaced with SDL_GetJoystickTypeForID()
* SDL_JoystickGetDeviceVendor() - replaced with SDL_GetJoystickVendorForID()
* SDL_JoystickGetGUIDString() - replaced with SDL_GUIDToString()
* SDL_JoystickHasLED() - replaced with SDL_PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN
* SDL_JoystickHasRumble() - replaced with SDL_PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN
* SDL_JoystickHasRumbleTriggers() - replaced with SDL_PROP_JOYSTICK_CAP_TRIGGER_RUMBLE_BOOLEAN
@ -913,6 +913,9 @@ The following functions have been removed:
The following symbols have been removed:
* SDL_JOYBALLMOTION
The following structures have been renamed:
* SDL_JoystickGUID => SDL_GUID
## SDL_keyboard.h
Text input is no longer automatically enabled when initializing video, you should call SDL_StartTextInput() when you want to receive text input and call SDL_StopTextInput() when you are done. Starting text input may shown an input method editor (IME) and cause key up/down events to be skipped, so should only be enabled when the application wants text input.

View File

@ -282,7 +282,7 @@ typedef struct SDL_GamepadBinding
* existing gamepad.
*
* The mapping string has the format "GUID,name,mapping", where GUID is the
* string value from SDL_GetJoystickGUIDString(), name is the human readable
* string value from SDL_GUIDToString(), name is the human readable
* string for the device and mappings are gamepad mappings to joystick ones.
* Under Windows there is a reserved GUID of "xinput" that covers all XInput
* devices. The mapping format for joystick is:
@ -414,7 +414,7 @@ extern SDL_DECLSPEC const char * const * SDLCALL SDL_GetGamepadMappings(int *cou
* \sa SDL_GetJoystickGUIDForID
* \sa SDL_GetJoystickGUID
*/
extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadMappingForGUID(SDL_JoystickGUID guid);
extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadMappingForGUID(SDL_GUID guid);
/**
* Get the current mapping of a gamepad.
@ -561,7 +561,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetGamepadPlayerIndexForID(SDL_JoystickID in
* \sa SDL_GetGamepadGUIDString
* \sa SDL_GetGamepads
*/
extern SDL_DECLSPEC SDL_JoystickGUID SDLCALL SDL_GetGamepadGUIDForID(SDL_JoystickID instance_id);
extern SDL_DECLSPEC SDL_GUID SDLCALL SDL_GetGamepadGUIDForID(SDL_JoystickID instance_id);
/**
* Get the USB vendor ID of a gamepad, if available.

View File

@ -66,19 +66,17 @@ typedef struct SDL_GUID {
/**
* Get an ASCII string representation for a given SDL_GUID.
*
* You should supply at least 33 bytes for pszGUID.
* The returned string follows the SDL_GetStringRule, and will be automatically freed later.
*
* \param guid the SDL_GUID you wish to convert to string.
* \param pszGUID buffer in which to write the ASCII string.
* \param cbGUID the size of pszGUID.
* \returns 0 on success or a negative error code on failure; call
* \returns the string representation of the GUID or NULL on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GUIDFromString
*/
extern SDL_DECLSPEC int SDLCALL SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID);
extern SDL_DECLSPEC const char * SDLCALL SDL_GUIDToString(SDL_GUID guid);
/**
* Convert a GUID string into a SDL_GUID structure.

View File

@ -37,8 +37,8 @@
* controller. For XInput controllers this returns the XInput user index. Many
* joysticks will not be able to supply this information.
*
* The term SDL_JoystickGUID is a stable 128-bit identifier for a joystick
* device that does not change over time, it identifies class of the device (a
* SDL_GUID is used as a stable 128-bit identifier for a joystick
* device that does not change over time. It identifies class of the device (a
* X360 wired controller for example). This identifier is platform dependent.
*
* In order to use these functions, SDL_Init() must have been called with the
@ -85,15 +85,6 @@ extern SDL_Mutex *SDL_joystick_lock;
*/
typedef struct SDL_Joystick SDL_Joystick;
/**
* A structure that encodes the stable unique id for a joystick device.
*
* This is just a standard SDL_GUID by a different name.
*
* \since This datatype is available since SDL 3.0.0.
*/
typedef SDL_GUID SDL_JoystickGUID;
/**
* This is a unique ID for a joystick for the time it is connected to the
* system, and is never reused for the lifetime of the application.
@ -286,9 +277,9 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetJoystickPlayerIndexForID(SDL_JoystickID i
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetJoystickGUID
* \sa SDL_GetJoystickGUIDString
* \sa SDL_GUIDToString
*/
extern SDL_DECLSPEC SDL_JoystickGUID SDLCALL SDL_GetJoystickGUIDForID(SDL_JoystickID instance_id);
extern SDL_DECLSPEC SDL_GUID SDLCALL SDL_GetJoystickGUIDForID(SDL_JoystickID instance_id);
/**
* Get the USB vendor ID of a joystick, if available.
@ -737,9 +728,9 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetJoystickPlayerIndex(SDL_Joystick *joystic
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetJoystickGUIDForID
* \sa SDL_GetJoystickGUIDString
* \sa SDL_GUIDToString
*/
extern SDL_DECLSPEC SDL_JoystickGUID SDLCALL SDL_GetJoystickGUID(SDL_Joystick *joystick);
extern SDL_DECLSPEC SDL_GUID SDLCALL SDL_GetJoystickGUID(SDL_Joystick *joystick);
/**
* Get the USB vendor ID of an opened joystick, if available.
@ -824,44 +815,25 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetJoystickSerial(SDL_Joystick *joy
extern SDL_DECLSPEC SDL_JoystickType SDLCALL SDL_GetJoystickType(SDL_Joystick *joystick);
/**
* Get an ASCII string representation for a given SDL_JoystickGUID.
*
* You should supply at least 33 bytes for pszGUID.
*
* \param guid the SDL_JoystickGUID you wish to convert to string.
* \param pszGUID buffer in which to write the ASCII string.
* \param cbGUID the size of pszGUID.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetJoystickGUIDForID
* \sa SDL_GetJoystickGUID
* \sa SDL_GetJoystickGUIDFromString
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetJoystickGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID);
/**
* Convert a GUID string into a SDL_JoystickGUID structure.
* Convert a GUID string into a SDL_GUID structure.
*
* Performs no error checking. If this function is given a string containing
* an invalid GUID, the function will silently succeed, but the GUID generated
* will not be useful.
*
* \param pchGUID string containing an ASCII representation of a GUID.
* \returns a SDL_JoystickGUID structure.
* \returns a SDL_GUID structure.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetJoystickGUIDString
* \sa SDL_GUIDToString
*/
extern SDL_DECLSPEC SDL_JoystickGUID SDLCALL SDL_GetJoystickGUIDFromString(const char *pchGUID);
extern SDL_DECLSPEC SDL_GUID SDLCALL SDL_GUIDFromString(const char *pchGUID);
/**
* Get the device information encoded in a SDL_JoystickGUID structure.
* Get the device information encoded in a SDL_GUID structure.
*
* \param guid the SDL_JoystickGUID you wish to get info about.
* \param guid the SDL_GUID you wish to get info about.
* \param vendor a pointer filled in with the device VID, or 0 if not
* available.
* \param product a pointer filled in with the device PID, or 0 if not
@ -875,7 +847,7 @@ extern SDL_DECLSPEC SDL_JoystickGUID SDLCALL SDL_GetJoystickGUIDFromString(const
*
* \sa SDL_GetJoystickGUIDForID
*/
extern SDL_DECLSPEC void SDLCALL SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *product, Uint16 *version, Uint16 *crc16);
extern SDL_DECLSPEC void SDLCALL SDL_GetJoystickGUIDInfo(SDL_GUID guid, Uint16 *vendor, Uint16 *product, Uint16 *version, Uint16 *crc16);
/**
* Get the status of a specified joystick.

View File

@ -309,6 +309,7 @@
#define SDL_JoystickDetachVirtual SDL_DetachVirtualJoystick
#define SDL_JoystickFromInstanceID SDL_GetJoystickFromID
#define SDL_JoystickFromPlayerIndex SDL_GetJoystickFromPlayerIndex
#define SDL_JoystickGUID SDL_GUID
#define SDL_JoystickGetAttached SDL_JoystickConnected
#define SDL_JoystickGetAxis SDL_GetJoystickAxis
#define SDL_JoystickGetAxisInitialState SDL_GetJoystickAxisInitialState
@ -316,8 +317,7 @@
#define SDL_JoystickGetButton SDL_GetJoystickButton
#define SDL_JoystickGetFirmwareVersion SDL_GetJoystickFirmwareVersion
#define SDL_JoystickGetGUID SDL_GetJoystickGUID
#define SDL_JoystickGetGUIDFromString SDL_GetJoystickGUIDFromString
#define SDL_JoystickGetGUIDString SDL_GetJoystickGUIDString
#define SDL_JoystickGetGUIDFromString SDL_GUIDFromString
#define SDL_JoystickGetHat SDL_GetJoystickHat
#define SDL_JoystickGetPlayerIndex SDL_GetJoystickPlayerIndex
#define SDL_JoystickGetProduct SDL_GetJoystickProduct
@ -925,6 +925,7 @@
#define SDL_JoystickDetachVirtual SDL_JoystickDetachVirtual_renamed_SDL_DetachVirtualJoystick
#define SDL_JoystickFromInstanceID SDL_JoystickFromInstanceID_renamed_SDL_GetJoystickFromID
#define SDL_JoystickFromPlayerIndex SDL_JoystickFromPlayerIndex_renamed_SDL_GetJoystickFromPlayerIndex
#define SDL_JoystickGUID SDL_JoystickGUID_renamed_SDL_GUID
#define SDL_JoystickGetAttached SDL_JoystickGetAttached_renamed_SDL_JoystickConnected
#define SDL_JoystickGetAxis SDL_JoystickGetAxis_renamed_SDL_GetJoystickAxis
#define SDL_JoystickGetAxisInitialState SDL_JoystickGetAxisInitialState_renamed_SDL_GetJoystickAxisInitialState
@ -932,8 +933,7 @@
#define SDL_JoystickGetButton SDL_JoystickGetButton_renamed_SDL_GetJoystickButton
#define SDL_JoystickGetFirmwareVersion SDL_JoystickGetFirmwareVersion_renamed_SDL_GetJoystickFirmwareVersion
#define SDL_JoystickGetGUID SDL_JoystickGetGUID_renamed_SDL_GetJoystickGUID
#define SDL_JoystickGetGUIDFromString SDL_JoystickGetGUIDFromString_renamed_SDL_GetJoystickGUIDFromString
#define SDL_JoystickGetGUIDString SDL_JoystickGetGUIDString_renamed_SDL_GetJoystickGUIDString
#define SDL_JoystickGetGUIDFromString SDL_JoystickGetGUIDFromString_renamed_SDL_GUIDFromString
#define SDL_JoystickGetHat SDL_JoystickGetHat_renamed_SDL_GetJoystickHat
#define SDL_JoystickGetPlayerIndex SDL_JoystickGetPlayerIndex_renamed_SDL_GetJoystickPlayerIndex
#define SDL_JoystickGetProduct SDL_JoystickGetProduct_renamed_SDL_GetJoystickProduct

View File

@ -21,28 +21,21 @@
#include "SDL_internal.h"
/* convert the guid to a printable string */
int SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID)
const char *SDL_GUIDToString(SDL_GUID guid)
{
static const char k_rgchHexToASCII[] = "0123456789abcdef";
int i;
char string[sizeof(guid) * 2 + 1];
if (!pszGUID) {
return SDL_InvalidParamError("pszGUID");
}
if (cbGUID <= 0) {
return SDL_InvalidParamError("cbGUID");
}
for (i = 0; i < sizeof(guid.data) && i < (cbGUID - 1) / 2; i++) {
/* each input byte writes 2 ascii chars, and might write a null byte. */
/* If we don't have room for next input byte, stop */
for (i = 0; i < sizeof(guid.data); ++i) {
unsigned char c = guid.data[i];
*pszGUID++ = k_rgchHexToASCII[c >> 4];
*pszGUID++ = k_rgchHexToASCII[c & 0x0F];
string[i * 2 + 0] = k_rgchHexToASCII[c >> 4];
string[i * 2 + 1] = k_rgchHexToASCII[c & 0x0F];
}
*pszGUID = '\0';
return 0;
string[sizeof(string) -1] = '\0';
return SDL_CreateTemporaryString(string);
}
/*-----------------------------------------------------------------------------

View File

@ -298,9 +298,7 @@ SDL3_0.0.0 {
SDL_GetJoystickFromPlayerIndex;
SDL_GetJoystickGUID;
SDL_GetJoystickGUIDForID;
SDL_GetJoystickGUIDFromString;
SDL_GetJoystickGUIDInfo;
SDL_GetJoystickGUIDString;
SDL_GetJoystickHat;
SDL_GetJoystickID;
SDL_GetJoystickName;

View File

@ -323,9 +323,7 @@
#define SDL_GetJoystickFromPlayerIndex SDL_GetJoystickFromPlayerIndex_REAL
#define SDL_GetJoystickGUID SDL_GetJoystickGUID_REAL
#define SDL_GetJoystickGUIDForID SDL_GetJoystickGUIDForID_REAL
#define SDL_GetJoystickGUIDFromString SDL_GetJoystickGUIDFromString_REAL
#define SDL_GetJoystickGUIDInfo SDL_GetJoystickGUIDInfo_REAL
#define SDL_GetJoystickGUIDString SDL_GetJoystickGUIDString_REAL
#define SDL_GetJoystickHat SDL_GetJoystickHat_REAL
#define SDL_GetJoystickID SDL_GetJoystickID_REAL
#define SDL_GetJoystickName SDL_GetJoystickName_REAL

View File

@ -188,7 +188,7 @@ SDL_DYNAPI_PROC(int,SDL_GL_SetSwapInterval,(int a),(a),return)
SDL_DYNAPI_PROC(int,SDL_GL_SwapWindow,(SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(void,SDL_GL_UnloadLibrary,(void),(),)
SDL_DYNAPI_PROC(SDL_GUID,SDL_GUIDFromString,(const char *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_GUIDToString,(SDL_GUID a, char *b, int c),(a,b,c),return)
SDL_DYNAPI_PROC(const char *,SDL_GUIDToString,(SDL_GUID a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_GamepadConnected,(SDL_Gamepad *a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_GamepadEventsEnabled,(void),(),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_GamepadHasAxis,(SDL_Gamepad *a, SDL_GamepadAxis b),(a,b),return)
@ -285,11 +285,11 @@ SDL_DYNAPI_PROC(SDL_JoystickConnectionState,SDL_GetGamepadConnectionState,(SDL_G
SDL_DYNAPI_PROC(Uint16,SDL_GetGamepadFirmwareVersion,(SDL_Gamepad *a),(a),return)
SDL_DYNAPI_PROC(SDL_Gamepad*,SDL_GetGamepadFromID,(SDL_JoystickID a),(a),return)
SDL_DYNAPI_PROC(SDL_Gamepad*,SDL_GetGamepadFromPlayerIndex,(int a),(a),return)
SDL_DYNAPI_PROC(SDL_JoystickGUID,SDL_GetGamepadGUIDForID,(SDL_JoystickID a),(a),return)
SDL_DYNAPI_PROC(SDL_GUID,SDL_GetGamepadGUIDForID,(SDL_JoystickID a),(a),return)
SDL_DYNAPI_PROC(SDL_JoystickID,SDL_GetGamepadID,(SDL_Gamepad *a),(a),return)
SDL_DYNAPI_PROC(SDL_Joystick*,SDL_GetGamepadJoystick,(SDL_Gamepad *a),(a),return)
SDL_DYNAPI_PROC(const char*,SDL_GetGamepadMapping,(SDL_Gamepad *a),(a),return)
SDL_DYNAPI_PROC(const char*,SDL_GetGamepadMappingForGUID,(SDL_JoystickGUID a),(a),return)
SDL_DYNAPI_PROC(const char*,SDL_GetGamepadMappingForGUID,(SDL_GUID a),(a),return)
SDL_DYNAPI_PROC(const char*,SDL_GetGamepadMappingForID,(SDL_JoystickID a),(a),return)
SDL_DYNAPI_PROC(const char * const *,SDL_GetGamepadMappings,(int *a),(a),return)
SDL_DYNAPI_PROC(const char*,SDL_GetGamepadName,(SDL_Gamepad *a),(a),return)
@ -341,11 +341,9 @@ SDL_DYNAPI_PROC(SDL_JoystickConnectionState,SDL_GetJoystickConnectionState,(SDL_
SDL_DYNAPI_PROC(Uint16,SDL_GetJoystickFirmwareVersion,(SDL_Joystick *a),(a),return)
SDL_DYNAPI_PROC(SDL_Joystick*,SDL_GetJoystickFromID,(SDL_JoystickID a),(a),return)
SDL_DYNAPI_PROC(SDL_Joystick*,SDL_GetJoystickFromPlayerIndex,(int a),(a),return)
SDL_DYNAPI_PROC(SDL_JoystickGUID,SDL_GetJoystickGUID,(SDL_Joystick *a),(a),return)
SDL_DYNAPI_PROC(SDL_JoystickGUID,SDL_GetJoystickGUIDForID,(SDL_JoystickID a),(a),return)
SDL_DYNAPI_PROC(SDL_JoystickGUID,SDL_GetJoystickGUIDFromString,(const char *a),(a),return)
SDL_DYNAPI_PROC(void,SDL_GetJoystickGUIDInfo,(SDL_JoystickGUID a, Uint16 *b, Uint16 *c, Uint16 *d, Uint16 *e),(a,b,c,d,e),)
SDL_DYNAPI_PROC(int,SDL_GetJoystickGUIDString,(SDL_JoystickGUID a, char *b, int c),(a,b,c),return)
SDL_DYNAPI_PROC(SDL_GUID,SDL_GetJoystickGUID,(SDL_Joystick *a),(a),return)
SDL_DYNAPI_PROC(SDL_GUID,SDL_GetJoystickGUIDForID,(SDL_JoystickID a),(a),return)
SDL_DYNAPI_PROC(void,SDL_GetJoystickGUIDInfo,(SDL_GUID a, Uint16 *b, Uint16 *c, Uint16 *d, Uint16 *e),(a,b,c,d,e),)
SDL_DYNAPI_PROC(Uint8,SDL_GetJoystickHat,(SDL_Joystick *a, int b),(a,b),return)
SDL_DYNAPI_PROC(SDL_JoystickID,SDL_GetJoystickID,(SDL_Joystick *a),(a),return)
SDL_DYNAPI_PROC(const char*,SDL_GetJoystickName,(SDL_Joystick *a),(a),return)

View File

@ -79,7 +79,7 @@ typedef enum
typedef struct GamepadMapping_t
{
SDL_JoystickGUID guid _guarded;
SDL_GUID guid _guarded;
char *name _guarded;
char *mapping _guarded;
SDL_GamepadMappingPriority priority _guarded;
@ -99,7 +99,7 @@ typedef struct
#undef _guarded
static SDL_JoystickGUID s_zeroGUID;
static SDL_GUID s_zeroGUID;
static GamepadMapping_t *s_pSupportedGamepads SDL_GUARDED_BY(SDL_joystick_lock) = NULL;
static GamepadMapping_t *s_pDefaultMapping SDL_GUARDED_BY(SDL_joystick_lock) = NULL;
static GamepadMapping_t *s_pXInputMapping SDL_GUARDED_BY(SDL_joystick_lock) = NULL;
@ -150,7 +150,7 @@ static SDL_vidpid_list SDL_ignored_gamepads = {
SDL_FALSE
};
static GamepadMapping_t *SDL_PrivateAddMappingForGUID(SDL_JoystickGUID jGUID, const char *mappingString, SDL_bool *existing, SDL_GamepadMappingPriority priority);
static GamepadMapping_t *SDL_PrivateAddMappingForGUID(SDL_GUID jGUID, const char *mappingString, SDL_bool *existing, SDL_GamepadMappingPriority priority);
static void SDL_PrivateLoadButtonMapping(SDL_Gamepad *gamepad, GamepadMapping_t *pGamepadMapping);
static GamepadMapping_t *SDL_PrivateGetGamepadMapping(SDL_JoystickID instance_id, SDL_bool create_mapping);
static int SDL_SendGamepadAxis(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_GamepadAxis axis, Sint16 value);
@ -588,7 +588,7 @@ static void PopMappingChangeTracking(void)
/*
* Helper function to guess at a mapping based on the elements reported for this gamepad
*/
static GamepadMapping_t *SDL_CreateMappingForAndroidGamepad(SDL_JoystickGUID guid)
static GamepadMapping_t *SDL_CreateMappingForAndroidGamepad(SDL_GUID guid)
{
const int face_button_mask = ((1 << SDL_GAMEPAD_BUTTON_SOUTH) |
(1 << SDL_GAMEPAD_BUTTON_EAST) |
@ -690,7 +690,7 @@ static GamepadMapping_t *SDL_CreateMappingForAndroidGamepad(SDL_JoystickGUID gui
/*
* Helper function to guess at a mapping for HIDAPI gamepads
*/
static GamepadMapping_t *SDL_CreateMappingForHIDAPIGamepad(SDL_JoystickGUID guid)
static GamepadMapping_t *SDL_CreateMappingForHIDAPIGamepad(SDL_GUID guid)
{
SDL_bool existing;
char mapping_string[1024];
@ -835,7 +835,7 @@ static GamepadMapping_t *SDL_CreateMappingForHIDAPIGamepad(SDL_JoystickGUID guid
/*
* Helper function to guess at a mapping for RAWINPUT gamepads
*/
static GamepadMapping_t *SDL_CreateMappingForRAWINPUTGamepad(SDL_JoystickGUID guid)
static GamepadMapping_t *SDL_CreateMappingForRAWINPUTGamepad(SDL_GUID guid)
{
SDL_bool existing;
char mapping_string[1024];
@ -849,7 +849,7 @@ static GamepadMapping_t *SDL_CreateMappingForRAWINPUTGamepad(SDL_JoystickGUID gu
/*
* Helper function to guess at a mapping for WGI gamepads
*/
static GamepadMapping_t *SDL_CreateMappingForWGIGamepad(SDL_JoystickGUID guid)
static GamepadMapping_t *SDL_CreateMappingForWGIGamepad(SDL_GUID guid)
{
SDL_bool existing;
char mapping_string[1024];
@ -867,7 +867,7 @@ static GamepadMapping_t *SDL_CreateMappingForWGIGamepad(SDL_JoystickGUID guid)
/*
* Helper function to scan the mappings database for a gamepad with the specified GUID
*/
static GamepadMapping_t *SDL_PrivateMatchGamepadMappingForGUID(SDL_JoystickGUID guid, SDL_bool match_version)
static GamepadMapping_t *SDL_PrivateMatchGamepadMappingForGUID(SDL_GUID guid, SDL_bool match_version)
{
GamepadMapping_t *mapping, *best_match = NULL;
Uint16 crc = 0;
@ -884,7 +884,7 @@ static GamepadMapping_t *SDL_PrivateMatchGamepadMappingForGUID(SDL_JoystickGUID
}
for (mapping = s_pSupportedGamepads; mapping; mapping = mapping->next) {
SDL_JoystickGUID mapping_guid;
SDL_GUID mapping_guid;
if (SDL_memcmp(&mapping->guid, &s_zeroGUID, sizeof(mapping->guid)) == 0) {
continue;
@ -919,7 +919,7 @@ static GamepadMapping_t *SDL_PrivateMatchGamepadMappingForGUID(SDL_JoystickGUID
/*
* Helper function to scan the mappings database for a gamepad with the specified GUID
*/
static GamepadMapping_t *SDL_PrivateGetGamepadMappingForGUID(SDL_JoystickGUID guid, SDL_bool adding_mapping)
static GamepadMapping_t *SDL_PrivateGetGamepadMappingForGUID(SDL_GUID guid, SDL_bool adding_mapping)
{
GamepadMapping_t *mapping;
@ -1528,7 +1528,7 @@ static char *SDL_PrivateGetGamepadMappingFromMappingString(const char *pMapping)
/*
* Helper function to add a mapping for a guid
*/
static GamepadMapping_t *SDL_PrivateAddMappingForGUID(SDL_JoystickGUID jGUID, const char *mappingString, SDL_bool *existing, SDL_GamepadMappingPriority priority)
static GamepadMapping_t *SDL_PrivateAddMappingForGUID(SDL_GUID jGUID, const char *mappingString, SDL_bool *existing, SDL_GamepadMappingPriority priority)
{
char *pchName;
char *pchMapping;
@ -1656,7 +1656,7 @@ static GamepadMapping_t *SDL_PrivateAddMappingForGUID(SDL_JoystickGUID jGUID, co
/*
* Helper function to determine pre-calculated offset to certain joystick mappings
*/
static GamepadMapping_t *SDL_PrivateGetGamepadMappingForNameAndGUID(const char *name, SDL_JoystickGUID guid)
static GamepadMapping_t *SDL_PrivateGetGamepadMappingForNameAndGUID(const char *name, SDL_GUID guid)
{
GamepadMapping_t *mapping;
@ -1713,7 +1713,7 @@ static void SDL_PrivateAppendToMappingString(char *mapping_string,
}
static GamepadMapping_t *SDL_PrivateGenerateAutomaticGamepadMapping(const char *name,
SDL_JoystickGUID guid,
SDL_GUID guid,
SDL_GamepadMapping *raw_map)
{
SDL_bool existing;
@ -1772,7 +1772,7 @@ static GamepadMapping_t *SDL_PrivateGenerateAutomaticGamepadMapping(const char *
static GamepadMapping_t *SDL_PrivateGetGamepadMapping(SDL_JoystickID instance_id, SDL_bool create_mapping)
{
const char *name;
SDL_JoystickGUID guid;
SDL_GUID guid;
GamepadMapping_t *mapping;
SDL_AssertJoysticksLocked();
@ -1926,7 +1926,7 @@ static int SDL_PrivateAddGamepadMapping(const char *mappingString, SDL_GamepadMa
{
char *remapped = NULL;
char *pchGUID;
SDL_JoystickGUID jGUID;
SDL_GUID jGUID;
SDL_bool is_default_mapping = SDL_FALSE;
SDL_bool is_xinput_mapping = SDL_FALSE;
SDL_bool existing = SDL_FALSE;
@ -2028,7 +2028,7 @@ static int SDL_PrivateAddGamepadMapping(const char *mappingString, SDL_GamepadMa
} else if (!SDL_strcasecmp(pchGUID, "xinput")) {
is_xinput_mapping = SDL_TRUE;
}
jGUID = SDL_GetJoystickGUIDFromString(pchGUID);
jGUID = SDL_GUIDFromString(pchGUID);
SDL_free(pchGUID);
pGamepadMapping = SDL_PrivateAddMappingForGUID(jGUID, mappingString, &existing, priority);
@ -2072,17 +2072,17 @@ int SDL_AddGamepadMapping(const char *mapping)
/*
* Create a mapping string for a mapping
*/
static char *CreateMappingString(GamepadMapping_t *mapping, SDL_JoystickGUID guid)
static char *CreateMappingString(GamepadMapping_t *mapping, SDL_GUID guid)
{
char *pMappingString, *pPlatformString;
char pchGUID[33];
const char *pchGUID;
size_t needed;
SDL_bool need_platform = SDL_FALSE;
const char *platform = NULL;
SDL_AssertJoysticksLocked();
SDL_GetJoystickGUIDString(guid, pchGUID, sizeof(pchGUID));
pchGUID = SDL_GUIDToString(guid);
/* allocate enough memory for GUID + ',' + name + ',' + mapping + \0 */
needed = SDL_strlen(pchGUID) + 1 + SDL_strlen(mapping->name) + 1 + SDL_strlen(mapping->mapping) + 1;
@ -2203,7 +2203,7 @@ const char * const *SDL_GetGamepadMappings(int *count)
/*
* Get the mapping string for this GUID
*/
const char *SDL_GetGamepadMappingForGUID(SDL_JoystickGUID guid)
const char *SDL_GetGamepadMappingForGUID(SDL_GUID guid)
{
char *retval;
@ -2245,7 +2245,7 @@ const char *SDL_GetGamepadMapping(SDL_Gamepad *gamepad)
*/
int SDL_SetGamepadMapping(SDL_JoystickID instance_id, const char *mapping)
{
SDL_JoystickGUID guid = SDL_GetJoystickGUIDForID(instance_id);
SDL_GUID guid = SDL_GetJoystickGUIDForID(instance_id);
int retval = -1;
if (SDL_memcmp(&guid, &s_zeroGUID, sizeof(guid)) == 0) {
@ -2447,7 +2447,7 @@ int SDL_GetGamepadPlayerIndexForID(SDL_JoystickID instance_id)
return SDL_GetJoystickPlayerIndexForID(instance_id);
}
SDL_JoystickGUID SDL_GetGamepadGUIDForID(SDL_JoystickID instance_id)
SDL_GUID SDL_GetGamepadGUIDForID(SDL_JoystickID instance_id)
{
return SDL_GetJoystickGUIDForID(instance_id);
}
@ -2524,9 +2524,9 @@ const char *SDL_GetGamepadMappingForID(SDL_JoystickID instance_id)
{
GamepadMapping_t *mapping = SDL_PrivateGetGamepadMapping(instance_id, SDL_TRUE);
if (mapping) {
char pchGUID[33];
const SDL_JoystickGUID guid = SDL_GetJoystickGUIDForID(instance_id);
SDL_GetJoystickGUIDString(guid, pchGUID, sizeof(pchGUID));
const char *pchGUID;
const SDL_GUID guid = SDL_GetJoystickGUIDForID(instance_id);
pchGUID = SDL_GUIDToString(guid);
SDL_asprintf(&retval, "%s,%s,%s", pchGUID, mapping->name, mapping->mapping);
}
}
@ -2538,7 +2538,7 @@ const char *SDL_GetGamepadMappingForID(SDL_JoystickID instance_id)
/*
* Return 1 if the joystick with this name and GUID is a supported gamepad
*/
SDL_bool SDL_IsGamepadNameAndGUID(const char *name, SDL_JoystickGUID guid)
SDL_bool SDL_IsGamepadNameAndGUID(const char *name, SDL_GUID guid)
{
SDL_bool retval;
@ -2588,7 +2588,7 @@ SDL_bool SDL_IsGamepad(SDL_JoystickID instance_id)
/*
* Return 1 if the gamepad should be ignored by SDL
*/
SDL_bool SDL_ShouldIgnoreGamepad(const char *name, SDL_JoystickGUID guid)
SDL_bool SDL_ShouldIgnoreGamepad(const char *name, SDL_GUID guid)
{
Uint16 vendor;
Uint16 product;

View File

@ -36,10 +36,10 @@ extern void SDL_PrivateGamepadAdded(SDL_JoystickID instance_id);
extern void SDL_PrivateGamepadRemoved(SDL_JoystickID instance_id);
/* Function to return whether a joystick name and GUID is a gamepad */
extern SDL_bool SDL_IsGamepadNameAndGUID(const char *name, SDL_JoystickGUID guid);
extern SDL_bool SDL_IsGamepadNameAndGUID(const char *name, SDL_GUID guid);
/* Function to return whether a gamepad should be ignored */
extern SDL_bool SDL_ShouldIgnoreGamepad(const char *name, SDL_JoystickGUID guid);
extern SDL_bool SDL_ShouldIgnoreGamepad(const char *name, SDL_GUID guid);
/* Handle delayed guide button on a gamepad */
extern void SDL_GamepadHandleDelayedGuideButton(SDL_Joystick *joystick);

View File

@ -848,7 +848,7 @@ static SDL_bool SDL_JoystickAxesCenteredAtZero(SDL_Joystick *joystick)
static SDL_bool IsROGAlly(SDL_Joystick *joystick)
{
Uint16 vendor, product;
SDL_JoystickGUID guid = SDL_GetJoystickGUID(joystick);
SDL_GUID guid = SDL_GetJoystickGUID(joystick);
/* The ROG Ally controller spoofs an Xbox 360 controller */
SDL_GetJoystickGUIDInfo(guid, &vendor, &product, NULL, NULL);
@ -917,7 +917,7 @@ static SDL_bool ShouldAttemptSensorFusion(SDL_Joystick *joystick, SDL_bool *inve
if (hint) {
SDL_vidpid_list gamepads;
SDL_JoystickGUID guid;
SDL_GUID guid;
Uint16 vendor, product;
SDL_bool enabled;
SDL_zero(gamepads);
@ -2491,7 +2491,7 @@ SDL_bool SDL_JoystickEventsEnabled(void)
return enabled;
}
void SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *product, Uint16 *version, Uint16 *crc16)
void SDL_GetJoystickGUIDInfo(SDL_GUID guid, Uint16 *vendor, Uint16 *product, Uint16 *version, Uint16 *crc16)
{
Uint16 *guid16 = (Uint16 *)guid.data;
Uint16 bus = SDL_Swap16LE(guid16[0]);
@ -2708,9 +2708,9 @@ char *SDL_CreateJoystickName(Uint16 vendor, Uint16 product, const char *vendor_n
return name;
}
SDL_JoystickGUID SDL_CreateJoystickGUID(Uint16 bus, Uint16 vendor, Uint16 product, Uint16 version, const char *vendor_name, const char *product_name, Uint8 driver_signature, Uint8 driver_data)
SDL_GUID SDL_CreateJoystickGUID(Uint16 bus, Uint16 vendor, Uint16 product, Uint16 version, const char *vendor_name, const char *product_name, Uint8 driver_signature, Uint8 driver_data)
{
SDL_JoystickGUID guid;
SDL_GUID guid;
Uint16 *guid16 = (Uint16 *)guid.data;
Uint16 crc = 0;
@ -2752,33 +2752,33 @@ SDL_JoystickGUID SDL_CreateJoystickGUID(Uint16 bus, Uint16 vendor, Uint16 produc
return guid;
}
SDL_JoystickGUID SDL_CreateJoystickGUIDForName(const char *name)
SDL_GUID SDL_CreateJoystickGUIDForName(const char *name)
{
return SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_UNKNOWN, 0, 0, 0, NULL, name, 0, 0);
}
void SDL_SetJoystickGUIDVendor(SDL_JoystickGUID *guid, Uint16 vendor)
void SDL_SetJoystickGUIDVendor(SDL_GUID *guid, Uint16 vendor)
{
Uint16 *guid16 = (Uint16 *)guid->data;
guid16[2] = SDL_Swap16LE(vendor);
}
void SDL_SetJoystickGUIDProduct(SDL_JoystickGUID *guid, Uint16 product)
void SDL_SetJoystickGUIDProduct(SDL_GUID *guid, Uint16 product)
{
Uint16 *guid16 = (Uint16 *)guid->data;
guid16[4] = SDL_Swap16LE(product);
}
void SDL_SetJoystickGUIDVersion(SDL_JoystickGUID *guid, Uint16 version)
void SDL_SetJoystickGUIDVersion(SDL_GUID *guid, Uint16 version)
{
Uint16 *guid16 = (Uint16 *)guid->data;
guid16[6] = SDL_Swap16LE(version);
}
void SDL_SetJoystickGUIDCRC(SDL_JoystickGUID *guid, Uint16 crc)
void SDL_SetJoystickGUIDCRC(SDL_GUID *guid, Uint16 crc)
{
Uint16 *guid16 = (Uint16 *)guid->data;
@ -2869,7 +2869,7 @@ SDL_GamepadType SDL_GetGamepadTypeFromVIDPID(Uint16 vendor, Uint16 product, cons
return type;
}
SDL_GamepadType SDL_GetGamepadTypeFromGUID(SDL_JoystickGUID guid, const char *name)
SDL_GamepadType SDL_GetGamepadTypeFromGUID(SDL_GUID guid, const char *name)
{
SDL_GamepadType type;
Uint16 vendor, product;
@ -2890,7 +2890,7 @@ SDL_GamepadType SDL_GetGamepadTypeFromGUID(SDL_JoystickGUID guid, const char *na
return type;
}
SDL_bool SDL_JoystickGUIDUsesVersion(SDL_JoystickGUID guid)
SDL_bool SDL_JoystickGUIDUsesVersion(SDL_GUID guid)
{
Uint16 vendor, product;
@ -3110,32 +3110,32 @@ SDL_bool SDL_IsJoystickSteamDeck(Uint16 vendor_id, Uint16 product_id)
return eType == k_eControllerType_SteamControllerNeptune;
}
SDL_bool SDL_IsJoystickXInput(SDL_JoystickGUID guid)
SDL_bool SDL_IsJoystickXInput(SDL_GUID guid)
{
return (guid.data[14] == 'x') ? SDL_TRUE : SDL_FALSE;
}
SDL_bool SDL_IsJoystickWGI(SDL_JoystickGUID guid)
SDL_bool SDL_IsJoystickWGI(SDL_GUID guid)
{
return (guid.data[14] == 'w') ? SDL_TRUE : SDL_FALSE;
}
SDL_bool SDL_IsJoystickHIDAPI(SDL_JoystickGUID guid)
SDL_bool SDL_IsJoystickHIDAPI(SDL_GUID guid)
{
return (guid.data[14] == 'h') ? SDL_TRUE : SDL_FALSE;
}
SDL_bool SDL_IsJoystickMFI(SDL_JoystickGUID guid)
SDL_bool SDL_IsJoystickMFI(SDL_GUID guid)
{
return (guid.data[14] == 'm') ? SDL_TRUE : SDL_FALSE;
}
SDL_bool SDL_IsJoystickRAWINPUT(SDL_JoystickGUID guid)
SDL_bool SDL_IsJoystickRAWINPUT(SDL_GUID guid)
{
return (guid.data[14] == 'r') ? SDL_TRUE : SDL_FALSE;
}
SDL_bool SDL_IsJoystickVIRTUAL(SDL_JoystickGUID guid)
SDL_bool SDL_IsJoystickVIRTUAL(SDL_GUID guid)
{
return (guid.data[14] == 'v') ? SDL_TRUE : SDL_FALSE;
}
@ -3160,7 +3160,7 @@ static SDL_bool SDL_IsJoystickThrottle(Uint16 vendor_id, Uint16 product_id)
return SDL_VIDPIDInList(vendor_id, product_id, &throttle_devices);
}
static SDL_JoystickType SDL_GetJoystickGUIDType(SDL_JoystickGUID guid)
static SDL_JoystickType SDL_GetJoystickGUIDType(SDL_GUID guid)
{
Uint16 vendor;
Uint16 product;
@ -3230,7 +3230,7 @@ static SDL_JoystickType SDL_GetJoystickGUIDType(SDL_JoystickGUID guid)
return SDL_JOYSTICK_TYPE_UNKNOWN;
}
SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid)
SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_GUID guid)
{
Uint16 vendor;
Uint16 product;
@ -3255,11 +3255,11 @@ SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid)
}
/* return the guid for this index */
SDL_JoystickGUID SDL_GetJoystickGUIDForID(SDL_JoystickID instance_id)
SDL_GUID SDL_GetJoystickGUIDForID(SDL_JoystickID instance_id)
{
SDL_JoystickDriver *driver;
int device_index;
SDL_JoystickGUID guid;
SDL_GUID guid;
SDL_LockJoysticks();
if (SDL_GetDriverAndJoystickIndex(instance_id, &driver, &device_index)) {
@ -3282,7 +3282,7 @@ Uint16 SDL_GetJoystickVendorForID(SDL_JoystickID instance_id)
if (info) {
vendor = info->vendor_id;
} else {
SDL_JoystickGUID guid = SDL_GetJoystickGUIDForID(instance_id);
SDL_GUID guid = SDL_GetJoystickGUIDForID(instance_id);
SDL_GetJoystickGUIDInfo(guid, &vendor, NULL, NULL, NULL);
}
@ -3301,7 +3301,7 @@ Uint16 SDL_GetJoystickProductForID(SDL_JoystickID instance_id)
if (info) {
product = info->product_id;
} else {
SDL_JoystickGUID guid = SDL_GetJoystickGUIDForID(instance_id);
SDL_GUID guid = SDL_GetJoystickGUIDForID(instance_id);
SDL_GetJoystickGUIDInfo(guid, NULL, &product, NULL, NULL);
}
@ -3313,7 +3313,7 @@ Uint16 SDL_GetJoystickProductForID(SDL_JoystickID instance_id)
Uint16 SDL_GetJoystickProductVersionForID(SDL_JoystickID instance_id)
{
Uint16 version;
SDL_JoystickGUID guid = SDL_GetJoystickGUIDForID(instance_id);
SDL_GUID guid = SDL_GetJoystickGUIDForID(instance_id);
SDL_GetJoystickGUIDInfo(guid, NULL, NULL, &version, NULL);
return version;
@ -3322,7 +3322,7 @@ Uint16 SDL_GetJoystickProductVersionForID(SDL_JoystickID instance_id)
SDL_JoystickType SDL_GetJoystickTypeForID(SDL_JoystickID instance_id)
{
SDL_JoystickType type;
SDL_JoystickGUID guid = SDL_GetJoystickGUIDForID(instance_id);
SDL_GUID guid = SDL_GetJoystickGUIDForID(instance_id);
type = SDL_GetJoystickGUIDType(guid);
if (type == SDL_JOYSTICK_TYPE_UNKNOWN) {
@ -3333,13 +3333,13 @@ SDL_JoystickType SDL_GetJoystickTypeForID(SDL_JoystickID instance_id)
return type;
}
SDL_JoystickGUID SDL_GetJoystickGUID(SDL_Joystick *joystick)
SDL_GUID SDL_GetJoystickGUID(SDL_Joystick *joystick)
{
SDL_JoystickGUID retval;
SDL_GUID retval;
SDL_LockJoysticks();
{
static SDL_JoystickGUID emptyGUID;
static SDL_GUID emptyGUID;
CHECK_JOYSTICK_MAGIC(joystick, emptyGUID);
@ -3363,7 +3363,7 @@ Uint16 SDL_GetJoystickVendor(SDL_Joystick *joystick)
if (info) {
vendor = info->vendor_id;
} else {
SDL_JoystickGUID guid = SDL_GetJoystickGUID(joystick);
SDL_GUID guid = SDL_GetJoystickGUID(joystick);
SDL_GetJoystickGUIDInfo(guid, &vendor, NULL, NULL, NULL);
}
@ -3386,7 +3386,7 @@ Uint16 SDL_GetJoystickProduct(SDL_Joystick *joystick)
if (info) {
product = info->product_id;
} else {
SDL_JoystickGUID guid = SDL_GetJoystickGUID(joystick);
SDL_GUID guid = SDL_GetJoystickGUID(joystick);
SDL_GetJoystickGUIDInfo(guid, NULL, &product, NULL, NULL);
}
@ -3399,7 +3399,7 @@ Uint16 SDL_GetJoystickProduct(SDL_Joystick *joystick)
Uint16 SDL_GetJoystickProductVersion(SDL_Joystick *joystick)
{
Uint16 version;
SDL_JoystickGUID guid = SDL_GetJoystickGUID(joystick);
SDL_GUID guid = SDL_GetJoystickGUID(joystick);
SDL_GetJoystickGUIDInfo(guid, NULL, NULL, &version, NULL);
return version;
@ -3438,7 +3438,7 @@ const char *SDL_GetJoystickSerial(SDL_Joystick *joystick)
SDL_JoystickType SDL_GetJoystickType(SDL_Joystick *joystick)
{
SDL_JoystickType type;
SDL_JoystickGUID guid = SDL_GetJoystickGUID(joystick);
SDL_GUID guid = SDL_GetJoystickGUID(joystick);
type = SDL_GetJoystickGUIDType(guid);
if (type == SDL_JOYSTICK_TYPE_UNKNOWN) {
@ -3455,18 +3455,6 @@ SDL_JoystickType SDL_GetJoystickType(SDL_Joystick *joystick)
return type;
}
/* convert the guid to a printable string */
int SDL_GetJoystickGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID)
{
return SDL_GUIDToString(guid, pszGUID, cbGUID);
}
/* convert the string version of a joystick guid to the struct */
SDL_JoystickGUID SDL_GetJoystickGUIDFromString(const char *pchGUID)
{
return SDL_GUIDFromString(pchGUID);
}
void SDL_SendJoystickPowerInfo(SDL_Joystick *joystick, SDL_PowerState state, int percent)
{
SDL_AssertJoysticksLocked();

View File

@ -62,29 +62,29 @@ extern SDL_bool SDL_JoystickHandledByAnotherDriver(struct SDL_JoystickDriver *dr
extern char *SDL_CreateJoystickName(Uint16 vendor, Uint16 product, const char *vendor_name, const char *product_name);
/* Function to create a GUID for a joystick based on the VID/PID and name */
extern SDL_JoystickGUID SDL_CreateJoystickGUID(Uint16 bus, Uint16 vendor, Uint16 product, Uint16 version, const char *vendor_name, const char *product_name, Uint8 driver_signature, Uint8 driver_data);
extern SDL_GUID SDL_CreateJoystickGUID(Uint16 bus, Uint16 vendor, Uint16 product, Uint16 version, const char *vendor_name, const char *product_name, Uint8 driver_signature, Uint8 driver_data);
/* Function to create a GUID for a joystick based on the name, with no VID/PID information */
extern SDL_JoystickGUID SDL_CreateJoystickGUIDForName(const char *name);
extern SDL_GUID SDL_CreateJoystickGUIDForName(const char *name);
/* Function to set the vendor field of a joystick GUID */
extern void SDL_SetJoystickGUIDVendor(SDL_JoystickGUID *guid, Uint16 vendor);
extern void SDL_SetJoystickGUIDVendor(SDL_GUID *guid, Uint16 vendor);
/* Function to set the product field of a joystick GUID */
extern void SDL_SetJoystickGUIDProduct(SDL_JoystickGUID *guid, Uint16 product);
extern void SDL_SetJoystickGUIDProduct(SDL_GUID *guid, Uint16 product);
/* Function to set the version field of a joystick GUID */
extern void SDL_SetJoystickGUIDVersion(SDL_JoystickGUID *guid, Uint16 version);
extern void SDL_SetJoystickGUIDVersion(SDL_GUID *guid, Uint16 version);
/* Function to set the CRC field of a joystick GUID */
extern void SDL_SetJoystickGUIDCRC(SDL_JoystickGUID *guid, Uint16 crc);
extern void SDL_SetJoystickGUIDCRC(SDL_GUID *guid, Uint16 crc);
/* Function to return the type of a controller */
extern SDL_GamepadType SDL_GetGamepadTypeFromVIDPID(Uint16 vendor, Uint16 product, const char *name, SDL_bool forUI);
extern SDL_GamepadType SDL_GetGamepadTypeFromGUID(SDL_JoystickGUID guid, const char *name);
extern SDL_GamepadType SDL_GetGamepadTypeFromGUID(SDL_GUID guid, const char *name);
/* Function to return whether a joystick GUID uses the version field */
extern SDL_bool SDL_JoystickGUIDUsesVersion(SDL_JoystickGUID guid);
extern SDL_bool SDL_JoystickGUIDUsesVersion(SDL_GUID guid);
/* Function to return whether a joystick is an Xbox One controller */
extern SDL_bool SDL_IsJoystickXboxOne(Uint16 vendor_id, Uint16 product_id);
@ -133,25 +133,25 @@ extern SDL_bool SDL_IsJoystickSteamController(Uint16 vendor_id, Uint16 product_i
extern SDL_bool SDL_IsJoystickSteamDeck(Uint16 vendor_id, Uint16 product_id);
/* Function to return whether a joystick guid comes from the XInput driver */
extern SDL_bool SDL_IsJoystickXInput(SDL_JoystickGUID guid);
extern SDL_bool SDL_IsJoystickXInput(SDL_GUID guid);
/* Function to return whether a joystick guid comes from the WGI driver */
extern SDL_bool SDL_IsJoystickWGI(SDL_JoystickGUID guid);
extern SDL_bool SDL_IsJoystickWGI(SDL_GUID guid);
/* Function to return whether a joystick guid comes from the HIDAPI driver */
extern SDL_bool SDL_IsJoystickHIDAPI(SDL_JoystickGUID guid);
extern SDL_bool SDL_IsJoystickHIDAPI(SDL_GUID guid);
/* Function to return whether a joystick guid comes from the MFI driver */
extern SDL_bool SDL_IsJoystickMFI(SDL_JoystickGUID guid);
extern SDL_bool SDL_IsJoystickMFI(SDL_GUID guid);
/* Function to return whether a joystick guid comes from the RAWINPUT driver */
extern SDL_bool SDL_IsJoystickRAWINPUT(SDL_JoystickGUID guid);
extern SDL_bool SDL_IsJoystickRAWINPUT(SDL_GUID guid);
/* Function to return whether a joystick guid comes from the Virtual driver */
extern SDL_bool SDL_IsJoystickVIRTUAL(SDL_JoystickGUID guid);
extern SDL_bool SDL_IsJoystickVIRTUAL(SDL_GUID guid);
/* Function to return whether a joystick should be ignored */
extern SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid);
extern SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_GUID guid);
/* Internal event queueing functions */
extern void SDL_PrivateJoystickAddTouchpad(SDL_Joystick *joystick, int nfingers);

View File

@ -80,7 +80,7 @@ struct SDL_Joystick
char *name _guarded; /* Joystick name - system dependent */
char *path _guarded; /* Joystick path - system dependent */
char *serial _guarded; /* Joystick serial */
SDL_JoystickGUID guid _guarded; /* Joystick guid */
SDL_GUID guid _guarded; /* Joystick guid */
Uint16 firmware_version _guarded; /* Firmware version, if available */
Uint64 steam_handle _guarded; /* Steam controller API handle */
@ -187,7 +187,7 @@ typedef struct SDL_JoystickDriver
void (*SetDevicePlayerIndex)(int device_index, int player_index);
/* Function to return the stable GUID for a plugged in device */
SDL_JoystickGUID (*GetDeviceGUID)(int device_index);
SDL_GUID (*GetDeviceGUID)(int device_index);
/* Function to get the current instance id of the joystick located at device_index */
SDL_JoystickID (*GetDeviceInstanceID)(int device_index);

View File

@ -304,7 +304,7 @@ int Android_OnHat(int device_id, int hat_id, int x, int y)
int Android_AddJoystick(int device_id, const char *name, const char *desc, int vendor_id, int product_id, int button_mask, int naxes, int axis_mask, int nhats, SDL_bool can_rumble)
{
SDL_joylist_item *item;
SDL_JoystickGUID guid;
SDL_GUID guid;
int i;
int result = -1;
@ -551,7 +551,7 @@ static void ANDROID_JoystickSetDevicePlayerIndex(int device_index, int player_in
{
}
static SDL_JoystickGUID ANDROID_JoystickGetDeviceGUID(int device_index)
static SDL_GUID ANDROID_JoystickGetDeviceGUID(int device_index)
{
return GetJoystickByDevIndex(device_index)->guid;
}

View File

@ -41,7 +41,7 @@ typedef struct SDL_joylist_item
int device_instance;
int device_id; /* Android's device id */
char *name; /* "SideWinder 3D Pro" or whatever */
SDL_JoystickGUID guid;
SDL_GUID guid;
SDL_Joystick *joystick;
int nbuttons, naxes, nhats;
int dpad_state;

View File

@ -922,10 +922,10 @@ static void IOS_JoystickSetDevicePlayerIndex(int device_index, int player_index)
#endif
}
static SDL_JoystickGUID IOS_JoystickGetDeviceGUID(int device_index)
static SDL_GUID IOS_JoystickGetDeviceGUID(int device_index)
{
SDL_JoystickDeviceItem *device = GetDeviceForIndex(device_index);
SDL_JoystickGUID guid;
SDL_GUID guid;
if (device) {
guid = device->guid;
} else {

View File

@ -40,7 +40,7 @@ typedef struct joystick_hwdata
char *name;
SDL_Joystick *joystick;
SDL_JoystickID instance_id;
SDL_JoystickGUID guid;
SDL_GUID guid;
int naxes;
int nbuttons;

View File

@ -173,7 +173,7 @@ typedef struct SDL_joylist_item
SDL_JoystickID device_instance;
char *path; /* "/dev/uhid0" or whatever */
char *name; /* "SideWinder 3D Pro" or whatever */
SDL_JoystickGUID guid;
SDL_GUID guid;
dev_t devnum;
struct SDL_joylist_item *next;
} SDL_joylist_item;
@ -393,7 +393,7 @@ static int MaybeAddDevice(const char *path)
{
struct stat sb;
char *name = NULL;
SDL_JoystickGUID guid;
SDL_GUID guid;
SDL_joylist_item *item;
struct joystick_hwdata *hw;
@ -556,7 +556,7 @@ static void BSD_JoystickSetDevicePlayerIndex(int device_index, int player_index)
{
}
static SDL_JoystickGUID BSD_JoystickGetDeviceGUID(int device_index)
static SDL_GUID BSD_JoystickGetDeviceGUID(int device_index)
{
return GetJoystickByDevIndex(device_index)->guid;
}

View File

@ -743,10 +743,10 @@ static void DARWIN_JoystickSetDevicePlayerIndex(int device_index, int player_ind
{
}
static SDL_JoystickGUID DARWIN_JoystickGetDeviceGUID(int device_index)
static SDL_GUID DARWIN_JoystickGetDeviceGUID(int device_index)
{
recDevice *device = GetDeviceForIndex(device_index);
SDL_JoystickGUID guid;
SDL_GUID guid;
if (device) {
guid = device->guid;
} else {

View File

@ -70,7 +70,7 @@ struct joystick_hwdata
SDL_bool runLoopAttached; /* is 'deviceRef' attached to a CFRunLoop? */
int instance_id;
SDL_JoystickGUID guid;
SDL_GUID guid;
int steam_virtual_gamepad_slot;
struct joystick_hwdata *pNext; /* next device */

View File

@ -70,9 +70,9 @@ static void DUMMY_JoystickSetDevicePlayerIndex(int device_index, int player_inde
{
}
static SDL_JoystickGUID DUMMY_JoystickGetDeviceGUID(int device_index)
static SDL_GUID DUMMY_JoystickGetDeviceGUID(int device_index)
{
SDL_JoystickGUID guid;
SDL_GUID guid;
SDL_zero(guid);
return guid;
}

View File

@ -378,7 +378,7 @@ static void EMSCRIPTEN_JoystickClose(SDL_Joystick *joystick)
}
}
static SDL_JoystickGUID EMSCRIPTEN_JoystickGetDeviceGUID(int device_index)
static SDL_GUID EMSCRIPTEN_JoystickGetDeviceGUID(int device_index)
{
/* the GUID is just the name for now */
const char *name = EMSCRIPTEN_JoystickGetDeviceName(device_index);

View File

@ -35,7 +35,7 @@ typedef struct GAMEINPUT_InternalDevice
IGameInputDevice *device;
char path[(APP_LOCAL_DEVICE_ID_SIZE * 2) + 1];
char *name;
SDL_JoystickGUID guid; /* generated by SDL */
SDL_GUID guid; /* generated by SDL */
SDL_JoystickID device_instance; /* generated by SDL */
const GameInputDeviceInfo *info;
SDL_bool isAdded;
@ -331,7 +331,7 @@ static void GAMEINPUT_JoystickSetDevicePlayerIndex(int device_index, int player_
{
}
static SDL_JoystickGUID GAMEINPUT_JoystickGetDeviceGUID(int device_index)
static SDL_GUID GAMEINPUT_JoystickGetDeviceGUID(int device_index)
{
return GAMEINPUT_InternalFindByIndex(device_index)->guid;
}

View File

@ -255,7 +255,7 @@ extern "C"
SDL_joyname[0] = NULL;
}
static SDL_JoystickGUID HAIKU_JoystickGetDeviceGUID(int device_index)
static SDL_GUID HAIKU_JoystickGetDeviceGUID(int device_index)
{
/* the GUID is just the name for now */
const char *name = HAIKU_JoystickGetDeviceName(device_index);

View File

@ -1324,7 +1324,7 @@ SDL_bool HIDAPI_IsDevicePresent(Uint16 vendor_id, Uint16 product_id, Uint16 vers
return result;
}
SDL_JoystickType HIDAPI_GetJoystickTypeFromGUID(SDL_JoystickGUID guid)
SDL_JoystickType HIDAPI_GetJoystickTypeFromGUID(SDL_GUID guid)
{
SDL_HIDAPI_Device *device;
SDL_JoystickType type = SDL_JOYSTICK_TYPE_UNKNOWN;
@ -1341,7 +1341,7 @@ SDL_JoystickType HIDAPI_GetJoystickTypeFromGUID(SDL_JoystickGUID guid)
return type;
}
SDL_GamepadType HIDAPI_GetGamepadTypeFromGUID(SDL_JoystickGUID guid)
SDL_GamepadType HIDAPI_GetGamepadTypeFromGUID(SDL_GUID guid)
{
SDL_HIDAPI_Device *device;
SDL_GamepadType type = SDL_GAMEPAD_TYPE_STANDARD;
@ -1455,10 +1455,10 @@ static void HIDAPI_JoystickSetDevicePlayerIndex(int device_index, int player_ind
}
}
static SDL_JoystickGUID HIDAPI_JoystickGetDeviceGUID(int device_index)
static SDL_GUID HIDAPI_JoystickGetDeviceGUID(int device_index)
{
SDL_HIDAPI_Device *device;
SDL_JoystickGUID guid;
SDL_GUID guid;
device = HIDAPI_GetDeviceByIndex(device_index, NULL);
if (device) {

View File

@ -74,7 +74,7 @@ typedef struct SDL_HIDAPI_Device
Uint16 product_id;
Uint16 version;
char *serial;
SDL_JoystickGUID guid;
SDL_GUID guid;
int interface_number; /* Available on Windows and Linux */
int interface_class;
int interface_subclass;
@ -158,10 +158,10 @@ extern SDL_bool HIDAPI_IsDeviceTypePresent(SDL_GamepadType type);
extern SDL_bool HIDAPI_IsDevicePresent(Uint16 vendor_id, Uint16 product_id, Uint16 version, const char *name);
/* Return the type of a joystick if it's present and supported */
extern SDL_JoystickType HIDAPI_GetJoystickTypeFromGUID(SDL_JoystickGUID guid);
extern SDL_JoystickType HIDAPI_GetJoystickTypeFromGUID(SDL_GUID guid);
/* Return the type of a game controller if it's present and supported */
extern SDL_GamepadType HIDAPI_GetGamepadTypeFromGUID(SDL_JoystickGUID guid);
extern SDL_GamepadType HIDAPI_GetGamepadTypeFromGUID(SDL_GUID guid);
extern void HIDAPI_UpdateDevices(void);
extern void HIDAPI_SetDeviceName(SDL_HIDAPI_Device *device, const char *name);

View File

@ -153,7 +153,7 @@ typedef struct SDL_joylist_item
SDL_JoystickID device_instance;
char *path; /* "/dev/input/event2" or whatever */
char *name; /* "SideWinder 3D Pro" or whatever */
SDL_JoystickGUID guid;
SDL_GUID guid;
dev_t devnum;
int steam_virtual_gamepad_slot;
struct joystick_hwdata *hwdata;
@ -276,7 +276,7 @@ static int GuessIsSensor(int fd)
return 0;
}
static int IsJoystick(const char *path, int *fd, char **name_return, Uint16 *vendor_return, Uint16 *product_return, SDL_JoystickGUID *guid)
static int IsJoystick(const char *path, int *fd, char **name_return, Uint16 *vendor_return, Uint16 *product_return, SDL_GUID *guid)
{
struct input_id inpid;
char *name;
@ -440,7 +440,7 @@ static void MaybeAddDevice(const char *path)
int fd = -1;
char *name = NULL;
Uint16 vendor, product;
SDL_JoystickGUID guid;
SDL_GUID guid;
SDL_joylist_item *item;
SDL_sensorlist_item *item_sensor;
@ -663,7 +663,7 @@ static void HandlePendingRemovals(void)
}
}
static SDL_bool SteamControllerConnectedCallback(const char *name, SDL_JoystickGUID guid, SDL_JoystickID *device_instance)
static SDL_bool SteamControllerConnectedCallback(const char *name, SDL_GUID guid, SDL_JoystickID *device_instance)
{
SDL_joylist_item *item;
@ -1186,7 +1186,7 @@ static void LINUX_JoystickSetDevicePlayerIndex(int device_index, int player_inde
{
}
static SDL_JoystickGUID LINUX_JoystickGetDeviceGUID(int device_index)
static SDL_GUID LINUX_JoystickGetDeviceGUID(int device_index)
{
return GetJoystickByDevIndex(device_index)->guid;
}

View File

@ -35,7 +35,7 @@ struct joystick_hwdata
int fd_sensor;
struct SDL_joylist_item *item;
struct SDL_sensorlist_item *item_sensor;
SDL_JoystickGUID guid;
SDL_GUID guid;
char *fname; /* Used in haptic subsystem */
SDL_bool ff_rumble;

View File

@ -76,9 +76,9 @@ static int N3DS_JoystickGetCount(void)
return 1;
}
static SDL_JoystickGUID N3DS_JoystickGetDeviceGUID(int device_index)
static SDL_GUID N3DS_JoystickGetDeviceGUID(int device_index)
{
SDL_JoystickGUID guid = SDL_CreateJoystickGUIDForName("Nintendo 3DS");
SDL_GUID guid = SDL_CreateJoystickGUIDForName("Nintendo 3DS");
return guid;
}

View File

@ -182,7 +182,7 @@ static void PS2_JoystickSetDevicePlayerIndex(int device_index, int player_index)
}
/* Function to return the stable GUID for a plugged in device */
static SDL_JoystickGUID PS2_JoystickGetDeviceGUID(int device_index)
static SDL_GUID PS2_JoystickGetDeviceGUID(int device_index)
{
/* the GUID is just the name for now */
const char *name = PS2_JoystickGetDeviceName(device_index);

View File

@ -137,7 +137,7 @@ static void PSP_JoystickSetDevicePlayerIndex(int device_index, int player_index)
{
}
static SDL_JoystickGUID PSP_JoystickGetDeviceGUID(int device_index)
static SDL_GUID PSP_JoystickGetDeviceGUID(int device_index)
{
/* the GUID is just the name for now */
const char *name = PSP_JoystickGetDeviceName(device_index);

View File

@ -24,7 +24,7 @@
#include "SDL_internal.h"
typedef SDL_bool (*SteamControllerConnectedCallback_t)(const char *name, SDL_JoystickGUID guid, SDL_JoystickID *device_instance);
typedef SDL_bool (*SteamControllerConnectedCallback_t)(const char *name, SDL_GUID guid, SDL_JoystickID *device_instance);
typedef void (*SteamControllerDisconnectedCallback_t)(SDL_JoystickID device_instance);
void SDL_InitSteamControllers(SteamControllerConnectedCallback_t connectedCallback,

View File

@ -534,11 +534,11 @@ static void VIRTUAL_JoystickSetDevicePlayerIndex(int device_index, int player_in
}
}
static SDL_JoystickGUID VIRTUAL_JoystickGetDeviceGUID(int device_index)
static SDL_GUID VIRTUAL_JoystickGetDeviceGUID(int device_index)
{
joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index);
if (!hwdata) {
SDL_JoystickGUID guid;
SDL_GUID guid;
SDL_zero(guid);
return guid;
}

View File

@ -50,7 +50,7 @@ typedef struct joystick_hwdata
SDL_bool attached;
char *name;
SDL_JoystickType type;
SDL_JoystickGUID guid;
SDL_GUID guid;
SDL_VirtualJoystickDesc desc;
Uint32 changes;
Sint16 *axes;

View File

@ -318,7 +318,7 @@ static void VITA_JoystickQuit(void)
{
}
static SDL_JoystickGUID VITA_JoystickGetDeviceGUID(int device_index)
static SDL_GUID VITA_JoystickGetDeviceGUID(int device_index)
{
/* the GUID is just the name for now */
const char *name = VITA_JoystickGetDeviceName(device_index);

View File

@ -111,7 +111,7 @@ typedef struct SDL_RAWINPUT_Device
Uint16 vendor_id;
Uint16 product_id;
Uint16 version;
SDL_JoystickGUID guid;
SDL_GUID guid;
SDL_bool is_xinput;
SDL_bool is_xboxone;
int steam_virtual_gamepad_slot;
@ -1215,7 +1215,7 @@ static void RAWINPUT_JoystickSetDevicePlayerIndex(int device_index, int player_i
{
}
static SDL_JoystickGUID RAWINPUT_JoystickGetDeviceGUID(int device_index)
static SDL_GUID RAWINPUT_JoystickGetDeviceGUID(int device_index)
{
return RAWINPUT_GetDeviceByIndex(device_index)->guid;
}

View File

@ -56,7 +56,7 @@ typedef struct WindowsGamingInputControllerState
SDL_JoystickID instance_id;
__x_ABI_CWindows_CGaming_CInput_CIRawGameController *controller;
char *name;
SDL_JoystickGUID guid;
SDL_GUID guid;
SDL_JoystickType type;
int steam_virtual_gamepad_slot;
} WindowsGamingInputControllerState;
@ -400,7 +400,7 @@ static HRESULT STDMETHODCALLTYPE IEventHandler_CRawGameControllerVtbl_InvokeAdde
hr = __x_ABI_CWindows_CGaming_CInput_CIRawGameController_QueryInterface(e, &IID___x_ABI_CWindows_CGaming_CInput_CIRawGameController, (void **)&controller);
if (SUCCEEDED(hr)) {
char *name = NULL;
SDL_JoystickGUID guid = { 0 };
SDL_GUID guid = { 0 };
Uint16 bus = SDL_HARDWARE_BUS_USB;
Uint16 vendor = 0;
Uint16 product = 0;
@ -703,7 +703,7 @@ static void WGI_JoystickSetDevicePlayerIndex(int device_index, int player_index)
{
}
static SDL_JoystickGUID WGI_JoystickGetDeviceGUID(int device_index)
static SDL_GUID WGI_JoystickGetDeviceGUID(int device_index)
{
return wgi.controllers[device_index].guid;
}

View File

@ -522,7 +522,7 @@ static void WINDOWS_JoystickSetDevicePlayerIndex(int device_index, int player_in
}
/* return the stable device guid for this device index */
static SDL_JoystickGUID WINDOWS_JoystickGetDeviceGUID(int device_index)
static SDL_GUID WINDOWS_JoystickGetDeviceGUID(int device_index)
{
JoyStick_DeviceData *device = SYS_Joystick;
int index;

View File

@ -33,7 +33,7 @@ extern "C" {
typedef struct JoyStick_DeviceData
{
SDL_JoystickGUID guid;
SDL_GUID guid;
char *joystickname;
Uint8 send_add_event;
SDL_JoystickID nInstanceID;
@ -70,7 +70,7 @@ typedef struct input_t
/* The private structure used to keep track of a joystick */
struct joystick_hwdata
{
SDL_JoystickGUID guid;
SDL_GUID guid;
#ifdef SDL_JOYSTICK_DINPUT
LPDIRECTINPUTDEVICE8 InputDevice;

View File

@ -106,40 +106,14 @@ TestGuidToString(void *arg)
SDLTest_AssertPass("Call to SDL_GUIDToString");
for (i = 0; i < NUM_TEST_GUIDS; ++i) {
const int guid_str_offset = 4;
char guid_str_buf[64];
char *guid_str = guid_str_buf + guid_str_offset;
const char *guid_str;
SDL_GUID guid;
int size;
upper_lower_to_bytestring(guid.data,
test_guids[i].upper, test_guids[i].lower);
/* Serialise to limited-length buffers */
for (size = 0; size <= 36; ++size) {
const Uint8 fill_char = (Uint8)(size + 0xa0);
Uint32 expected_prefix;
Uint32 actual_prefix;
int written_size;
SDL_memset(guid_str_buf, fill_char, sizeof(guid_str_buf));
SDL_GUIDToString(guid, guid_str, size);
/* Check bytes before guid_str_buf */
expected_prefix = fill_char | (fill_char << 8) | (fill_char << 16) | (((Uint32)fill_char) << 24);
SDL_memcpy(&actual_prefix, guid_str_buf, 4);
SDLTest_AssertCheck(expected_prefix == actual_prefix, "String buffer memory before output untouched, expected: %" SDL_PRIu32 ", got: %" SDL_PRIu32 ", at size=%d", expected_prefix, actual_prefix, size);
/* Check that we did not overwrite too much */
written_size = 0;
while ((guid_str[written_size] & 0xff) != fill_char && written_size < 256) {
++written_size;
}
SDLTest_AssertCheck(written_size <= size, "Output length is within expected bounds, with length %d: wrote %d of %d permitted bytes", size, written_size, size);
if (size >= 33) {
SDLTest_AssertCheck(SDL_strcmp(guid_str, test_guids[i].str) == 0, "GUID string equality, from string: %s", test_guids[i].str);
}
}
guid_str = SDL_GUIDToString(guid);
SDLTest_AssertCheck(SDL_strcmp(guid_str, test_guids[i].str) == 0, "Checking whether strings match, expected %s, got %s\n", test_guids[i].str, guid_str);
}
return TEST_COMPLETED;

View File

@ -918,9 +918,9 @@ static void AddController(SDL_JoystickID id, SDL_bool verbose)
if (verbose && !SDL_IsGamepad(id)) {
const char *name = SDL_GetJoystickName(joystick);
const char *path = SDL_GetJoystickPath(joystick);
char guid[33];
const char *guid;
SDL_Log("Opened joystick %s%s%s\n", name, path ? ", " : "", path ? path : "");
SDL_GetJoystickGUIDString(SDL_GetJoystickGUID(joystick), guid, sizeof(guid));
guid = SDL_GUIDToString(SDL_GetJoystickGUID(joystick));
SDL_Log("No gamepad mapping for %s\n", guid);
}
} else {

View File

@ -222,7 +222,7 @@ static void dump_state(void)
for (i = 0; i < pens_nr; ++i) {
SDL_PenID penid = pens[i];
SDL_GUID guid = SDL_GetPenGUID(penid);
char guid_str[33];
const char *guid_str;
float axes[SDL_PEN_NUM_AXES];
float x, y;
int k;
@ -232,7 +232,7 @@ static void dump_state(void)
char *type;
char *buttons_str;
SDL_GUIDToString(guid, guid_str, 33);
guid_str = SDL_GUIDToString(guid);
switch (SDL_GetPenType(penid)) {
case SDL_PEN_TYPE_ERASER: