Standardized the format of the SDL joystick GUID and added functions to retrieve the USB VID/PID from a joystick and game controller.

This commit is contained in:
Sam Lantinga 2016-11-10 17:19:34 -08:00
parent 8ee24a5254
commit 6fcf21b827
13 changed files with 294 additions and 76 deletions

View file

@ -1107,6 +1107,33 @@ SDL_GameControllerGetButton(SDL_GameController * gamecontroller, SDL_GameControl
return 0;
}
const char *
SDL_GameControllerName(SDL_GameController * gamecontroller)
{
if (!gamecontroller)
return NULL;
return gamecontroller->mapping.name;
}
Uint16
SDL_GameControllerGetVendor(SDL_GameController * gamecontroller)
{
return SDL_JoystickGetVendor(SDL_GameControllerGetJoystick(gamecontroller));
}
Uint16
SDL_GameControllerGetProduct(SDL_GameController * gamecontroller)
{
return SDL_JoystickGetProduct(SDL_GameControllerGetJoystick(gamecontroller));
}
Uint16
SDL_GameControllerGetProductVersion(SDL_GameController * gamecontroller)
{
return SDL_JoystickGetProductVersion(SDL_GameControllerGetJoystick(gamecontroller));
}
/*
* Return if the joystick in question is currently attached to the system,
* \return 0 if not plugged in, 1 if still present.
@ -1120,17 +1147,6 @@ SDL_GameControllerGetAttached(SDL_GameController * gamecontroller)
return SDL_JoystickGetAttached(gamecontroller->joystick);
}
const char *
SDL_GameControllerName(SDL_GameController * gamecontroller)
{
if (!gamecontroller)
return NULL;
return (gamecontroller->mapping.name);
}
/*
* Get the joystick for this controller
*/