Navigation Menu

Skip to content

Commit

Permalink
Fixed bug 3561 - Re-acquire device before playing effects if needed.
Browse files Browse the repository at this point in the history
Mathieu Laurendeau

Check the result of IDirectInputEffect_SetParameters and re-acquire the device to solve concurrency issues.
  • Loading branch information
slouken committed Jan 18, 2017
1 parent 5cb1ca5 commit dd007e3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/haptic/windows/SDL_dinputhaptic.c
Expand Up @@ -1016,6 +1016,19 @@ SDL_DINPUT_HapticUpdateEffect(SDL_Haptic * haptic, struct haptic_effect *effect,
/* Create the actual effect. */
ret =
IDirectInputEffect_SetParameters(effect->hweffect->ref, &temp, flags);
if (ret == DIERR_NOTEXCLUSIVEACQUIRED) {
IDirectInputDevice8_Unacquire(haptic->hwdata->device);
ret = IDirectInputDevice8_SetCooperativeLevel(haptic->hwdata->device, SDL_HelperWindow, DISCL_EXCLUSIVE | DISCL_BACKGROUND);
if (SUCCEEDED(ret)) {
ret = DIERR_NOTACQUIRED;
}
}
if (ret == DIERR_INPUTLOST || ret == DIERR_NOTACQUIRED) {
ret = IDirectInputDevice8_Acquire(haptic->hwdata->device);
if (SUCCEEDED(ret)) {
ret = IDirectInputEffect_SetParameters(effect->hweffect->ref, &temp, flags);
}
}
if (FAILED(ret)) {
DI_SetError("Unable to update effect", ret);
goto err_update;
Expand Down

0 comments on commit dd007e3

Please sign in to comment.