GameInput: enforce statusFilter in RegisterDeviceCallback (#1489) #1593
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1603"
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?
Imported from ivall/xcl. Originally posted by hajduzsolt on 2026-11-24T18:08:34Z.
Enforces statusFilter in IGameInput::RegisterDeviceCallback so callbacks only fire when (filter & STATUS) != 0. Part of #1489.
What is in it
filter & STATUS != 0inregister_device_callbackbefore invoking or spawning the enumeration callback.register_device_callback_enforces_status_filterverifyingfilter == 0and non-matching status bits do not invoke the callback while matching bits invoke it withSTATUS.Tested
rustc 1.98.1(48a229cea 2026-09-01), debug (cargo test).cargo test -p xcl --lib hle::gameinput::tests -- --test-threads=2: 10 passed, 0 failed, 0 ignored.cargo test --workspace -- --test-threads=2: 777 passed, 0 failed, 41 ignored (xcl --lib: 728 passed, 0 failed, 21 ignored; integration/e2e suites: 49 passed, 0 failed, 20 ignored).SKIPPED heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows.Regression run
main:
PR:
Not tested
AI use
register_device_callback, wrote unit test, ran the workspace test suite, and drafted commit and PR description.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T20:22:00Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored. (Intermittent 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
Imported from ivall/xcl. Originally posted by throny on 2026-11-25T18:10:51Z.
Two contributors checked independently and found that #1784 solves the same problem (for #1488) in a different way: #1607, group D92. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.
This is a hint from the community triage in #1607, not a maintainer decision.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
Imported from ivall/xcl. Originally posted by CalvyPZ on 2026-11-25T22:42:30Z.
This PR has been marked as a duplicate and closed after multiple agreeing checks in #1607. If you believe this is incorrect please re-open with why.
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T20:44:29Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Grimkaaah on 2026-11-30T12:05:22Z.
I compared this with #1784 (same call, same issue) and with the same mechanism in my project. I checked both against the public GameInput.h (v0) and the GameInputDeviceStatus page on learn.microsoft.com.
What I checked:
currentStatusandpreviousStatus(GameInputDeviceCallback). The status page says titles "can register to receive a callback when any of these states change". So the filter chooses which status changes fire the callback:(currentStatus ^ previousStatus) & statusFilter != 0. The callback gets both masks whole. My project uses this rule.previousStatusis NoStatus (0), so the rule becomesSTATUS & filter != 0, and the callback gets the fullSTATUS. That is what this PR does (gameinput.rs:821). A filter of 0, or one of bits the pad doesn't have, gives no callback. That also matches the rule.STATUS & filterascurrentStatus. A title that registers for Connected only is then told that input is not enabled. Two merge-checks on #1784 already raised this. Of the two PRs, this one has the right semantics, so I'd keep this one and close #1784. The filter in #1784's log line could be added here if wanted.Small gaps, no blocker:
enumeration = 1) and with a filter of0x80(Wireless). That bit is insideGameInputDeviceAnyStatus(0x00FFFFFF in v0) but not inSTATUS. That would cover the async branch and a realistic bit that doesn't match.0x8000_0000is outside AnyStatus.(current ^ previous) & filterrule there. Then enumeration and changes behave the same. Today the status never changes, so there's nothing to do now.Not checked: we haven't built or run this PR. I only read the async path. No title or controller was tested.
AI use: Claude Code (Claude Opus 5.5) reviewed this by comparing it with the same mechanism in my project, Victory Grimkaaah.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:14:53Z.
Triage (#1607) – head
67da08e#1784 solves the same issue in the same function (
register_device_callbackingameinput.rs): both skip the callback when the status filter names none of the gamepad's statuses. They differ in what the callback gets: this PR passes the device's full status, #1784 passesSTATUS & filter. GameInput documentscurrentStatusas the device's status, which matches this PR. Neither change is on main yet.No problems found in the diff.
Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.