Skip to content

Commit f824bb4

Browse files
committed
fix: use infinite duration for constant/damper/inertia effects (Boomslangnz#103)
Effects with configFeedbackLength (120ms default) expired between game loop triggers when the game state didn't change frequently enough. The T500RS and other wheels that strictly respect SDL effect durations would go limp during sustained forces (e.g. long turns). Using SDL_HAPTIC_INFINITY keeps effects active until the next update or explicit stop, matching the pattern already used for Spring effects.
1 parent 66f30f5 commit f824bb4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

DllMain.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,7 @@ void TriggerConstantEffect(int direction, double strength)
13421342
tempEffect.type = SDL_HAPTIC_CONSTANT;
13431343
tempEffect.constant.direction.type = SDL_HAPTIC_CARTESIAN;
13441344
tempEffect.constant.direction.dir[0] = direction;
1345-
tempEffect.constant.length = configFeedbackLength;
1345+
tempEffect.constant.length = SDL_HAPTIC_INFINITY;
13461346
tempEffect.constant.delay = 0;
13471347

13481348
int confMinForce = configMinForce;
@@ -1435,7 +1435,7 @@ void TriggerInertiaEffect(double strength)
14351435
tempEffect.condition.type = SDL_HAPTIC_INERTIA;
14361436
tempEffect.condition.direction.type = SDL_HAPTIC_CARTESIAN;
14371437
tempEffect.condition.delay = 0;
1438-
tempEffect.condition.length = configFeedbackLength;
1438+
tempEffect.condition.length = SDL_HAPTIC_INFINITY;
14391439
tempEffect.condition.direction.dir[0] = 1;
14401440
tempEffect.condition.direction.dir[1] = 1; //Y Position
14411441
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.
@@ -1520,7 +1520,7 @@ void TriggerDamperEffect(double strength)
15201520
tempEffect.condition.type = SDL_HAPTIC_DAMPER;
15211521
tempEffect.condition.direction.type = SDL_HAPTIC_CARTESIAN;
15221522
tempEffect.condition.delay = 0;
1523-
tempEffect.condition.length = configFeedbackLength;
1523+
tempEffect.condition.length = SDL_HAPTIC_INFINITY;
15241524
tempEffect.condition.direction.dir[0] = 1; // not used
15251525
tempEffect.condition.direction.dir[1] = 0; //Y Position
15261526
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.

0 commit comments

Comments
 (0)