Show the existing mapping when a controller is connected

main
Sam Lantinga 2023-11-08 12:38:54 -08:00
parent 407a3cb4e0
commit 1934417b4d
1 changed files with 8 additions and 0 deletions

View File

@ -981,6 +981,14 @@ static void HandleGamepadAdded(SDL_JoystickID id, SDL_bool verbose)
SDL_SetGamepadSensorEnabled(gamepad, sensor, SDL_TRUE);
}
}
if (verbose) {
char *mapping = SDL_GetGamepadMapping(gamepad);
if (mapping) {
SDL_Log("Mapping: %s\n", mapping);
SDL_free(mapping);
}
}
} else {
SDL_Log("Couldn't open gamepad: %s", SDL_GetError());
}