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.
This commit is contained in:
AL2009man 2025-03-09 14:07:23 -04:00
parent d95aad2b63
commit 22b2ba8fe8

View file

@ -183,13 +183,25 @@ static void SetControllerInputDevice(Controller* controller)
auto controllerType = (hid::EInputDeviceExplicit)controller->GetControllerType(); auto controllerType = (hid::EInputDeviceExplicit)controller->GetControllerType();
// Only proceed if the controller type changes
if (hid::g_inputDeviceExplicit != controllerType) if (hid::g_inputDeviceExplicit != controllerType)
{ {
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) static void SetControllerTimeOfDayLED(Controller& controller, bool isNight)
{ {