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

Open
Jesper-Andersson wants to merge 5 commits from upstream-pr/455 into main
Jesper-Andersson commented 2026-11-27 10:34:28 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by Jesper-Andersson on 2026-11-27T10:34:28Z.


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

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:issue:5525151126 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/455). Originally posted by [Jesper-Andersson](https://github.com/Jesper-Andersson) on 2026-11-27T10:34:28Z. --- 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).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/455:upstream-pr/455'
git switch 'upstream-pr/455'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/455'
git switch 'upstream-pr/455'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/455'
git switch 'upstream-pr/455'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/455'
git switch 'main'
git merge --squash 'upstream-pr/455'
git switch 'main'
git merge --ff-only 'upstream-pr/455'
git switch 'main'
git merge 'upstream-pr/455'
git push origin 'main'
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
avatarmanz/VIctory-7900XTX!455
No description provided.