From 167bda0d37269f21a5c02988184f4e069591be3b Mon Sep 17 00:00:00 2001 From: mjbudd77 Date: Wed, 16 Jun 2021 07:15:10 -0400 Subject: [PATCH] Minor logic change for Qt gamepad button mapping initialization. If the user specifically choose keyboard in gamepad config, then don't attempt to match to a gamepad device. Use keyboard bindings instead. --- src/drivers/Qt/sdl-joystick.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/drivers/Qt/sdl-joystick.cpp b/src/drivers/Qt/sdl-joystick.cpp index 0b10533e..65a6c3c1 100644 --- a/src/drivers/Qt/sdl-joystick.cpp +++ b/src/drivers/Qt/sdl-joystick.cpp @@ -337,6 +337,8 @@ int GamePad_t::init(int port, const char *guid, const char *profile) portNum = port; + //printf("Init: %i %s %s \n", port, guid, profile ); + // First look for a controller that matches the specific GUID // that is not already in use by another port. if (devIdx < 0) @@ -369,7 +371,7 @@ int GamePad_t::init(int port, const char *guid, const char *profile) // If a specific controller was not matched, // then look for any game controller that is plugged in // and not already bound. - if (devIdx < 0) + if ( (devIdx < 0) && (strcmp(guid, "keyboard") != 0) ) { for (i = 0; i < MAX_JOYSTICKS; i++) { @@ -396,7 +398,10 @@ int GamePad_t::init(int port, const char *guid, const char *profile) // game controller, then load default keyboard. if ((portNum == 0) && (devIdx < 0)) { - loadDefaults(); + if (loadProfile(profile)) + { + loadDefaults(); + } } return 0;