mirror of https://github.com/encounter/SDL.git
Check the pathname first, as that's a faster check for XInput devices
This commit is contained in:
parent
21160cb815
commit
27a48b142b
|
@ -242,6 +242,12 @@ SDL_IsXInputDevice(Uint16 vendor_id, Uint16 product_id, const char* hidPath)
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If device path contains "IG_" then its an XInput device */
|
||||||
|
/* See: https://docs.microsoft.com/windows/win32/xinput/xinput-and-directinput */
|
||||||
|
if (SDL_strstr(hidPath, "IG_") != NULL) {
|
||||||
|
return SDL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
type = SDL_GetJoystickGameControllerType("", vendor_id, product_id, -1, 0, 0, 0);
|
type = SDL_GetJoystickGameControllerType("", vendor_id, product_id, -1, 0, 0, 0);
|
||||||
if (type == SDL_CONTROLLER_TYPE_XBOX360 ||
|
if (type == SDL_CONTROLLER_TYPE_XBOX360 ||
|
||||||
type == SDL_CONTROLLER_TYPE_XBOXONE ||
|
type == SDL_CONTROLLER_TYPE_XBOXONE ||
|
||||||
|
@ -249,12 +255,6 @@ SDL_IsXInputDevice(Uint16 vendor_id, Uint16 product_id, const char* hidPath)
|
||||||
return SDL_TRUE;
|
return SDL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If device path contains "IG_" then its an XInput device */
|
|
||||||
/* See: https://docs.microsoft.com/windows/win32/xinput/xinput-and-directinput */
|
|
||||||
if (SDL_strstr(hidPath, "IG_") != NULL) {
|
|
||||||
return SDL_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue