Print gamepad GUID string in logs

This commit is contained in:
Cameron Gutman
2018-11-17 17:10:52 -08:00
parent 7b5dc33a21
commit 65562937f3

View File

@@ -681,12 +681,16 @@ void SdlInputHandler::handleControllerDeviceEvent(SDL_ControllerDeviceEvent* eve
state->controller = controller;
state->jsId = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(state->controller));
char guidStr[33];
SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(SDL_GameControllerGetJoystick(state->controller)),
guidStr, sizeof(guidStr));
name = SDL_GameControllerName(state->controller);
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
"Gamepad %d (player %d) is: %s",
"Gamepad %d (player %d) is: %s (%s)",
i,
state->index,
name != NULL ? name : "<null>");
name != NULL ? name : "<null>",
guidStr);
// Add this gamepad to the gamepad mask
if (m_MultiController) {