Skip to content

Commit 4a66c50

Browse files
committed
revert: restore configFeedbackLength for constant/damper/inertia effects
SDL_HAPTIC_INFINITY breaks FFB on some drivers - RunEffect on an already-running infinite effect is ignored. Reverting to the original finite duration which gets re-triggered each game loop cycle.
1 parent d4da5fb commit 4a66c50

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
@@ -1358,7 +1358,7 @@ void TriggerConstantEffect(int direction, double strength)
13581358
tempEffect.type = SDL_HAPTIC_CONSTANT;
13591359
tempEffect.constant.direction.type = SDL_HAPTIC_CARTESIAN;
13601360
tempEffect.constant.direction.dir[0] = direction;
1361-
tempEffect.constant.length = SDL_HAPTIC_INFINITY;
1361+
tempEffect.constant.length = configFeedbackLength;
13621362
tempEffect.constant.delay = 0;
13631363

13641364
int confMinForce = configMinForce;
@@ -1457,7 +1457,7 @@ void TriggerInertiaEffect(double strength)
14571457
tempEffect.condition.type = SDL_HAPTIC_INERTIA;
14581458
tempEffect.condition.direction.type = SDL_HAPTIC_CARTESIAN;
14591459
tempEffect.condition.delay = 0;
1460-
tempEffect.condition.length = SDL_HAPTIC_INFINITY;
1460+
tempEffect.condition.length = configFeedbackLength;
14611461
tempEffect.condition.direction.dir[0] = 1;
14621462
tempEffect.condition.direction.dir[1] = 1; //Y Position
14631463
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.
@@ -1542,7 +1542,7 @@ void TriggerDamperEffect(double strength)
15421542
tempEffect.condition.type = SDL_HAPTIC_DAMPER;
15431543
tempEffect.condition.direction.type = SDL_HAPTIC_CARTESIAN;
15441544
tempEffect.condition.delay = 0;
1545-
tempEffect.condition.length = SDL_HAPTIC_INFINITY;
1545+
tempEffect.condition.length = configFeedbackLength;
15461546
tempEffect.condition.direction.dir[0] = 1; // not used
15471547
tempEffect.condition.direction.dir[1] = 0; //Y Position
15481548
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)