mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-06 01:46:25 +00:00
SDL_ShouldIgnoreGamepad() should take product IDs rather than a guid.
This lets us early out when scanning for new hardware more quickly.
This commit is contained in:
@@ -185,13 +185,18 @@ static void AddXInputDevice(Uint8 userid, BYTE SubType, JoyStick_DeviceData **pC
|
||||
pNewJoystick = pNewJoystick->pNext;
|
||||
}
|
||||
|
||||
name = GetXInputName(userid, SubType);
|
||||
GetXInputDeviceInfo(userid, &vendor, &product, &version);
|
||||
if (SDL_ShouldIgnoreJoystick(vendor, product, version, name) ||
|
||||
SDL_JoystickHandledByAnotherDriver(&SDL_WINDOWS_JoystickDriver, vendor, product, version, name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
pNewJoystick = (JoyStick_DeviceData *)SDL_calloc(1, sizeof(JoyStick_DeviceData));
|
||||
if (!pNewJoystick) {
|
||||
return; // better luck next time?
|
||||
}
|
||||
|
||||
name = GetXInputName(userid, SubType);
|
||||
GetXInputDeviceInfo(userid, &vendor, &product, &version);
|
||||
pNewJoystick->bXInputDevice = true;
|
||||
pNewJoystick->joystickname = SDL_CreateJoystickName(vendor, product, NULL, name);
|
||||
if (!pNewJoystick->joystickname) {
|
||||
@@ -203,16 +208,6 @@ static void AddXInputDevice(Uint8 userid, BYTE SubType, JoyStick_DeviceData **pC
|
||||
pNewJoystick->SubType = SubType;
|
||||
pNewJoystick->XInputUserId = userid;
|
||||
|
||||
if (SDL_ShouldIgnoreJoystick(pNewJoystick->joystickname, pNewJoystick->guid)) {
|
||||
SDL_free(pNewJoystick);
|
||||
return;
|
||||
}
|
||||
|
||||
if (SDL_JoystickHandledByAnotherDriver(&SDL_WINDOWS_JoystickDriver, vendor, product, version, pNewJoystick->joystickname)) {
|
||||
SDL_free(pNewJoystick);
|
||||
return;
|
||||
}
|
||||
|
||||
WINDOWS_AddJoystickDevice(pNewJoystick);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user