/* Get the player index of an opened joystick, or -1 if it's not available  */
int SDL_JoystickGetPlayerIndex(SDL_Joystick *joystick)
/* Get the player index of an opened joystick, or -1 if it's not available  */
int SDL_JoystickGetPlayerIndex(SDL_Joystick *joystick)
{
    int player_index;
    if (!SDL_PrivateJoystickValid(joystick)) {
        return -1;
    }
    SDL_LockJoysticks();
    player_index = SDL_GetPlayerIndexForJoystickID(joystick->instance_id);
    SDL_UnlockJoysticks();
    return player_index;
}