MCPcopy Create free account
hub / github.com/Boomslangnz/FFBArcadePlugin / TriggerSpringEffectInfinite

Function TriggerSpringEffectInfinite

DllMain.cpp:1723–1753  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1721}
1722
1723void TriggerSpringEffectInfinite(double strength)
1724{
1725 SDL_HapticEffect tempEffect;
1726 SDL_memset(&tempEffect, 0, sizeof(SDL_HapticEffect));
1727
1728 tempEffect.type = SDL_HAPTIC_SPRING;
1729 tempEffect.condition.type = SDL_HAPTIC_SPRING;
1730 tempEffect.condition.direction.type = SDL_HAPTIC_CARTESIAN;
1731 tempEffect.condition.delay = 0;
1732 tempEffect.condition.length = SDL_HAPTIC_INFINITY;
1733 tempEffect.condition.direction.dir[0] = 1;
1734 tempEffect.constant.direction.dir[1] = 1; //Y Position
1735
1736 SHORT minForce = (SHORT)(strength > 0.001 ? (configMinForce / 100.0 * 32767.0) : 0); // strength is a double so we do an epsilon check of 0.001 instead of > 0.
1737 SHORT maxForce = (SHORT)(configMaxForce / 100.0 * 32767.0);
1738 SHORT range = maxForce - minForce;
1739 SHORT coeff = (SHORT)(strength * range + minForce);
1740 if (coeff < 0)
1741 {
1742 coeff = 32767;
1743 }
1744
1745 tempEffect.condition.left_coeff[0] = (short)(coeff);
1746 tempEffect.condition.right_coeff[0] = (short)(coeff);
1747 tempEffect.condition.left_sat[0] = (short)(coeff * 2.0); //Needed for Logitech G920 wheel
1748 tempEffect.condition.right_sat[0] = (short)(coeff * 2.0); //Needed for Logitech G920 wheel
1749 tempEffect.condition.center[0] = 0;
1750
1751 SDL_HapticUpdateEffect(haptic, effects.effect_spring_id, &tempEffect);
1752 SDL_HapticRunEffect(haptic, effects.effect_spring_id, 1);
1753}
1754
1755void TriggerLeftRightEffect(double smallstrength, double largestrength, double length)
1756{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected