mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:55:52 +01:00
[PR #955] gameinput: pads plugged in after start under Wine, and IJKL on the keyboard pad's right stick (RT-GAMEINPUT-WINE-HOTPLUG) #993
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#993
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/955
Author: @UwUCammie
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:pr/gameinput-wine-hotplug📝 Commits (1)
3f59ed6gameinput: pads plugged in after start under Wine, and IJKL on the keyboard pad's right stick (RT-GAMEINPUT-WINE-HOTPLUG)📊 Changes
2 files changed (+100 additions, -1 deletions)
View changed files
📝
docs/gameinput.md(+2 -0)📝
runtime/shims/gameinput.cpp(+98 -1)📄 Description
Claimed in the coordination issue as: RT-GAMEINPUT-WINE-HOTPLUG
What and why
Under Wine a controller plugged in after the game has started never reaches the title. SDL's Windows backends only rescan when Windows reports a device change: the XInput and DirectInput drivers through
CM_Register_Notification, HIDAPI throughWM_DEVICECHANGEon its message window. Wine delivers neither for a pad that arrives later. Measured on Wine 11.22: a run started with no pad never showed one after it was connected. A pad that is unplugged does go away, because its reads fail.The poll thread now builds a small signature once a second, without touching SDL internals:
XInputGetCapabilities;GetRawInputDeviceListwith usage page 1 and usage joystick, gamepad or multi-axis.Wine refreshes both lists itself. When the signature changes, SDL's gamepad subsystem is restarted (
SDL_QuitSubSystem/SDL_InitSubSystem(SDL_INIT_GAMEPAD)), the one public way to make every backend scan again. Open pads are closed first through the normalclose_padpath, so the title sees a disconnect and a reconnect, and only when the hardware changed.LEONIDA_GAMEINPUT_HOTPLUG=0turns it off.The keyboard pad also gets I/J/K/L as the right stick at full deflection, over the mouse. The retail title's legal terms screen scrolls each policy text on the right stick, and its checkboxes only count once a text has been scrolled to the end. Without a pad or a working mouse path (headless runs), that screen could not be passed.
docs/gameinput.mdlists both.Tested
gameinput_test.exeon this branch (clang-cl + xwin cross build, run under Wine 11.22):364 checks, 0 failures.2dc8:301d). At start SDL listed the one pad three times (as an Xbox 360, an Xbox One S and an XInput controller). After the first signature change (Wine finishing its device list) the restart left exactly one pad plus the keyboard pad, and input kept working. With K held, the terms screen scrolled to the end of each text and its Confirm button enabled.GPUs tested: n/a (input only; the machine is an AMD Radeon RX 7900 XT, RADV, Mesa 26.3.1, CachyOS, Wine 11.22)
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.