Keep Sony pads reachable alongside XInput controllers #420

Closed
github-bot wants to merge 0 commits from github-bot/gh-420 into main AGit
Owner

@⁠Yoshi-233 on GitHub · 2026-12-02 05:58 UTC · original
Yoshi-233:fix/mixed-xinput-hid-slots → main · +60 −11 · 2 files · 72 commits · closed without merging

With an Xbox controller in XInput slot 0 and a single Sony controller on raw HID, Foxhound reads the Xbox pad, then looks up HID device index 1 for host slot 1. The Sony controller is at HID index 0, so its buttons never reach the game. With two Sony pads, the second one can appear while the first is missing.

This change records the host slot on the HID device. A surviving reader keeps its assignment when another device is unplugged. If XInput takes over its slot, the displaced HID pad can claim a free slot on a subsequent poll. Rumble uses the same assignment as input, including when the game exposes the controllers as one pad.

Validation

  • Ran the actual input and rumble routing functions on Linux with mocked Windows controller I/O. Tested every XInput occupancy mask across four slots, with zero through four HID devices for each mask. On main (94c3c5f), 41/80 combinations had the expected devices and rumble destinations. With this change, 80/80 matched in both individual and merged-pad modes.
  • Simulated unplugging one of two HID pads, adding a replacement, and a new XInput controller claiming an occupied slot. Checked the surviving pad's identity and the physical target of each rumble write. Also checked XInput-only behavior with VICTORY_HID_PADS=0.
  • All 14 HID module tests passed, including the new assignment regression. cargo check --locked -p victory-hle --tests --target x86_64-pc-windows-gnu passed with default features and with --all-features.

Physical Windows controller testing is still pending. A short hardware check is to connect an Xbox pad first and a DualSense or DualShock 4 second, check a button from each, then unplug the Xbox pad and check the Sony pad again.

**@⁠Yoshi-233** on GitHub · 2026-12-02 05:58 UTC · [original](https://github.com/readmet3xt-lab/foxhound/pull/420) `Yoshi-233:fix/mixed-xinput-hid-slots` → `main` · +60 −11 · 2 files · 72 commits · closed without merging With an Xbox controller in XInput slot 0 and a single Sony controller on raw HID, Foxhound reads the Xbox pad, then looks up HID device index 1 for host slot 1. The Sony controller is at HID index 0, so its buttons never reach the game. With two Sony pads, the second one can appear while the first is missing. This change records the host slot on the HID device. A surviving reader keeps its assignment when another device is unplugged. If XInput takes over its slot, the displaced HID pad can claim a free slot on a subsequent poll. Rumble uses the same assignment as input, including when the game exposes the controllers as one pad. ### Validation - Ran the actual input and rumble routing functions on Linux with mocked Windows controller I/O. Tested every XInput occupancy mask across four slots, with zero through four HID devices for each mask. On main (`94c3c5f`), 41/80 combinations had the expected devices and rumble destinations. With this change, 80/80 matched in both individual and merged-pad modes. - Simulated unplugging one of two HID pads, adding a replacement, and a new XInput controller claiming an occupied slot. Checked the surviving pad's identity and the physical target of each rumble write. Also checked XInput-only behavior with `VICTORY_HID_PADS=0`. - All 14 HID module tests passed, including the new assignment regression. `cargo check --locked -p victory-hle --tests --target x86_64-pc-windows-gnu` passed with default features and with `--all-features`. Physical Windows controller testing is still pending. A short hardware check is to connect an Xbox pad first and a DualSense or DualShock 4 second, check a button from each, then unplug the Xbox pad and check the Sony pad again.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 06:03:21 +00:00
github-bot closed this pull request 2026-12-02 07:54:15 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.