From b745a2547412301a3ffa06021b80924c2fd6a093 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 19 Apr 2011 08:08:50 -0700 Subject: [PATCH] Fixed: Windows always fails with SDL_HapticOpenFromJoystick The windows function SDL_SYS_HapticOpenFromJoystick fails because DIDEVICEINSTANCE joy_instance does not have its dwSize field initialized. The attached patch includes the fix along with a fix for two similar problems. Daniel Heath --- src/haptic/windows/SDL_syshaptic.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/haptic/windows/SDL_syshaptic.c b/src/haptic/windows/SDL_syshaptic.c index a94a20137..6209257cb 100644 --- a/src/haptic/windows/SDL_syshaptic.c +++ b/src/haptic/windows/SDL_syshaptic.c @@ -549,6 +549,8 @@ SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick) { HRESULT ret; DIDEVICEINSTANCE hap_instance, joy_instance; + hap_instance.dwSize = sizeof(DIDEVICEINSTANCE); + joy_instance.dwSize = sizeof(DIDEVICEINSTANCE); /* Get the device instances. */ ret = IDirectInputDevice2_GetDeviceInfo(haptic->hwdata->device, @@ -578,6 +580,7 @@ SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick) int i, ret; HRESULT idret; DIDEVICEINSTANCE joy_instance; + joy_instance.dwSize = sizeof(DIDEVICEINSTANCE); /* Since it comes from a joystick we have to try to match it with a haptic device on our haptic list. */ for (i=0; i