log controller open errors

remotes/1695061714407202320/main
cosmonaut 2023-02-21 16:00:16 -08:00
parent e9aacb44da
commit 86322e9373
1 changed files with 11 additions and 2 deletions

View File

@ -87,8 +87,17 @@ namespace MoonWorks.Input
{
if (!GamepadExists(slot))
{
gamepads[slot].Handle = SDL.SDL_GameControllerOpen(index);
System.Console.WriteLine($"Gamepad added to slot {slot}!");
var openResult = SDL.SDL_GameControllerOpen(index);
if (openResult == 0)
{
System.Console.WriteLine($"Error opening gamepad!");
System.Console.WriteLine(SDL.SDL_GetError());
}
else
{
gamepads[slot].Handle = SDL.SDL_GameControllerOpen(index);
System.Console.WriteLine($"Gamepad added to slot {slot}!");
}
return;
}
}