Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed: Windows always fails with SDL_HapticOpenFromJoystick
Browse files Browse the repository at this point in the history
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
  • Loading branch information
slouken committed Apr 19, 2011
1 parent 73e0241 commit b745a25
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/haptic/windows/SDL_syshaptic.c
Expand Up @@ -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,
Expand Down Expand Up @@ -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<SDL_numhaptics; i++) {
Expand Down

0 comments on commit b745a25

Please sign in to comment.