From 86322e9373351640045bdec97469c80f9ec53364 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Tue, 21 Feb 2023 16:00:16 -0800 Subject: [PATCH] log controller open errors --- src/Input/Input.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Input/Input.cs b/src/Input/Input.cs index a48c08c..bd5b254 100644 --- a/src/Input/Input.cs +++ b/src/Input/Input.cs @@ -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; } }