mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:45:53 +01:00
[PR #1559] gameinput: queue only events a callback wants, so a later pad's connect is not stuck behind a backlog (RT-GAMEINPUT-LATE-PAD) #1583
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#1583
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/1559
Author: @kawaii-shakal
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:gameinput-hotplug📝 Commits (2)
a05f1f3gameinput: queue only events a callback wants, so a later pad's connect is not stuck behind a backlog (RT-GAMEINPUT-LATE-PAD)f7e422eMerge upstream main into gameinput-hotplug📊 Changes
3 files changed (+94 additions, -3 deletions)
View changed files
📝
docs/gameinput.md(+5 -1)📝
runtime/shims/gameinput.cpp(+29 -2)📝
runtime/test/gameinput_test.cpp(+60 -0)📄 Description
Claim: RT-GAMEINPUT-LATE-PAD. The coordination issue #14 no longer takes comments (over 2,500), so the claim is this PR itself.
What and why
On the retail boot (RTX 5070 Ti, DualSense), a pad connected after the title started was seen by the shim (
connected DualSense Wireless Controller (..., player 2, ...), then 47presslines), but the title did not react. A pad present at start worked, and so did one that dropped out and came back as the same device.A pad present at start reaches the title through blocking enumeration, which runs synchronously inside
RegisterDeviceCallback. A pad that connects later reaches it only through the connect event thatopen_padqueues forIGameInputDispatcher::Dispatch.queue_eventqueued every event, whether or not any callback wanted it, including the reading events the poll loop makes for a moving stick and a DualSense's 125 Hz sensor stream. A title that holds a dispatcher and runs one item a frame (Dispatch(0), as Microsoft's guidance suggests) falls further behind every frame, and the late pad's connect event never comes out.runtime/shims/gameinput.cpp:queue_eventdrops an event that no registered callback matches. GameInput has no callback to run for it, so nothing should be queued.RegisterDeviceCallbackcalls (device or all, kind, status filter, enumeration mode), and the firstCreateDispatcherandDispatchcalls (with the quota).docs/gameinput.md: both, in "How it runs".Not yet confirmed on the retail title. I have not booted this branch with a pad plugged in late. If that boot logs no
CreateDispatcher, this backlog is not what kept the pad from the title, and the newRegisterDeviceCallbacklines are where to look next. I checked the other candidates in the code and none of them explains it. Null-device reads aggregate over all pads. Status and kind filters treat a live connect the same as an enumeration event. The player slot only drives the LEDs. Offline, every device belongs to the one user.Test
test_late_pad_behind_dispatcherinruntime/test/gameinput_test.cpp:Dispatch(0), a DualSense-like pad with sensors is attached.Results:
ctest -C RelWithDebInfo -R gameinput:gameinput,gameinput_hostandgameinput_scriptpass (Windows 11 Pro 26300, MSVC 19.50, SDL3 3.4.20).gta6rtbuilds.#1528 (keyboard pad on by default) and #1510 touch the same files; either may need a trivial rebase after the other.
AI-assisted: yes (Claude Code, Claude Opus 5.5).
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.