gameinput: preserve controller transitions between polls #233

Open
github-bot wants to merge 1 commit from github-bot/gh-233 into main AGit
Owner

@⁠Andretuta on GitHub · 2026-11-24 02:50 UTC · original
ubiquitarianism:old-pr/9966 → main · +173 −80 · 3 files · 1 commits · draft

Carried over from old PR 9966 by tedin7 in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9966, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
tedin7: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

@ItsNotRexed: an exe PR, as you asked.

What

The GameInput shim now keeps button and axis changes that happen between two polls. Each poll drains SDL's gamepad button and axis events; for each connected pad, events with the same SDL timestamp form one sample. Intermediate samples go into the reading history and to reading/Guide callbacks, and the final reading still comes from the current pad snapshot (so motion and raw HID state are unchanged). GameInput timestamps still record when the shim polled. docs/gameinput.md describes the behaviour and drops the old "a change shorter than one poll is not seen" caveat.

Why

The shim read the pad's state once per poll, so a short press (a button tapped and released, or a trigger pulled and let go) between two polls never reached the history or a callback and the title missed the input.

Tested

Built locally with clang-cl 19 + lld-link against the xwin SDK and SDL3 3.4.20 (static), run under Wine: gameinput_test.exe.

  • With the change: 366 checks, 0 failures.
  • Negative control (same test, gameinput.cpp from origin/main): 366 checks, 2 failures (both new checks: "history delivers both the short A/trigger press and its release", "two callbacks fire and the current reading stays released").
  • New test: test_buffered_gamepad_input, 42 lines in runtime/test/gameinput_test.cpp. It presses A and the left trigger on a virtual pad, releases them before the next shim poll, and checks the history holds both the press and the release, two callbacks fire, and the current reading is the released one.
**@⁠Andretuta** on GitHub · 2026-11-24 02:50 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/233) `ubiquitarianism:old-pr/9966` → `main` · +173 −80 · 3 files · 1 commits · draft > Carried over from **old PR 9966** by `tedin7` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9966`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `tedin7`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): `@ItsNotRexed`: an exe PR, as you asked. ## What The GameInput shim now keeps button and axis changes that happen between two polls. Each poll drains SDL's gamepad button and axis events; for each connected pad, events with the same SDL timestamp form one sample. Intermediate samples go into the reading history and to reading/Guide callbacks, and the final reading still comes from the current pad snapshot (so motion and raw HID state are unchanged). GameInput timestamps still record when the shim polled. `docs/gameinput.md` describes the behaviour and drops the old "a change shorter than one poll is not seen" caveat. ## Why The shim read the pad's state once per poll, so a short press (a button tapped and released, or a trigger pulled and let go) between two polls never reached the history or a callback and the title missed the input. ## Tested Built locally with clang-cl 19 + lld-link against the xwin SDK and SDL3 3.4.20 (static), run under Wine: `gameinput_test.exe`. - With the change: `366 checks, 0 failures`. - Negative control (same test, `gameinput.cpp` from origin/main): `366 checks, 2 failures` (both new checks: "history delivers both the short A/trigger press and its release", "two callbacks fire and the current reading stays released"). - New test: `test_buffered_gamepad_input`, 42 lines in `runtime/test/gameinput_test.cpp`. It presses A and the left trigger on a virtual pad, releases them before the next shim poll, and checks the history holds both the press and the release, two callbacks fire, and the current reading is the released one.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:49:45 +00:00
This pull request has changes conflicting with the target branch.
  • runtime/shims/gameinput.cpp
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/233/head:github-bot/gh-233'
git switch 'github-bot/gh-233'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-233'
git switch 'github-bot/gh-233'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-233'
git switch 'github-bot/gh-233'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-233'
git switch 'main'
git merge --squash 'github-bot/gh-233'
git switch 'main'
git merge --ff-only 'github-bot/gh-233'
git switch 'main'
git merge 'github-bot/gh-233'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.