From 5b896d33a432d05c579ef1ba2a8a9578e0a4791a Mon Sep 17 00:00:00 2001 From: Edgar Simo Date: Mon, 4 Aug 2008 17:03:20 +0000 Subject: [PATCH] Need to get cooperative level before acquiring. --- src/haptic/win32/SDL_syshaptic.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/haptic/win32/SDL_syshaptic.c b/src/haptic/win32/SDL_syshaptic.c index 291432cfc..a9cbaefed 100644 --- a/src/haptic/win32/SDL_syshaptic.c +++ b/src/haptic/win32/SDL_syshaptic.c @@ -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. @@ -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, @@ -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 );