From 22b2ba8fe8fc5209c6730e954f23bed307eb613e Mon Sep 17 00:00:00 2001 From: AL2009man <67606569+AL2009man@users.noreply.github.com> Date: Sun, 9 Mar 2025 14:07:23 -0400 Subject: [PATCH] added SDL's GameController naming convention as Fallback If EInputDeviceExplicit doesn't recognize a specific Controller Type or Device: it'll fallback to SDL's naming conventions. This helps troubleshooting Controller-related issues when using the debug console. --- UnleashedRecomp/hid/driver/sdl_hid.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/UnleashedRecomp/hid/driver/sdl_hid.cpp b/UnleashedRecomp/hid/driver/sdl_hid.cpp index c9515263..d5780605 100644 --- a/UnleashedRecomp/hid/driver/sdl_hid.cpp +++ b/UnleashedRecomp/hid/driver/sdl_hid.cpp @@ -183,14 +183,26 @@ static void SetControllerInputDevice(Controller* controller) auto controllerType = (hid::EInputDeviceExplicit)controller->GetControllerType(); + // Only proceed if the controller type changes if (hid::g_inputDeviceExplicit != controllerType) { hid::g_inputDeviceExplicit = controllerType; - LOGFN("Detected controller: {}", hid::GetInputDeviceName()); + // Handle Unknown Type specifically + if (controllerType == hid::EInputDeviceExplicit::Unknown) + { + const char* controllerName = SDL_GameControllerName(controller->controller); + LOGFN("Controller connected: {} (Unknown Controller Type)", controllerName ? controllerName : "Unknown Device"); + } + else + { + // For known types, only use the EInputDeviceExplicit name + LOGFN("Controller connected: {}", hid::GetInputDeviceName()); + } } } + static void SetControllerTimeOfDayLED(Controller& controller, bool isNight) { auto r = isNight ? 22 : 0;