diff options
author | chai <chaifix@163.com> | 2019-01-31 18:38:35 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-01-31 18:38:35 +0800 |
commit | 2ec55fd974a63b705a4777c256d2222c874fa043 (patch) | |
tree | 48f1fea59ee9fc713a28a9aac3f05b98dc5ae66f /Source/3rdParty/SDL2/src/haptic/windows/SDL_windowshaptic.c | |
parent | c581dfbf1e849f393861d15e82aa6446c0c1c310 (diff) |
*SDL project
Diffstat (limited to 'Source/3rdParty/SDL2/src/haptic/windows/SDL_windowshaptic.c')
-rw-r--r-- | Source/3rdParty/SDL2/src/haptic/windows/SDL_windowshaptic.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/Source/3rdParty/SDL2/src/haptic/windows/SDL_windowshaptic.c b/Source/3rdParty/SDL2/src/haptic/windows/SDL_windowshaptic.c index 3d7361d..2e806c9 100644 --- a/Source/3rdParty/SDL2/src/haptic/windows/SDL_windowshaptic.c +++ b/Source/3rdParty/SDL2/src/haptic/windows/SDL_windowshaptic.c @@ -157,7 +157,7 @@ SDL_SYS_HapticMouse(void) /* Grab the first mouse haptic device we find. */ for (item = SDL_hapticlist; item != NULL; item = item->next) { - if (item->capabilities.dwDevType == DI8DEVCLASS_POINTER ) { + if (item->capabilities.dwDevType == DI8DEVCLASS_POINTER) { return index; } ++index; @@ -173,14 +173,16 @@ SDL_SYS_HapticMouse(void) int SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick) { - const struct joystick_hwdata *hwdata = joystick->hwdata; + if (joystick->driver != &SDL_WINDOWS_JoystickDriver) { + return 0; + } #if SDL_HAPTIC_XINPUT - if (hwdata->bXInputHaptic) { + if (joystick->hwdata->bXInputHaptic) { return 1; } #endif #if SDL_HAPTIC_DINPUT - if (hwdata->Capabilities.dwFlags & DIDC_FORCEFEEDBACK) { + if (joystick->hwdata->Capabilities.dwFlags & DIDC_FORCEFEEDBACK) { return 1; } #endif @@ -193,6 +195,9 @@ SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick) int SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick) { + if (joystick->driver != &SDL_WINDOWS_JoystickDriver) { + return 0; + } if (joystick->hwdata->bXInputHaptic != haptic->hwdata->bXInputHaptic) { return 0; /* one is XInput, one is not; not the same device. */ } else if (joystick->hwdata->bXInputHaptic) { @@ -208,6 +213,8 @@ SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick) int SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick) { + SDL_assert(joystick->driver == &SDL_WINDOWS_JoystickDriver); + if (joystick->hwdata->bXInputDevice) { return SDL_XINPUT_HapticOpenFromJoystick(haptic, joystick); } else { |