Skip to content

gameinput: a force-feedback effect with no duration or a play count of 0 runs with SDL_HAPTIC_INFINITY, not 0 iterations - #7815

Closed
AirKyzzZ wants to merge 4 commits into
ProjectLeonida:mainfrom
AirKyzzZ:fix/gameinput-haptic-infinity
Closed

AirKyzzZ wants to merge 4 commits into
ProjectLeonida:mainfrom
AirKyzzZ:fix/gameinput-haptic-infinity

Conversation

@AirKyzzZ

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: new RT item (claim), from my finding in #7496 (comment) and review point 2 on #7463.

Depends on: #7463 (same lines of ForceFeedbackEffect::sync; this branch is on top of it, which is on top of #7385, so their commits show here until they land)

@ItsNotRexed: an exe/recomp PR, as you asked.

What and why

ForceFeedbackEffect::sync ran an effect with no duration, and a finite one with playCount 0, through SDL_RunHapticEffect(..., 0), on the belief that 0 iterations is "until stopped" in SDL. SDL 3.4.20's header says to pass SDL_HAPTIC_INFINITY to repeat forever, and 0 is a stop where the count reaches evdev: SDL's Linux backend writes it as EV_FF's value, and under Wine, dinput's hid_joystick_effect_Start sends it as the PID loop count, which winebus writes to evdev the same way. On Windows, SDL hands it to IDirectInputEffect::Start, whose reference defines 1 and INFINITE but not 0. So the usual "create once, SetParams every frame" effect could stop as soon as it started on a real wheel.

The poll thread now passes SDL_HAPTIC_INFINITY for those effects. The play count it keeps for the timer and for #7463's same-run test is still GameInput's, so nothing else changes.

Tested

Windows 10 22H2 (19045), RTX 2060 / NVIDIA 566.14, Ryzen 5 2600X, clang-cl 23.1.6 + lld-link with the VS 2022 14.44 STL, Windows SDK 10.0.26100, Ninja, SDL3 3.4.20 fetched, at 186fe3bb0:

Not run on a real force-feedback wheel, only through the fake haptic source.

No game files. AI-assisted (Claude Code).

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (no translator change)

Signed-off-by: Maxime Mansiet <AirKyzzZ@users.noreply.github.com>
…un and timer

Signed-off-by: Maxime Mansiet <AirKyzzZ@users.noreply.github.com>
… even at the same total length

Signed-off-by: Maxime Mansiet <AirKyzzZ@users.noreply.github.com>
…f 0 runs with SDL_HAPTIC_INFINITY, not 0 iterations

Signed-off-by: Maxime Mansiet <AirKyzzZ@users.noreply.github.com>
@Envyre

Envyre commented Nov 23, 2026

Copy link
Copy Markdown

Code read of 186fe3b: looks right. No-duration (endless) and playCount-0 effects both reach SDL as SDL_HAPTIC_INFINITY from one call site (runtime/shims/gameinput.cpp:2202-2207); run_for stays 0 for both (:2203) and expiry is gated on run_for_ (:2169), so the shim's timer never stops them early; same_run (:2205) still re-runs on a change into or out of playCount 0 because iterations differs; the tests assert the iterations passed to SDL for both cases (runtime/test/gameinput_test.cpp:1378, :1497).

Small follow-ups:

AI-assisted (Claude Code).

@DaviDreamerz

Copy link
Copy Markdown

Tested 186fe3bb0 on Windows 11 (build 26300), MSVC 14.44 RelWithDebInfo, SDL3 3.4.20 built from the pinned source: pass.

  • ctest -C RelWithDebInfo -R "^gameinput$": 355 checks, 0 failures
  • Negative control: with only runtime/shims/gameinput.cpp from 2ebd361d9 in the same tree, the same test gives 355 checks, 2 failures — the no-duration effect and the playCount 0 case — so both new expectations are exercised
  • No game files (LEONIDA_GAME_DIR unset); the fake haptic source only

AI-assisted: yes.

@myokex

myokex commented Nov 23, 2026 •

Copy link
Copy Markdown

Tested 186fe3bb0 merged onto main 867d922f0 on Windows 11, AMD Radeon RX 7800 XT (driver 32.0.32029.2010), MSVC 2022 RelWithDebInfo, Vulkan SDK 1.4.363.0, synthetic only, no game files: pass.

AI-assisted (Claude Code); I read the full diff before building.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants