mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2025-07-03 16:25:54 +00:00
Also print gamepad mapping on gamepad attach
This commit is contained in:
parent
65562937f3
commit
dfcc1ff899
@ -634,6 +634,8 @@ void SdlInputHandler::handleControllerDeviceEvent(SDL_ControllerDeviceEvent* eve
|
|||||||
int i;
|
int i;
|
||||||
const char* name;
|
const char* name;
|
||||||
SDL_GameController* controller;
|
SDL_GameController* controller;
|
||||||
|
const char* mapping;
|
||||||
|
char guidStr[33];
|
||||||
|
|
||||||
controller = SDL_GameControllerOpen(event->which);
|
controller = SDL_GameControllerOpen(event->which);
|
||||||
if (controller == NULL) {
|
if (controller == NULL) {
|
||||||
@ -681,16 +683,20 @@ void SdlInputHandler::handleControllerDeviceEvent(SDL_ControllerDeviceEvent* eve
|
|||||||
state->controller = controller;
|
state->controller = controller;
|
||||||
state->jsId = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(state->controller));
|
state->jsId = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(state->controller));
|
||||||
|
|
||||||
char guidStr[33];
|
|
||||||
SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(SDL_GameControllerGetJoystick(state->controller)),
|
SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(SDL_GameControllerGetJoystick(state->controller)),
|
||||||
guidStr, sizeof(guidStr));
|
guidStr, sizeof(guidStr));
|
||||||
|
mapping = SDL_GameControllerMapping(state->controller);
|
||||||
name = SDL_GameControllerName(state->controller);
|
name = SDL_GameControllerName(state->controller);
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"Gamepad %d (player %d) is: %s (%s)",
|
"Gamepad %d (player %d) is: %s (%s -> %s)",
|
||||||
i,
|
i,
|
||||||
state->index,
|
state->index,
|
||||||
name != NULL ? name : "<null>",
|
name != nullptr ? name : "<null>",
|
||||||
guidStr);
|
guidStr,
|
||||||
|
mapping != nullptr ? mapping : "<null>");
|
||||||
|
if (mapping != nullptr) {
|
||||||
|
SDL_free((void*)mapping);
|
||||||
|
}
|
||||||
|
|
||||||
// Add this gamepad to the gamepad mask
|
// Add this gamepad to the gamepad mask
|
||||||
if (m_MultiController) {
|
if (m_MultiController) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user