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

Commit

Permalink
Need to get cooperative level before acquiring.
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbens committed Aug 4, 2008
1 parent bdff83a commit 5b896d3
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/haptic/win32/SDL_syshaptic.c
Expand Up @@ -228,6 +228,7 @@ DI_EffectCallback(LPCDIEFFECTINFO pei, LPVOID pv)
* - Open temporary DirectInputDevice interface.
* - Create DirectInputDevice2 interface.
* - Release DirectInputDevice interface.
* - Set cooperative level.
* - Acquire exclusiveness.
* - Reset actuators.
* - Get supported featuers.
Expand Down Expand Up @@ -267,13 +268,6 @@ SDL_SYS_HapticOpenFromInstance(SDL_Haptic * haptic, DIDEVICEINSTANCE instance)
goto creat_err;
}

/* Acquire the device. */
ret = IDirectInputDevice2_Acquire(haptic->hwdata->device);
if (FAILED(ret)) {
DI_SetError("Acquiring DirectInput device",ret);
goto query_err;
}

/* Grab it exclusively to use force feedback stuff. */
ret =IDirectInputDevice2_SetCooperativeLevel( haptic->hwdata->device,
SDL_HelperWindow,
Expand All @@ -283,6 +277,13 @@ SDL_SYS_HapticOpenFromInstance(SDL_Haptic * haptic, DIDEVICEINSTANCE instance)
goto acquire_err;
}

/* Acquire the device. */
ret = IDirectInputDevice2_Acquire(haptic->hwdata->device);
if (FAILED(ret)) {
DI_SetError("Acquiring DirectInput device",ret);
goto query_err;
}

/* Reset all actuators - just in case. */
ret = IDirectInputDevice2_SendForceFeedbackCommand( haptic->hwdata->device,
DISFFC_RESET );
Expand Down

0 comments on commit 5b896d3

Please sign in to comment.