src/joystick/SDL_gamecontroller.c
changeset 11916 e85247c4a60b
parent 11811 5d94cb6b24d3
child 11921 88a2982221ec
     1.1 --- a/src/joystick/SDL_gamecontroller.c	Thu Mar 01 09:32:53 2018 -0800
     1.2 +++ b/src/joystick/SDL_gamecontroller.c	Fri Mar 02 10:56:21 2018 -0800
     1.3 @@ -1263,7 +1263,11 @@
     1.4  {
     1.5      ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMapping(device_index);
     1.6      if (pSupportedController) {
     1.7 -        return pSupportedController->name;
     1.8 +        if (SDL_strcmp(pSupportedController->name, "*") == 0) {
     1.9 +            return SDL_JoystickNameForIndex(device_index);
    1.10 +        } else {
    1.11 +            return pSupportedController->name;
    1.12 +        }
    1.13      }
    1.14      return NULL;
    1.15  }
    1.16 @@ -1552,7 +1556,11 @@
    1.17      if (!gamecontroller)
    1.18          return NULL;
    1.19  
    1.20 -    return gamecontroller->name;
    1.21 +    if (SDL_strcmp(gamecontroller->name, "*") == 0) {
    1.22 +        return SDL_JoystickName(SDL_GameControllerGetJoystick(gamecontroller));
    1.23 +    } else {
    1.24 +        return gamecontroller->name;
    1.25 +    }
    1.26  }
    1.27  
    1.28  Uint16