Commit e740162f authored by Sam Lantinga's avatar Sam Lantinga

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
parent 1665c192
...@@ -549,6 +549,8 @@ SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick) ...@@ -549,6 +549,8 @@ SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
{ {
HRESULT ret; HRESULT ret;
DIDEVICEINSTANCE hap_instance, joy_instance; DIDEVICEINSTANCE hap_instance, joy_instance;
hap_instance.dwSize = sizeof(DIDEVICEINSTANCE);
joy_instance.dwSize = sizeof(DIDEVICEINSTANCE);
/* Get the device instances. */ /* Get the device instances. */
ret = IDirectInputDevice2_GetDeviceInfo(haptic->hwdata->device, ret = IDirectInputDevice2_GetDeviceInfo(haptic->hwdata->device,
...@@ -578,6 +580,7 @@ SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick) ...@@ -578,6 +580,7 @@ SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
int i, ret; int i, ret;
HRESULT idret; HRESULT idret;
DIDEVICEINSTANCE joy_instance; 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. */ /* 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<SDL_numhaptics; i++) { for (i=0; i<SDL_numhaptics; i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment