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.

This commit is contained in:
mjbudd77 2021-06-16 07:15:10 -04:00
parent 4fb3b36aef
commit 167bda0d37
1 changed files with 7 additions and 2 deletions

View File

@ -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;