Constant force commands for XInput devices fixed so that they will stop when 0 force is applied.

This commit is contained in:
Bart Trzynadlowski 2011-09-13 02:39:48 +00:00
parent 02c0c32398
commit fdedc60f84

View file

@ -1628,7 +1628,7 @@ bool CDirectInputSystem::ProcessForceFeedbackCmd(int joyNum, int axisNum, ForceF
negForce = ffCmd.force < 0.0f;
absForce = (negForce ? -ffCmd.force : ffCmd.force);
threshold = (float)m_xiConstForceThreshold / 100.0f;
if (absForce < threshold)
if ((absForce < threshold) && (absForce > 0.001)) // if absForce == 0, must process command to stop controller vibrating
return false;
if (negForce)
vibration.wLeftMotorSpeed = min<WORD>(ffCmd.force * (float)(m_xiConstForceMax * XI_VIBRATE_SCALE), XI_VIBRATE_MAX);