Host input for the virtual pad: XInput controllers, keyboard mapping, rumble (was #47) #207
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
library
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/omonkeyz--xbox-emulator!207
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/207/head"
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?
@QuentinDanblon on GitHub · 2026-11-23 01:16 UTC · original
QuentinDanblon:pr/pad-host→main· +654 −8 · 5 files · 1 commits · closed without mergingLibrary / area: compat-common (GameInput virtual pad)
Exports changed (exports.txt rows): none
Source of the behaviour: XInput and GameInput public documentation (Microsoft Learn). No third-party code.
Part of the split of #152 (was #47): the pad host / gamepad change on its own. Based on
c2a3522, 5 files, +654 / -8, onlycompat-common.pad_host.rsfeeds the virtual gamepad from a real XInput pad (xinput1_4.dll, loaded at run time), only while the host GameInput reports no gamepad itself.downis held.SetRumbleStateon the virtual pad sends the low and high motors to the XInput pad that feeds it.GetNextReading/GetPreviousReadingsee them like scripted ones.TOMBOX_PAD_XINPUT/pad_xinput,TOMBOX_PAD_KEYS/pad_keys.tools/dev/pad.ps1is not touched. The one change #47 made to it, for when you regenerate it, was a line in the help output:host input (a real XInput pad, keyboard WASD/arrows/Space... while the title window is focused) feeds the same pad; a running script, or a scripted 'down' not yet released, masks it (compat-common pad_host.rs).Tests: eight unit tests in
pad_host.rs(XInput buttons and axes to GameInput values, key mapping, combining sources, scripted pad priority, modes and window classes, rumble levels),tests/pad_host.rs(a key pressed in a foreground window reaches the published reading) andhost_state_reaches_readings_and_their_historyingamepad.rs.Results
--release, this branch alone onc2a3522(it merges into2eda8b0without conflict, not rerun there):cargo test -p compat-common --lib -- pad_host gamepad host_input gameinput: 33 passed, 0 failed.--test gameinput_ext: 3 passed.--test pad_host: 1 passed, but on this run it skipped its key injection: the test process could not take the foreground (foreground lock), and the test then returns early by design. So the path from a real key press to the published reading was not exercised here.No comment lines added (PR gate: 5 files checked, 0 problems). Not run against a title, and not run with a physical pad on this base.
cargo test -p compat-commonpasses for the pad, GameInput and host input testsmissingwith a note🤖 Generated with Claude Code
@omonkeyz on GitHub · 2026-11-23 01:57 UTC · original
Applied in
0f84770(merged inad24144) with your authorship kept, thanks. One change on top, in563322a: host input is now opt-in. Our automated runs show visible title windows, and must never take real pad or keyboard input. So TOMBOX_PAD_XINPUT and TOMBOX_PAD_KEYS (and the pad_xinput / pad_keys cfg entries) now default to off. Setting 1 forces a source on, and auto gives your original behaviour. The unit test and tests/pad_host.rs were updated to match. The trailing comments in the key table were dropped inf9c3ec5.Pull request closed