Use the real controller name for game controllers on iOS and Apple TV

This commit is contained in:
Sam Lantinga 2018-03-02 10:56:21 -08:00
parent 4f695bc5e5
commit 003c0dce9c
2 changed files with 12 additions and 4 deletions

View file

@ -1263,7 +1263,11 @@ SDL_GameControllerNameForIndex(int device_index)
{
ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMapping(device_index);
if (pSupportedController) {
return pSupportedController->name;
if (SDL_strcmp(pSupportedController->name, "*") == 0) {
return SDL_JoystickNameForIndex(device_index);
} else {
return pSupportedController->name;
}
}
return NULL;
}
@ -1552,7 +1556,11 @@ SDL_GameControllerName(SDL_GameController * gamecontroller)
if (!gamecontroller)
return NULL;
return gamecontroller->name;
if (SDL_strcmp(gamecontroller->name, "*") == 0) {
return SDL_JoystickName(SDL_GameControllerGetJoystick(gamecontroller));
} else {
return gamecontroller->name;
}
}
Uint16