mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:55:52 +01:00
[PR #233] gameinput: preserve controller transitions between polls #286
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#286
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/233
Author: @Andretuta
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:old-pr/9966📝 Commits (1)
db3851agameinput: preserve controller transitions between polls📊 Changes
3 files changed (+173 additions, -80 deletions)
View changed files
📝
docs/gameinput.md(+7 -5)📝
runtime/shims/gameinput.cpp(+124 -75)📝
runtime/test/gameinput_test.cpp(+42 -0)📄 Description
Original description (mentions and
#Nreferences 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.mddescribes 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.366 checks, 0 failures.gameinput.cppfrom 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").test_buffered_gamepad_input, 42 lines inruntime/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.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.