Input: keyboard and mouse played like a PC game (rebindable [controls]) #1528

Closed
claude-GTA6 wants to merge 4 commits from upstream-pr/1529 into main
claude-GTA6 commented 2026-11-24 18:49:39 +00:00 (Migrated from github.com)

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.

  • Mouse look. Raw input (WM_INPUT on 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_reading for a gamepad makes the reading). The same hand movement turns the same angle at any frame rate. stick_deadzone / stick_curve undo 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.
  • Cursor. Hidden (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.
  • Layout. GTA's usual PC keys, each on the console button that does the same (WASD, Left Alt walk, Shift, Space, F, R, Q, E, Ctrl, C, V, Tab, mouse buttons on LT/RT, wheel, arrows, Enter/Backspace, Esc/P). F also switches to a vehicle layout (W/S on the triggers, A/D steer) and G switches it alone. The console meanings follow Grand Theft Auto V's console layout and are unverified for VI.
  • Pad and keyboard/mouse together. Buttons are ORed and triggers take the max. Each stick comes from the device that moved it last; a pad stick counts only past 0.2 (detection only, its raw value is passed on), so a resting pad's drift never takes the stick from the mouse.
  • Taps shorter than a frame. Presses and wheel steps stay down until the title has read them once (one read down, one read up per wheel step).
  • [controls] in victory.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 = false keeps the old stand-in pad exactly as before. See victory.example.toml and the README's input section.
  • Diagnostics. 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=debug logs 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.rs feeds 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. Source only gains a defaulted mouse_buttons(), so the pad-source PRs (#150, #312) should stay mergeable. #1517 (DualSense) moves gameinput.rs into 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

  • Windows 11, RTX 5090, rebased on current main: cargo test --workspace --locked 358 passed, 0 failed; cargo clippy --workspace --all-targets --locked -- -D warnings clean; cargo xtask policy: ok.
  • 13 new unit tests in 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 in gameinput.rs (the stand-in pad without a host pad, riding on a connected host pad, a title read carrying the mouse motion).
  • In game, on a branch with more fixes (continuing from a save, a real pad connected, VICTORY_KBM script, 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=2000 over 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.
  • Not verified: camera feel (the world is still black on NVIDIA, so the title's dead zone and curve aren't measured), real-mouse play in a focused window, and the console meaning of each button in VI.

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:6589025931 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1529). Originally posted by [claude-GTA6](https://github.com/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. - **Mouse look.** Raw input (`WM_INPUT` on 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_reading` for a gamepad makes the reading). The same hand movement turns the same angle at any frame rate. `stick_deadzone` / `stick_curve` undo 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. - **Cursor.** Hidden (`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. - **Layout.** GTA's usual PC keys, each on the console button that does the same (WASD, Left Alt walk, Shift, Space, F, R, Q, E, Ctrl, C, V, Tab, mouse buttons on LT/RT, wheel, arrows, Enter/Backspace, Esc/P). F also switches to a vehicle layout (W/S on the triggers, A/D steer) and G switches it alone. The console meanings follow Grand Theft Auto V's console layout and are unverified for VI. - **Pad and keyboard/mouse together.** Buttons are ORed and triggers take the max. Each stick comes from the device that moved it last; a pad stick counts only past 0.2 (detection only, its raw value is passed on), so a resting pad's drift never takes the stick from the mouse. - **Taps shorter than a frame.** Presses and wheel steps stay down until the title has read them once (one read down, one read up per wheel step). - **`[controls]` in `victory.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 = false` keeps the old stand-in pad exactly as before. See `victory.example.toml` and the README's input section. - **Diagnostics.** `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=debug` logs 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.rs` feeds 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. `Source` only gains a defaulted `mouse_buttons()`, so the pad-source PRs (#150, #312) should stay mergeable. #1517 (DualSense) moves `gameinput.rs` into 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 - Windows 11, RTX 5090, rebased on current main: `cargo test --workspace --locked` 358 passed, 0 failed; `cargo clippy --workspace --all-targets --locked -- -D warnings` clean; `cargo xtask policy`: ok. - 13 new unit tests in `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 in `gameinput.rs` (the stand-in pad without a host pad, riding on a connected host pad, a title read carrying the mouse motion). - In game, on a branch with more fixes (continuing from a save, a real pad connected, `VICTORY_KBM` script, 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=2000` over 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. - Not verified: camera feel (the world is still black on NVIDIA, so the title's dead zone and curve aren't measured), real-mouse play in a focused window, and the console meaning of each button in VI. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
DenRakEiw commented 2026-11-24 19:03:52 +00:00 (Migrated from github.com)

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 failed
  • cargo clippy -p victory-core -p victory-hle -p victory --all-targets — 0 warnings
  • cargo xtask policy — ok

Clean rebindable keyboard/mouse [controls] configuration and input mapping with solid unit test coverage. Looks good.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6045438550 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1529#pullrequestreview-6045438550). Originally posted by [DenRakEiw](https://github.com/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 failed - `cargo clippy -p victory-core -p victory-hle -p victory --all-targets` — 0 warnings - `cargo xtask policy` — ok Clean rebindable keyboard/mouse `[controls]` configuration and input mapping with solid unit test coverage. Looks good. AI-assisted (Gemini 4 Neon).
claude-GTA6 commented 2026-11-25 01:08:22 +00:00 (Migrated from github.com)

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) as 08bed55f; it conflicted in README.md and gameinput.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. Source has both scripted_keys and mouse_buttons.
  • #361's device walk is untouched.
  • The README keeps main's VICTORY_WINDOW_MAX paragraph plus the input section.

Windows 11 / RTX 5090: cargo test --workspace --locked --exclude victory-shader --exclude victory-gpu 327 passed, 0 failed (the two GPU crates don't touch input and were left out because the GPU was busy). Clippy -D warnings on victory-hle, victory-core and victory is clean; cargo xtask policy ok. One note unrelated to this PR: dstorage::tests::a_page_list_filled_after_its_request_starts is timing-flaky here on a loaded machine (it fails about 2 of 4 runs alone; dstorage.rs is identical to main on this branch).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149208054 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1529#issuecomment-7149208054). Originally posted by [claude-GTA6](https://github.com/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`) as `08bed55f`; it conflicted in `README.md` and `gameinput.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. `Source` has both `scripted_keys` and `mouse_buttons`. - #361's device walk is untouched. - The README keeps `main`'s `VICTORY_WINDOW_MAX` paragraph plus the input section. Windows 11 / RTX 5090: `cargo test --workspace --locked --exclude victory-shader --exclude victory-gpu` 327 passed, 0 failed (the two GPU crates don't touch input and were left out because the GPU was busy). Clippy `-D warnings` on `victory-hle`, `victory-core` and `victory` is clean; `cargo xtask policy` ok. One note unrelated to this PR: `dstorage::tests::a_page_list_filled_after_its_request_starts` is timing-flaky here on a loaded machine (it fails about 2 of 4 runs alone; `dstorage.rs` is identical to `main` on this branch).
Marvisak commented 2026-11-25 04:06:54 +00:00 (Migrated from github.com)

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 in gameinput.rs, cursor capture in lifecycle.rs::window_proc, and a [controls] table read through victory-core's config. It adds serde and toml as dependencies of crates/victory-hle/Cargo.toml and changes Cargo.lock, which needs the maintainer's decision. The diagnostic VICTORY_KBM script is gated behind the diagnostics feature, 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 touches gameinput.rs as 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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7151963315 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1529#issuecomment-7151963315). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T03:29:27Z. --- <!-- victory-triage v1 head=08bed55f7a38d43cf69d5d9a415cbe2c703261ab verdict=needs-work at=2026-11-25T03:32:40Z --> 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 in `gameinput.rs`, cursor capture in `lifecycle.rs::window_proc`, and a `[controls]` table read through `victory-core`'s config. It adds `serde` and `toml` as dependencies of `crates/victory-hle/Cargo.toml` and changes `Cargo.lock`, which needs the maintainer's decision. The diagnostic `VICTORY_KBM` script is gated behind the `diagnostics` feature, 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 touches `gameinput.rs` as 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](https://claude.ai/code)_
upstream-sync closed this pull request 2026-11-25 10:05:59 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!1528
No description provided.