src/joystick/SDL_gamecontroller.c
changeset 11916 e85247c4a60b
parent 11811 5d94cb6b24d3
child 11921 88a2982221ec
equal deleted inserted replaced
11915:b8c894792946 11916:e85247c4a60b
  1261 const char *
  1261 const char *
  1262 SDL_GameControllerNameForIndex(int device_index)
  1262 SDL_GameControllerNameForIndex(int device_index)
  1263 {
  1263 {
  1264     ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMapping(device_index);
  1264     ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMapping(device_index);
  1265     if (pSupportedController) {
  1265     if (pSupportedController) {
  1266         return pSupportedController->name;
  1266         if (SDL_strcmp(pSupportedController->name, "*") == 0) {
       
  1267             return SDL_JoystickNameForIndex(device_index);
       
  1268         } else {
       
  1269             return pSupportedController->name;
       
  1270         }
  1267     }
  1271     }
  1268     return NULL;
  1272     return NULL;
  1269 }
  1273 }
  1270 
  1274 
  1271 
  1275 
  1550 SDL_GameControllerName(SDL_GameController * gamecontroller)
  1554 SDL_GameControllerName(SDL_GameController * gamecontroller)
  1551 {
  1555 {
  1552     if (!gamecontroller)
  1556     if (!gamecontroller)
  1553         return NULL;
  1557         return NULL;
  1554 
  1558 
  1555     return gamecontroller->name;
  1559     if (SDL_strcmp(gamecontroller->name, "*") == 0) {
       
  1560         return SDL_JoystickName(SDL_GameControllerGetJoystick(gamecontroller));
       
  1561     } else {
       
  1562         return gamecontroller->name;
       
  1563     }
  1556 }
  1564 }
  1557 
  1565 
  1558 Uint16
  1566 Uint16
  1559 SDL_GameControllerGetVendor(SDL_GameController * gamecontroller)
  1567 SDL_GameControllerGetVendor(SDL_GameController * gamecontroller)
  1560 {
  1568 {