Skip to content

gameinput: preserve controller transitions between polls - #233

Closed
Andretuta wants to merge 1 commit into
mainfrom
old-pr/9966
Closed

Andretuta wants to merge 1 commit into
mainfrom
old-pr/9966

Conversation

@Andretuta

Copy link
Copy Markdown
Collaborator

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.

@MoonEyes

Copy link
Copy Markdown
Collaborator

Thanks a lot for this, @Andretuta. We checked and this pull request is a draft that #1831 states it supersedes (same three files); the kept one is #1831. To keep the queue clear and avoid reviewing the same change twice, I am closing this one in favour of #1831. If you think this is a mistake, please reopen it and let us know.

AI-assisted (Claude Code, Claude Opus 5.5).

@MoonEyes MoonEyes closed this Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs rebase Conflicts with the base branch: rebase it on main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants