Haptic: Let XInput update effects while they're still running.
authorRyan C. Gordon <icculus@icculus.org>
Sat, 10 Aug 2013 13:46:19 -0400
changeset 7623 fe1b8a78de0b
parent 7622 d758150805de
child 7624 ac9f3b12c42a
Haptic: Let XInput update effects while they're still running.
src/haptic/windows/SDL_syshaptic.c
--- a/src/haptic/windows/SDL_syshaptic.c	Sat Aug 10 13:40:08 2013 -0400
+++ b/src/haptic/windows/SDL_syshaptic.c	Sat Aug 10 13:46:19 2013 -0400
@@ -1275,6 +1275,11 @@
         SDL_assert(data->type == SDL_HAPTIC_LEFTRIGHT);
         vib->wLeftMotorSpeed = data->leftright.large_magnitude;
         vib->wRightMotorSpeed = data->leftright.small_magnitude;
+        SDL_LockMutex(haptic->hwdata->mutex);
+        if (haptic->hwdata->stopTicks) {  /* running right now? Update it. */
+            XINPUTSETSTATE(haptic->hwdata->userid, vib);
+        }
+        SDL_UnlockMutex(haptic->hwdata->mutex);
         return 0;
     }