mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-29 20:27:12 +01:00
Fixed SDL_HapticNewEffect() failing on various DirectInput devices.
This commit is contained in:
parent
2a2fb611d5
commit
18c9a4e96b
@ -507,8 +507,25 @@ DI_DeviceObjectCallback(LPCDIDEVICEOBJECTINSTANCE dev, LPVOID pvRef)
|
||||
SDL_Haptic *haptic = (SDL_Haptic *) pvRef;
|
||||
|
||||
if ((dev->dwType & DIDFT_AXIS) && (dev->dwFlags & DIDOI_FFACTUATOR)) {
|
||||
const GUID *guid = &dev->guidType;
|
||||
DWORD offset = 0;
|
||||
if (DI_GUIDIsSame(guid, &GUID_XAxis)) {
|
||||
offset = DIJOFS_X;
|
||||
} else if (DI_GUIDIsSame(guid, &GUID_YAxis)) {
|
||||
offset = DIJOFS_Y;
|
||||
} else if (DI_GUIDIsSame(guid, &GUID_ZAxis)) {
|
||||
offset = DIJOFS_Z;
|
||||
} else if (DI_GUIDIsSame(guid, &GUID_RxAxis)) {
|
||||
offset = DIJOFS_RX;
|
||||
} else if (DI_GUIDIsSame(guid, &GUID_RyAxis)) {
|
||||
offset = DIJOFS_RY;
|
||||
} else if (DI_GUIDIsSame(guid, &GUID_RzAxis)) {
|
||||
offset = DIJOFS_RZ;
|
||||
} else {
|
||||
return DIENUM_CONTINUE; /* can't use this, go on. */
|
||||
}
|
||||
|
||||
haptic->hwdata->axes[haptic->naxes] = dev->dwOfs;
|
||||
haptic->hwdata->axes[haptic->naxes] = offset;
|
||||
haptic->naxes++;
|
||||
|
||||
/* Currently using the artificial limit of 3 axes. */
|
||||
|
Loading…
Reference in New Issue
Block a user