SDL_GUIDToString() follows the SDL_GetStringRule
Also removed the distinction between SDL_GUID and SDL_JoystickGUID
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user