Commit 54dce3f53ab10402edaa6f241d5c88edb76159e7

Ryan C. Gordon 2013-10-20T15:45:48

Don't bother calling SDL_SYS_HapticEffectType() at all for XInput devices.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/src/haptic/windows/SDL_syshaptic.c b/src/haptic/windows/SDL_syshaptic.c
index f8b9096..c8cbd59 100644
--- a/src/haptic/windows/SDL_syshaptic.c
+++ b/src/haptic/windows/SDL_syshaptic.c
@@ -1202,10 +1202,13 @@ SDL_SYS_HapticNewEffect(SDL_Haptic * haptic, struct haptic_effect *effect,
                         SDL_HapticEffect * base)
 {
     HRESULT ret;
-    REFGUID type = SDL_SYS_HapticEffectType(base);
+    REFGUID type = NULL;
 
-    if ((type == NULL) && (!haptic->hwdata->bXInputHaptic)) {
-        goto err_hweffect;
+    if (!haptic->hwdata->bXInputHaptic) {
+        type = SDL_SYS_HapticEffectType(base);
+        if (type == NULL) {
+            goto err_hweffect;
+        }
     }
 
     /* Alloc the effect. */