Input: generic HID pads (no-name USB pads), and victory pads to see their buttons #588
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!588
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-588"
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?
@JuanF007 on GitHub · 2026-11-28 01:22 UTC · original
JuanF007:feat/generic-hid-pads→main· +1269 −17 · 6 files · 1 commits · openSummary
Generic HID gamepads (DirectInput pads) were not recognised at all: input came only from XInput and from Sony's pads read over HID. A no-name USB pad such as a DragonRise "PC Controller" (0079:0126) did nothing in game. This PR adds a reader for any HID joystick or gamepad that XInput does not list and that is not one of Sony's pads, plus a
victory padscommand to see what such a pad sends.What changes
crates/victory-hle/src/modules/gameinput/generic.rs(new): the generic HID pad reader, built like the PlayStation one: a scan thread every 2 s, and a reader thread per pad.Reports are parsed by Windows' HID parser (
HidP_GetUsageValue/HidP_GetUsages), from the usages the pad's descriptor gives:Signed ranges are sign-extended, and an unsigned maximum given as negative (255 in 8 bits as -1) is read as unsigned.
Button layout. No standard says which number is which button, so the layout goes by vendor. The default is the PlayStation look-alike one most no-name pads have:
3,2,4,1,5,6,7,8,9,10,11,12, in the order A,B,X,Y,LB,RB,LT,RT,View,Menu,LS,RS. Logitech (046D) and Nintendo (057E) get their usual numbering.VICTORY_PAD_BUTTONSinvictory-settings.txtsets another layout: 12 numbers, or 16 with D-pad buttons, in VIscosity's order.Not taken as pads:
IG_in the path) and Sony's pads (the PlayStation reader's).A pad whose device is gone is forgotten at the next scan. A Bluetooth pad switched off can leave its read waiting forever, and would otherwise hold its last buttons down.
Generic pads do not rumble, since they have no common way to.
gameinput.rs:VICTORY_DUALSENSE=1.VICTORY_GENERIC_PADS=0turns generic pads off.VICTORY_DUALSENSE=0now turns off only the PlayStation pads.playstation.rs:hid_pathsis shared with the generic reader. No behaviour change.victory pads(main.rs,play.rs): lists the XInput slots in use and the generic pads found. It then shows live the button numbers, axes and hat each generic pad sends, and the console buttons they make. It reads the pad settings fromvictory-settings.txtas a start would.The axis assignment and the
VICTORY_PAD_BUTTONSorder follow FrancescoGelosoEterea/VIscosity, commit d8db7a0 (gameinput/hid.rs, GPL-3.0). The code itself is new.How a player uses it
victory.exe padsin a command prompt and press each button.VICTORY_PAD_BUTTONS=<numbers>to%LOCALAPPDATA%\victory\victory-settings.txt.Testing
cargo test -p victory-hle --lib: 192 passed. The new tests cover sticks, triggers, hat ranges, signed and unsigned ranges, layouts and their parsing, Desktop buttons, axes that rest away from the centre, and the monitor line.victory pads. Every face button, L1/R1/L2/R2, Select/Start, L3/R3, the hat (it returns to centre on release) and both sticks read right with the default layout. No axis was wrongly taken as off-centre.cargo xtask policy --staged: ok.cargo clippy --workspace --all-targets -- -D warningsalready fails onmainwith the pinned 1.98.1 toolchain, on code this PR does not touch (victory-gpu, victory-formats, victory-loader, other victory-hle modules).generic::pads()thatvictory padsshows. The Logitech and Nintendo layouts and pads with several report ids were not tested on hardware either.Known limits
VICTORY_GENERIC_PADS=0turns generic pads off.victory padsshows their buttons 95229e4328View 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.