Added functions to get the platform dependent name for a joystick or game controller

This commit is contained in:
Sam Lantinga 2022-04-26 14:54:14 -07:00
parent b293888c7d
commit e551384a99
28 changed files with 306 additions and 26 deletions

View file

@ -1732,6 +1732,20 @@ SDL_GameControllerNameForIndex(int device_index)
}
/*
* Get the implementation dependent path of a controller
*/
const char *
SDL_GameControllerPathForIndex(int device_index)
{
ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMapping(device_index);
if (pSupportedController) {
return SDL_JoystickPathForIndex(device_index);
}
return NULL;
}
/**
* Get the type of a game controller.
*/
@ -2294,6 +2308,15 @@ SDL_GameControllerName(SDL_GameController *gamecontroller)
}
}
const char *
SDL_GameControllerPath(SDL_GameController *gamecontroller)
{
if (!gamecontroller)
return NULL;
return SDL_JoystickPath(SDL_GameControllerGetJoystick(gamecontroller));
}
SDL_GameControllerType
SDL_GameControllerGetType(SDL_GameController *gamecontroller)
{