From 6e1169ddc2740a454c84523b214c08ea269c274b Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 20 Oct 2013 15:49:52 -0400 Subject: [PATCH] Fixed goofy logic in haptic device comparison code. Mitchell Keith Bloch did the research on this bug, and came up with a slightly different patch than this. Partially fixes Bugzilla #2126. --- src/haptic/windows/SDL_syshaptic.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/haptic/windows/SDL_syshaptic.c b/src/haptic/windows/SDL_syshaptic.c index c8cbd5989..09cca96e4 100644 --- a/src/haptic/windows/SDL_syshaptic.c +++ b/src/haptic/windows/SDL_syshaptic.c @@ -636,9 +636,11 @@ SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick) int SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick) { - if ((joystick->hwdata->bXInputHaptic == haptic->hwdata->bXInputHaptic) && (haptic->hwdata->userid == joystick->hwdata->userid)) { - return 1; - } else { + if ((joystick->hwdata->bXInputHaptic != haptic->hwdata->bXInputHaptic) { + return 0; /* one is XInput, one is not; not the same device. */ + } else if (joystick->hwdata->bXInputHaptic) { /* XInput */ + return (haptic->hwdata->userid == joystick->hwdata->userid); + } else { /* DirectInput */ HRESULT ret; DIDEVICEINSTANCE hap_instance, joy_instance;