mirror of https://github.com/encounter/SDL.git
Only allocate a joystick instance ID once we know it's a joystick.
This fixes compatibility with code that assumes 0 based joystick instance IDs.
This commit is contained in:
parent
11c45c4ede
commit
cca094225a
|
@ -589,7 +589,6 @@ HIDBuildDevice(io_object_t hidDevice)
|
||||||
if (kIOReturnSuccess == result) {
|
if (kIOReturnSuccess == result) {
|
||||||
HIDGetDeviceInfo(hidDevice, hidProperties, pDevice); /* hidDevice used to find parents in registry tree */
|
HIDGetDeviceInfo(hidDevice, hidProperties, pDevice); /* hidDevice used to find parents in registry tree */
|
||||||
HIDGetCollectionElements(hidProperties, pDevice);
|
HIDGetCollectionElements(hidProperties, pDevice);
|
||||||
pDevice->instance_id = ++s_joystick_instance_id;
|
|
||||||
} else {
|
} else {
|
||||||
DisposePtr((Ptr) pDevice);
|
DisposePtr((Ptr) pDevice);
|
||||||
pDevice = NULL;
|
pDevice = NULL;
|
||||||
|
@ -678,6 +677,9 @@ AddDeviceHelper( io_object_t ioHIDDeviceObject )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Allocate an instance ID for this device */
|
||||||
|
device->instance_id = ++s_joystick_instance_id;
|
||||||
|
|
||||||
/* We have to do some storage of the io_service_t for
|
/* We have to do some storage of the io_service_t for
|
||||||
* SDL_HapticOpenFromJoystick */
|
* SDL_HapticOpenFromJoystick */
|
||||||
if (FFIsForceFeedback(ioHIDDeviceObject) == FF_OK) {
|
if (FFIsForceFeedback(ioHIDDeviceObject) == FF_OK) {
|
||||||
|
|
Loading…
Reference in New Issue