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

Closed
github-bot wants to merge 4 commits from gh-pr/1529/head into gh-pr/1529/base
Owner

@⁠claude-GTA6 on GitHub · 2026-11-24 18:49 UTC · original
claude-GTA6:pr-pc-controls → main · +1807 −60 · 10 files · 4 commits · closed without merging

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

**@⁠claude-GTA6** on GitHub · 2026-11-24 18:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/1529) `claude-GTA6:pr-pc-controls` → `main` · +1807 −60 · 10 files · 4 commits · closed without merging *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)
The title reads gamepads and keyboards only (it registers no mouse), so the
keyboard and mouse act as a pad: on the first connected host pad, or on the
stand-in pad when none is. GTA's usual PC keys sit on the console buttons
that do the same; F switches to a vehicle layout (W/S on the triggers).

Mouse look: raw input (no pointer acceleration) 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 then, at that read: the same hand
movement turns the same angle at any frame rate. The title's stick dead
zone and curve can be undone (stick_deadzone, stick_curve), a flick past
full stick is turned in full a little later, and the cursor is hidden and
held in the window while it has focus (Alt-Tab or Esc frees it, a click or
Esc captures it; the capturing click is no shot).

Pad and keyboard/mouse work together: buttons OR, triggers max, each stick
from whichever device moved it last (a resting pad's drift never takes it).
Presses and wheel steps stay down until the title has read them, so taps
shorter than a frame count. [controls] in victory.toml sets and rebinds
everything; enabled = false keeps the old stand-in pad.

Diagnostics: VICTORY_KBM plays keys and mouse motion into this layer;
gameinput=debug logs each pad state the title reads.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
run.rs: keep upstream's fidelityfx::use_host_dir and this PR's controls::configure, both before the import registry is used.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicts in README.md and gameinput.rs, where upstream gained the
scripted keys on a connected host pad (64484b42) and the window size
note. Both sides are kept: scripted keys are applied to the host pads
first, then the keyboard and mouse layer rides on the first connected
pad or the stand-in pad; Source has both scripted_keys and
mouse_buttons. The no-device reading walk (#361) is untouched by this
branch.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:35:19 +00:00
github-bot closed this pull request 2026-11-26 04:35:19 +00:00
Author
Owner

@⁠claude-GTA6 on GitHub · 2026-11-25 01:06 UTC · original

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).

**@⁠claude-GTA6** on GitHub · 2026-11-25 01:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/1529#issuecomment-7149208054) *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).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 03:29 UTC · original

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

**@⁠Marvisak** on GitHub · 2026-11-25 03:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/1529#issuecomment-7151963315) <!-- 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)_

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1529
No description provided.