Input: keyboard and mouse played like a PC game (rebindable [controls]) #1528
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1529"
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?
Imported from Marvisak/VIctory. Originally posted by claude-GTA6 on 2026-11-24T18:49:39Z.
From a tester working with Claude (AI-assisted); measured on my own machine.
What
Keyboard and mouse played like a PC game, not only the fixed stand-in pad.
The title registers device callbacks for Gamepad (0x40000) and Keyboard (0x10) only, never Mouse (0x20), so there is no mouse path in the title. The keyboard and mouse therefore act as a pad: on the first connected host pad, or on the stand-in pad when none is connected.
WM_INPUTon a message-only window of its own thread, so no pointer acceleration and no Windows setting involved) becomes the right stick. The title reads its stick as a turn rate, so the counts since its last pad read are divided by the time since that read, at that read (current_readingfor a gamepad makes the reading). The same hand movement turns the same angle at any frame rate.stick_deadzone/stick_curveundo the title's own stick shaping (defaults 0 / 1, not calibrated yet). A flick past full stick is turned in full a little later (at most 100 ms of carry). Reads less than 2 ms apart see the same value.WM_SETCURSOR) and held in the client area (ClipCursor) while the title window has focus. Alt-Tab (focus loss) or Esc frees it, a click or Esc captures it again. Mouse buttons held at the moment of capture are not passed on until they are released, so the click that captures is no shot.[controls]invictory.toml. Sensitivity, y scale, invert, capture, carry, dead zone, curve, walk speed, and[controls.on_foot]/[controls.vehicle]rebinding (one output, a list, or""to unbind). Unknown keys, outputs and fields are errors at start.enabled = falsekeeps the old stand-in pad exactly as before. Seevictory.example.tomland the README's input section.VICTORY_KBM=<s>:<key>[*<hold>],<s>:MouseX=<counts>[*<hold>],<s>:Wheel=<n>plays input into this layer without touching OS input.VICTORY_LOG=victory_hle::modules::gameinput=debuglogs each pad state the title reads when it changes.New file
crates/victory-hle/src/modules/controls.rs(plain data, no Windows calls; the unit tests live there).gameinput.rsfeeds it from the poll thread and drains it on title reads;lifecycle.rs's window hook handles the cursor;victory-core's config passes the[controls]table through.Sourceonly gains a defaultedmouse_buttons(), so the pad-source PRs (#150, #312) should stay mergeable. #1517 (DualSense) movesgameinput.rsinto a folder, so whichever of the two lands second needs a rebase; the controls layer itself is independent of it.An AI tool wrote this change.
Tested
cargo test --workspace --locked358 passed, 0 failed;cargo clippy --workspace --all-targets --locked -- -D warningsclean;cargo xtask policy: ok.controls.rs(WASD + walk, buttons/triggers, vehicle layout, sub-frame taps, wheel pulses, counts to rate, slow frames, close reads, dead zone/curve/invert, flick carry, pad drift vs mouse, config rebinding and refusals) and 3 ingameinput.rs(the stand-in pad without a host pad, riding on a connected host pad, a title read carrying the mouse motion).VICTORY_KBMscript, title-read log): every scripted input reached the pad the title read (device 0): Enter -> A on the start screen, W -> left stick +1,MouseX=2000over 1 s -> right stick +1.0, Space -> X with right mouse -> LT 1.0, wheel -> one D-pad press and release, Tab -> LB, a fast left flick -> -1.0 then -0.4 (carry) then 0. The world was loaded but ran at 0.5-0.8 fps, so the title read the pad only every 1-2 s. Presses made between reads arrived latched in the next read (Esc, Right, Right, Left -> one read with Menu+Left+Right). Short stick holds between reads are missed, which is expected for sticks. This is also why the longest span is 1 s: with 250 ms the rate came out 4x too high on these frames.🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-24T18:57:00Z.
Review: APPROVED
Verified locally merged onto
origin/main(Windows 11 x64, Rust 1.98.1 MSVC):cargo test -p victory-core -p victory-hle -p victory— all 123 tests passed, 0 failedcargo clippy -p victory-core -p victory-hle -p victory --all-targets— 0 warningscargo xtask policy— okClean rebindable keyboard/mouse
[controls]configuration and input mapping with solid unit test coverage. Looks good.AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by claude-GTA6 on 2026-11-25T01:06:12Z.
From a tester working with Claude (AI-assisted); measured on my own machine.
Merged current
main(42363ab6) as08bed55f; it conflicted inREADME.mdandgameinput.rs. Both sides are kept:main's scripted keys (64484b42) are applied to the host pads first, then the keyboard and mouse layer rides on the first connected pad or the stand-in.Sourcehas bothscripted_keysandmouse_buttons.main'sVICTORY_WINDOW_MAXparagraph plus the input section.Windows 11 / RTX 5090:
cargo test --workspace --locked --exclude victory-shader --exclude victory-gpu327 passed, 0 failed (the two GPU crates don't touch input and were left out because the GPU was busy). Clippy-D warningsonvictory-hle,victory-coreandvictoryis clean;cargo xtask policyok. One note unrelated to this PR:dstorage::tests::a_page_list_filled_after_its_request_startsis timing-flaky here on a loaded machine (it fails about 2 of 4 runs alone;dstorage.rsis identical tomainon this branch).Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T03:29:27Z.
Automated triage for the maintainers.
Needs work: needs the maintainer's decision. This is a large input feature:
modules/controls.rs(1,083 lines), raw mouse input on its own thread ingameinput.rs, cursor capture inlifecycle.rs::window_proc, and a[controls]table read throughvictory-core's config. It addsserdeandtomlas dependencies ofcrates/victory-hle/Cargo.tomland changesCargo.lock, which needs the maintainer's decision. The diagnosticVICTORY_KBMscript is gated behind thediagnosticsfeature, which is good. The description says the button mapping follows another title's console layout and is unverified for this one, and mouse feel and play in a focused window are untested. #1517 touchesgameinput.rsas well, so one of the two will need a rebase. No CI ran. What would help: the maintainer's decision on the dependencies and scope, and evidence for the button meanings.Generated by Claude Code
Pull request closed