Input: PC keyboard and mouse (VICTORY_MOUSE_LOOK, VICTORY_BINDS=rockstar) and key caps over the button prompts (VICTORY_PROMPTS=keys) #455

Open
github-bot wants to merge 5 commits from github-bot/gh-455 into main AGit
Owner

@⁠Jesper-Andersson on GitHub · 2026-11-27 10:34 UTC · original
Jesper-Andersson:pc-input → main · +4350 −78 · 20 files · 5 commits · open

No issue asks for this (searched upstream issues for mouse, keyboard, keybind, prompts, glyph and similar: nothing), so there is no Fixes #.

With no gamepad, the keyboard drives a stand-in pad (crates/victory-hle/src/modules/gameinput.rs), but the mouse does nothing, the layout is not one a PC player knows, and every prompt shows a gamepad button. This PR adds three opt-in switches, all off by default; with none of them set the input path and prompts are as on main.

Change

  • VICTORY_MOUSE_LOOK=1: raw mouse travel (WM_INPUT, unaccelerated, read on a message-only window in its own thread) becomes the stand-in pad's right stick: smoothed over about 30 ms, lifted past the stick's dead zone so slow aiming moves, at rest within about 90 ms of the mouse stopping (Look in gameinput.rs). While the title's window has focus the pointer is clipped to its centre and hidden (WM_SETCURSOR in lifecycle.rs); F8 lets it go and takes it again, and losing focus lets it go. Mouse buttons play only while the pointer is held, and only after all were up once (the click that focuses the window does not fire). Tuned by VICTORY_MOUSE_SENS (default 1: 1000 counts a second is a full deflection), VICTORY_MOUSE_INVERT=1 and VICTORY_MOUSE_DEAD (default 0.2).
  • VICTORY_BINDS=rockstar: GTA V's PC default keys on GTA V's pad layout, with an on-foot and a driving layout. F (enter or leave a vehicle, the pad's Y) switches layouts; F7 switches without pressing Y, for when the two get out of step. classic (or unset) is the old table, unchanged. The bind tables move to crates/victory-core/src/pad.rs, so input and prompts read the same table.
  • VICTORY_PROMPTS=keys (Series 1.0.2.1 only): key caps over the title's button prompts. When the streaming store hands over the icon movie, a copy is redrawn in memory (crates/victory-game/src/prompts.rs, prompts/hook.rs): each known icon becomes a white key cap with the key that the bind table in force gives that control, outlined at run time from the host's Segoe UI through GDI (prompts/font.rs). The title is answered with the copy's address when it loads that movie. A control without a key keeps its picture. The movie is recognised by its structure (class names ending in icon numbers, still sprites of shapes); nothing of the game is stored, and the tests use hand-built movies. This is a port of imjustprism's Marvisak/VIctory#3433 (its loader helpers and Scaleform reader are picked as they are, authorship kept); changes to it: the keys come from VICTORY_BINDS instead of a fixed table, labels for Space, Shift, Ctrl and mouse buttons, an environment switch instead of --prompts keys.
  • VICTORY_MOUSE_DEVICE=1 (diagnostic): also reports a GameInput mouse device, and the log names each input kind the title asks for once (title asks for input kind).
  • KNOWN_BUILDS gets its first entry, Series 1.0.2.1 (BLAKE3 of the executable) with the two hook offsets from #3433 (a pointer slot and a function), as docs/asset-policy.md allows.

The rockstar binds

Keys On foot Driving
W A S D left stick W / S: RT / LT (pedals), A D: steer
mouse buttons (with mouse look) left: RT (fire), right: LT (aim), middle: R3 left: RB, right: LB (drive-by)
E A (confirm, interact; the key A's prompts show) L3 (horn)
Left Shift, Space A (sprint), X (jump) -, RB (handbrake)
R, Q, Tab B (reload, melee), RB (cover), LB (weapon wheel) B (cinematic camera), D-pad left (radio), LB
Left Ctrl, H L3 (stealth) -, D-pad right (headlights)
F, C, V Y (vehicle, and switches layout), R3 (look behind), View (camera) the same
Enter, Backspace, Esc / P / M, arrows, Z A, B, Menu, D-pad (right arrow: D-pad right, GTA V's context action), D-pad down the same
I J K L right stick the same
F7 / F8 switch layout / let the pointer go or take it the same

Findings

  • The title only ever asks GameInput for keyboard (0x10) and gamepad (0x40000) input kinds, never mouse (0x20) (the title asks for input kind log line, once per kind asked), also in a run with VICTORY_MOUSE_DEVICE=1 reporting a mouse device into the world. So it has no mouse path of its own to feed: mouse look has to go through the right stick, and its prompts can only be pad pictures, unless we draw key caps over them.

Where it does nothing

  • All switches unset: Binds::Classic is the old FALLBACK_BUTTONS table (test classic_binds_are_the_old_table), no mouse is read, no mouse device is reported (test the_mouse_device_reports_summed_travel_when_switched_on, off case), and no hook is placed.
  • VICTORY_PROMPTS=keys on another build: nothing is placed, and the run says prompts gamepad pictures: the keys need a known build. A movie that is not the icon movie, or one with parts the reader cannot read, is passed through unchanged (tests in prompts.rs).
  • A host gamepad connected: the stand-in pad is not shown, as before.

Checks

  • cargo test --locked -p victory-hle --lib gameinput: 13 passed (5 new: classic table, rockstar layouts and the F/F7 switch, mouse travel to stick and back to rest, mouse look only while captured, the mouse device); the same with --all-features: 13 passed

  • cargo test --locked -p victory-core: 17 passed (pad: 4 new)

  • cargo test --locked -p victory-game: 40 passed (prompts: 37 new, on hand-built movies and a host-font check)

  • cargo test --locked -p victory-formats --lib gfx: 18 passed (new)

  • cargo test --locked -p victory-loader: all passed (52 unit, load_probe with the new pointer-slot checks)

  • cargo check --locked -p victory: ok

  • cargo clippy --locked --all-targets [--all-features] on victory-core, -formats, -loader, -game, -hle, victory: no warnings in changed code (the existing ones on main are in victory-loader/src/descriptor_sites.rs and victory-gpu)

  • cargo xtask policy: 277 files ok

  • In game: unattended runs on a local branch (RTX 2070 SUPER, Series S + DLSS) with all three switches: the log showed raw mouse input on, the pointer captured, prompts: key caps drawn into the icon movie and prompts: the title loads the icon movie with key caps, and no crash. Then a play session of about 17 minutes by hand with all three on (mouse look, rockstar binds, key caps). Those runs were on a local branch with other changes; this branch is these commits alone on main.

Not checked

  • The 17-minute session ended in a GPU device removal soon after a new compute pipeline (85df3e0b, a ray-tracing resolve pass, in the ocean area) was first used. Looked at since: that shader is an ordinary wave32 program without group-shared memory, its 12 s driver build was like nine others just before, the reason given was DXGI_ERROR_DEVICE_REMOVED with nothing of ours running on the card, and the card's memory was at its budget then. So it looks like memory pressure or the driver, not input; not proven, and not ruled out on this branch.
  • AMD GPUs, other builds than Series 1.0.2.1 (the prompts hook needs its offsets), Linux/Proton, high-DPI or multi-monitor pointer clipping.
  • Limits: the icon movie is drawn once, so prompts keep the layout in force then (on foot names even while driving); the title's animated prompts keep their pictures. The F toggle follows key presses, not the game's state, so it can drift (a failed vehicle entry, a cutscene); F7 resyncs.
  • #153 (closed by its author, no comments): the same idea, mouse as right stick with a PC key layout and cursor recentring. Its pointer hiding, F8 release and dead-zone lift are reused here. This PR adds the driving layout switch on F, raw input instead of cursor travel, and the key-cap prompts.
  • Marvisak/VIctory#3433 (open, imjustprism): the key-cap prompts this ports; credited in the commits (two picked as they are, the prompts commit with Co-authored-by).
  • Other forks have mouse-look or rebinding PRs without prompts: Marvisak/VIctory#3345, #1157, #2182, #3494; DexNom/VIctory#82 (mouse look and VICTORY_KEYBINDS); trustno1-coder/VIctory-NVIDIA#9 (merged, a GameInput mouse device from cursor deltas; per the finding above the title does not read one here). No open upstream PR covers any of this.

This change was made with AI assistance (Claude Code).

**@⁠Jesper-Andersson** on GitHub · 2026-11-27 10:34 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/455) `Jesper-Andersson:pc-input` → `main` · +4350 −78 · 20 files · 5 commits · open No issue asks for this (searched upstream issues for mouse, keyboard, keybind, prompts, glyph and similar: nothing), so there is no `Fixes #`. With no gamepad, the keyboard drives a stand-in pad (`crates/victory-hle/src/modules/gameinput.rs`), but the mouse does nothing, the layout is not one a PC player knows, and every prompt shows a gamepad button. This PR adds three opt-in switches, all off by default; with none of them set the input path and prompts are as on main. ## Change - **`VICTORY_MOUSE_LOOK=1`**: raw mouse travel (`WM_INPUT`, unaccelerated, read on a message-only window in its own thread) becomes the stand-in pad's right stick: smoothed over about 30 ms, lifted past the stick's dead zone so slow aiming moves, at rest within about 90 ms of the mouse stopping (`Look` in `gameinput.rs`). While the title's window has focus the pointer is clipped to its centre and hidden (`WM_SETCURSOR` in `lifecycle.rs`); **F8** lets it go and takes it again, and losing focus lets it go. Mouse buttons play only while the pointer is held, and only after all were up once (the click that focuses the window does not fire). Tuned by `VICTORY_MOUSE_SENS` (default 1: 1000 counts a second is a full deflection), `VICTORY_MOUSE_INVERT=1` and `VICTORY_MOUSE_DEAD` (default 0.2). - **`VICTORY_BINDS=rockstar`**: GTA V's PC default keys on GTA V's pad layout, with an on-foot and a driving layout. **F** (enter or leave a vehicle, the pad's Y) switches layouts; **F7** switches without pressing Y, for when the two get out of step. `classic` (or unset) is the old table, unchanged. The bind tables move to `crates/victory-core/src/pad.rs`, so input and prompts read the same table. - **`VICTORY_PROMPTS=keys`** (Series 1.0.2.1 only): key caps over the title's button prompts. When the streaming store hands over the icon movie, a copy is redrawn in memory (`crates/victory-game/src/prompts.rs`, `prompts/hook.rs`): each known icon becomes a white key cap with the key that the bind table in force gives that control, outlined at run time from the host's Segoe UI through GDI (`prompts/font.rs`). The title is answered with the copy's address when it loads that movie. A control without a key keeps its picture. The movie is recognised by its structure (class names ending in icon numbers, still sprites of shapes); nothing of the game is stored, and the tests use hand-built movies. This is a port of imjustprism's Marvisak/VIctory#3433 (its loader helpers and Scaleform reader are picked as they are, authorship kept); changes to it: the keys come from `VICTORY_BINDS` instead of a fixed table, labels for Space, Shift, Ctrl and mouse buttons, an environment switch instead of `--prompts keys`. - `VICTORY_MOUSE_DEVICE=1` (diagnostic): also reports a GameInput mouse device, and the log names each input kind the title asks for once (`title asks for input kind`). - `KNOWN_BUILDS` gets its first entry, Series 1.0.2.1 (BLAKE3 of the executable) with the two hook offsets from #3433 (a pointer slot and a function), as `docs/asset-policy.md` allows. ### The rockstar binds | Keys | On foot | Driving | |------|---------|---------| | W A S D | left stick | W / S: RT / LT (pedals), A D: steer | | mouse buttons (with mouse look) | left: RT (fire), right: LT (aim), middle: R3 | left: RB, right: LB (drive-by) | | E | A (confirm, interact; the key A's prompts show) | L3 (horn) | | Left Shift, Space | A (sprint), X (jump) | -, RB (handbrake) | | R, Q, Tab | B (reload, melee), RB (cover), LB (weapon wheel) | B (cinematic camera), D-pad left (radio), LB | | Left Ctrl, H | L3 (stealth) | -, D-pad right (headlights) | | F, C, V | Y (vehicle, and switches layout), R3 (look behind), View (camera) | the same | | Enter, Backspace, Esc / P / M, arrows, Z | A, B, Menu, D-pad (right arrow: D-pad right, GTA V's context action), D-pad down | the same | | I J K L | right stick | the same | | F7 / F8 | switch layout / let the pointer go or take it | the same | ## Findings - The title only ever asks GameInput for keyboard (`0x10`) and gamepad (`0x40000`) input kinds, never mouse (`0x20`) (the `title asks for input kind` log line, once per kind asked), also in a run with `VICTORY_MOUSE_DEVICE=1` reporting a mouse device into the world. So it has no mouse path of its own to feed: mouse look has to go through the right stick, and its prompts can only be pad pictures, unless we draw key caps over them. ## Where it does nothing - All switches unset: `Binds::Classic` is the old `FALLBACK_BUTTONS` table (test `classic_binds_are_the_old_table`), no mouse is read, no mouse device is reported (test `the_mouse_device_reports_summed_travel_when_switched_on`, off case), and no hook is placed. - `VICTORY_PROMPTS=keys` on another build: nothing is placed, and the run says `prompts gamepad pictures: the keys need a known build`. A movie that is not the icon movie, or one with parts the reader cannot read, is passed through unchanged (tests in `prompts.rs`). - A host gamepad connected: the stand-in pad is not shown, as before. ## Checks - `cargo test --locked -p victory-hle --lib gameinput`: 13 passed (5 new: classic table, rockstar layouts and the F/F7 switch, mouse travel to stick and back to rest, mouse look only while captured, the mouse device); the same with `--all-features`: 13 passed - `cargo test --locked -p victory-core`: 17 passed (`pad`: 4 new) - `cargo test --locked -p victory-game`: 40 passed (`prompts`: 37 new, on hand-built movies and a host-font check) - `cargo test --locked -p victory-formats --lib gfx`: 18 passed (new) - `cargo test --locked -p victory-loader`: all passed (52 unit, `load_probe` with the new pointer-slot checks) - `cargo check --locked -p victory`: ok - `cargo clippy --locked --all-targets [--all-features]` on victory-core, -formats, -loader, -game, -hle, victory: no warnings in changed code (the existing ones on main are in `victory-loader/src/descriptor_sites.rs` and `victory-gpu`) - `cargo xtask policy`: 277 files ok - In game: unattended runs on a local branch (RTX 2070 SUPER, Series S + DLSS) with all three switches: the log showed raw mouse input on, the pointer captured, `prompts: key caps drawn into the icon movie` and `prompts: the title loads the icon movie with key caps`, and no crash. Then a play session of about 17 minutes by hand with all three on (mouse look, rockstar binds, key caps). Those runs were on a local branch with other changes; this branch is these commits alone on main. ## Not checked - The 17-minute session ended in a GPU device removal soon after a new compute pipeline (`85df3e0b`, a ray-tracing resolve pass, in the ocean area) was first used. Looked at since: that shader is an ordinary wave32 program without group-shared memory, its 12 s driver build was like nine others just before, the reason given was `DXGI_ERROR_DEVICE_REMOVED` with nothing of ours running on the card, and the card's memory was at its budget then. So it looks like memory pressure or the driver, not input; not proven, and not ruled out on this branch. - AMD GPUs, other builds than Series 1.0.2.1 (the prompts hook needs its offsets), Linux/Proton, high-DPI or multi-monitor pointer clipping. - Limits: the icon movie is drawn once, so prompts keep the layout in force then (on foot names even while driving); the title's animated prompts keep their pictures. The F toggle follows key presses, not the game's state, so it can drift (a failed vehicle entry, a cutscene); F7 resyncs. ## Related - #153 (closed by its author, no comments): the same idea, mouse as right stick with a PC key layout and cursor recentring. Its pointer hiding, F8 release and dead-zone lift are reused here. This PR adds the driving layout switch on F, raw input instead of cursor travel, and the key-cap prompts. - Marvisak/VIctory#3433 (open, imjustprism): the key-cap prompts this ports; credited in the commits (two picked as they are, the prompts commit with `Co-authored-by`). - Other forks have mouse-look or rebinding PRs without prompts: Marvisak/VIctory#3345, #1157, #2182, #3494; DexNom/VIctory#82 (mouse look and `VICTORY_KEYBINDS`); trustno1-coder/VIctory-NVIDIA#9 (merged, a GameInput mouse device from cursor deltas; per the finding above the title does not read one here). No open upstream PR covers any of this. This change was made with AI assistance (Claude Code).
- VICTORY_MOUSE_LOOK=1: raw mouse travel (WM_INPUT on a message-only
  window) becomes the stand-in pad's right stick: smoothed, lifted past
  the stick's dead zone, at rest within about 90 ms of the mouse
  stopping. The pointer is held at the window's centre and hidden
  (WM_SETCURSOR) while the window has focus; F8 lets it go and takes it
  again. VICTORY_MOUSE_SENS, VICTORY_MOUSE_INVERT, VICTORY_MOUSE_DEAD.
  Mouse buttons play only while the pointer is held.
- VICTORY_BINDS=rockstar: GTA V's PC keys on GTA V's pad layout, an
  on-foot and a driving layout; F (enter or leave a vehicle) and F7
  switch them. The classic table stays the default.
- The bind tables move to victory-core (pad.rs), so prompts can name the
  key of a control; the control list follows imjustprism's
  Marvisak/VIctory#3433.
- VICTORY_MOUSE_DEVICE=1 reports a GameInput mouse device, and the log
  names each input kind the title asks for once, to tell whether the
  title has a mouse path of its own.

Ideas from avatarmanz/VIctory-7900XTX#153 (pointer hiding, F8,
dead-zone lift).

This change was made with AI assistance (Claude Code).
(cherry picked from commit fb91335e697693b0fa98c570794da0d294189999)
(cherry picked from commit 6cbc4e3a34206c454ed21bf2e91617fe89e2f0ea)
Ported from imjustprism's Marvisak/VIctory#3433 (4f7fdb5, "draw keyboard
key caps over the title's button prompts"): the icon movie is redrawn in
memory when the streaming store hands it over, each known icon a white key
cap with its key's label outlined at run time from the host's Segoe UI.
Nothing of the game is stored; the tests use hand-built movies.

Changes to the original:
- The key of a control comes from the bind table in force (VICTORY_BINDS:
  classic or rockstar, and the rockstar layout at drawing time) instead of
  the fixed classic table; a control without a key keeps its picture.
  Labels for Space, Shift, Ctrl and the mouse buttons.
- Switched by VICTORY_PROMPTS=keys (our runs set switches in the
  environment) instead of `--prompts keys`.
- Our KNOWN_BUILDS gets the Series 1.0.2.1 entry with the PR's offsets.

This change was made with AI assistance (Claude Code).

Co-authored-by: imjustprism <[email protected]>
In the rockstar on-foot layout E now binds the pad's A (confirm, interact),
listed before Enter so key-cap prompts read E; Enter moved from the shared
table into each layout (still A on foot and while driving). D-pad right
(GTA V's context action, E before) stays on the right arrow key; while
driving E is still the horn. Tests: gameinput (E is A on foot, D-pad right
is the right arrow), prompts (A reads E on foot, Enter while driving), pad.

This change was made with AI assistance (Claude Code).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 10:39:07 +00:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/455/head:github-bot/gh-455'
git switch 'github-bot/gh-455'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-455'
git switch 'github-bot/gh-455'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-455'
git switch 'github-bot/gh-455'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-455'
git switch 'main'
git merge --squash 'github-bot/gh-455'
git switch 'main'
git merge --ff-only 'github-bot/gh-455'
git switch 'main'
git merge 'github-bot/gh-455'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.