Mouse and keyboard: GTA V-style layout with on-foot and vehicle layers and an F5 editor #1739

Open
github-bot wants to merge 1 commit from github-bot/gh-1739 into main AGit
Owner

@⁠wissser on GitHub · 2026-11-28 23:49 UTC · original
wissser:pc-mouse-keyboard → main · +2202 −691 · 11 files · 1 commits · open

Summary

This replaces the current mouse and keyboard support (mnk.rs + bindings.ini, F1 KEY BINDINGS) with a fuller one, laid out like GTA V on PC:

  • Separate on-foot and vehicle layers. W is move forward on foot and accelerate in a car, and mouse 1 is shoot on foot and drive-by in a car. The get-in/out key switches the layer at the same moment the game gets in or out.
  • An in-game F5 editor that shows the whole keyboard and mouse with each key's action, and lets you rebind any key while playing.
  • Mouse look based on speed, with smoothing, so slow motion still turns the camera and the camera never drifts.
  • On by default. Mouse capture and re-centring come with it, so it works without any setup.

It still goes through the stand-in pad: every key and mouse button stands for a pad control, and mouse motion becomes the right stick. The game sees a normal controller, so menus, driving, aiming and vehicle controls behave as on a pad. Real pads keep working alongside it.


Screenshots: the F5 overlay

Press F5 in game. The overlay shows each key's action on the current layer, the selected key's full meaning on both layers, and a list of every action with all its keys.

On-foot layer

F5 overlay, on-foot layer

Vehicle layer

F5 overlay, vehicle layer

The images are rendered from the overlay's own drawing code at 2× scale, using the test painted_in_every_swap_chain_format with VICTORY_KEYS_PREVIEW=<file>. The asset policy doesn't allow images in this repo, so they're hosted on my fork.


Default controls (GTA V–style)

Both layers

Key / button Pad Action
A / D Left stick ← / → Move or steer left / right
Space A Jump, climb / handbrake
Enter A Accept in menus
Left Shift LS Sprint / horn, nitrous
F, E Y Get in or out of a vehicle / interact
R X Melee
H B Rest / headlights
Backspace B Back in menus
C, Mouse 3 (middle) RS Look behind
Tab, Mouse 4 LB Weapon wheel / holster
Mouse 5 RB Cover / fire (vehicle)
V, M View Map
Esc, P Menu Pause
Z, ↓ D-pad ↓ Quick navigation / minimap
Left Alt, → D-pad → Partner menu / indicate right
↑ D-pad ↑ Phone app
← D-pad ← Radio / indicate left
Caps Lock (layer) Switch between the foot and vehicle layers by hand
Mouse motion Right stick Camera

On foot

Key / button Pad Action
W / S Left stick ↑ / ↓ Move forward / back
Left Ctrl B Crouch / rest
Q, G RB Cover / quick throw
Mouse 1 (left) RT Shoot
Mouse 2 (right) LT Aim

In a vehicle

Key / button Pad Action
W RT Accelerate
S, Mouse 2 LT Brake / reverse
Left Ctrl Left stick ↓ Pitch (aircraft)
Q X Yaw left (aircraft)
G, Mouse 1 RB Shoot from the vehicle

Switching layers: the get-in/out key (F by default, changed with K in F5) switches to the other layer as the game gets in or out. Presses less than 1.5 s apart don't switch again, so a double tap can't put the layer out of step. Caps Lock switches the layer by hand if it ever does get out of step.

Keyboard layouts: letter keys are read by their position (scan code), the same way the stand-in pad already reads its letters (e68f48a), but for all 26 letters. So WASD stays in the same place on AZERTY, QWERTZ and other layouts.


F5 editor keys

Key Does
Arrows Pick a key (up and down follow the keyboard's staggered rows)
Enter / + / − Cycle the picked key's action
Delete Clear the key
Tab Show the on-foot or vehicle layer
N New copy of the current layout
L Load the next saved layout
R Reset to the defaults
X Delete the current layout
K Make the picked key the get-in/out key
F5 Close

While the overlay is open, keys go to the editor and not to the game, the mouse's buttons and motion are held back, and the pointer is free (the same as F1, #32 and f4608f0). A small notice in the corner shows when the layer switches during play.

Saving: each change is saved at once as keyboard <name>.txt, with keyboard active.txt naming the layout in use. Files go in the shared Saves folder beside the game (VICTORY_SAVE_SHARE, set by the launcher), otherwise in %LOCALAPPDATA%\victory\keyboard. They're plain text and can be edited by hand. Lines that can't be read are skipped.

# Keyboard layout "default": <foot|drive> <key> = <control>. F5 in the game edits it.
vehicle_key = F
foot W = LUP
drive W = RT
foot MOUSE1 = RT
drive MOUSE1 = RB
...

Mouse

  • Mouse speed drives the right stick. 2000 px/s at sensitivity 1 pushes the stick fully, and the stick follows the mouse with 20 ms smoothing because the motion read at each poll is uneven.
  • The output starts at the end of the game's own dead zone (0.2), so slow motion still turns the camera. At rest it returns to exactly 0, so there's no drift.
  • The pointer is captured and moved back to the window's centre at each sample, so turning never stops at the window's edge. This doesn't happen while F1 or F5 is open, and capture is released when the window loses focus.

Settings

Variable Default F1 menu
VICTORY_KBM on (0 = off) MOUSE AND KEYBOARD (F5: KEYS)
VICTORY_KBM_SENS 1 (0 – 20) MOUSE SENSITIVITY (0.5, 0.75, 1, 1.5, 2, 3)
VICTORY_KBM_INVERT_Y off (1 = on) MOUSE INVERT Y
VICTORY_KBM_DEADZONE 0.2 (0 – 0.9) n/a
VICTORY_MOUSE_CAPTURE on with mouse and keyboard (0 / 1 force it) MOUSE CAPTURE: ON (WITH KEYBOARD) / OFF / ON
VICTORY_MOUSE_WARP on with mouse and keyboard (0 / 1 force it) n/a

With VICTORY_KBM=0, the stand-in pad goes back to its fixed key table and mouse capture is opt-in again, as before.


What's removed and why

The two systems both drive the stand-in pad, so keeping both would give two competing F1 options. This one covers everything the old one does: rebinding any key or mouse button, and sensitivity. It adds per-layer bindings, an in-game editor and GTA V defaults.

Removed Replaced by
crates/victory-hle/src/modules/mnk.rs gameinput.rs kbm() / stand_in()
bindings.ini (repo root), its launcher setup in play.rs and its asset-policy exception in xtask/src/policy.rs Layout files in Saves, written by the game
F1 MOUSE AND KEYBOARD (VICTORY_MNK) + KEY BINDINGS list (menu.rs binds) F1 MOUSE AND KEYBOARD (F5: KEYS), sensitivity and invert Y, plus the F5 editor
MNK_BINDINGS_CHANGED The layout is re-read as F5 changes it
mnk::enabled() turning XInput pads off Pads and the keyboard work together

For current VICTORY_MNK=1 users: their bindings.ini is no longer read. Mouse and keyboard comes on by default with the GTA V layout, and F5 rebinds it.

Thanks to ItsMK1 (VIctory-MnK-patches) for the original mouse and keyboard work this builds on.


Changes by file

File What
crates/victory-gpu/src/keymap.rs (new) Layout model with on-foot and vehicle layers, the GTA V defaults, key-name and pad-control tables, the text format, and saving and loading.
crates/victory-gpu/src/host/keys.rs (new) The F5 overlay: keyboard and mouse picture, editor, action list, the layer-switch notice, and painting in every swap-chain format (RGBA8, BGRA8, RGB10A2, RGBA16F).
crates/victory-gpu/src/host.rs Adds the overlay to the presenter (drawn after F1 and ticked each frame).
crates/victory-gpu/src/host/menu.rs New F1 items. Removes the KEY BINDINGS list.
crates/victory-gpu/src/lib.rs Exports keymap. Drops MNK_BINDINGS_CHANGED.
crates/victory-hle/src/modules/gameinput.rs Layout to pad (buttons, sticks, triggers), mouse look, layer switching, letters by position. Drops mnk.
crates/victory-hle/src/modules/lifecycle.rs Capture and re-centring default on with mouse and keyboard. Free pointer and arrow cursor while F1 or F5 is open.
apps/victory/src/play.rs, xtask/src/policy.rs, bindings.ini, mnk.rs Removed as above.

Testing

  • cargo clippy --workspace --all-targets: no warnings in the files this PR touches. The warnings that remain were already on main, for example in victory-shader lower.rs, send.rs, streamline.rs and resource.rs.
  • cargo test --workspace --release: all pass, 666 tests. The exception is descriptor::host::tests::views_off_their_elements_get_a_copy_of_their_bytes, which is flaky on main without this change (it passed 2 of 3 reruns here; it's GPU-dependent and in code this PR doesn't touch).
  • New tests:
    • keymap: a_layout_reads_back_as_written, the_default_is_gta_v_on_gta_vi, every_name_is_short_and_known, unknown_lines_are_passed_over
    • overlay: every_line_fits_and_every_character_has_a_picture, the_list_has_each_action_once_with_all_its_keys, every_key_lies_in_the_box_and_none_overlap, painted_in_every_swap_chain_format, the_switch_notice_fits_its_corner, keys_move_the_pick_and_change_the_layout
    • input: the_pc_layout_puts_keys_and_mouse_buttons_on_the_pad, the_pc_layout_takes_gta_v_keys_over_the_stand_in_pad, mouse_motion_turns_the_right_stick_past_the_dead_zone_and_settles, caps_lock_toggles_driving_on_the_stand_in_pad
  • Played on Windows 11 with an RTX 4070 SUPER, using mouse and keyboard and the F5 overlay, on the CHECK6960/Victory-Nvidia-optimized base where this was written. This port onto main passes the tests above but hasn't been played on main yet.

🤖 Generated with Claude Code

**@⁠wissser** on GitHub · 2026-11-28 23:49 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1739) `wissser:pc-mouse-keyboard` → `main` · +2202 −691 · 11 files · 1 commits · open ## Summary This replaces the current mouse and keyboard support (`mnk.rs` + `bindings.ini`, F1 **KEY BINDINGS**) with a fuller one, laid out like **GTA V on PC**: - **Separate on-foot and vehicle layers.** W is *move forward* on foot and *accelerate* in a car, and mouse 1 is *shoot* on foot and *drive-by* in a car. The get-in/out key switches the layer at the same moment the game gets in or out. - **An in-game F5 editor** that shows the whole keyboard and mouse with each key's action, and lets you rebind any key while playing. - **Mouse look** based on speed, with smoothing, so slow motion still turns the camera and the camera never drifts. - **On by default.** Mouse capture and re-centring come with it, so it works without any setup. It still goes through the **stand-in pad**: every key and mouse button stands for a pad control, and mouse motion becomes the right stick. The game sees a normal controller, so menus, driving, aiming and vehicle controls behave as on a pad. Real pads keep working alongside it. --- ## Screenshots: the F5 overlay Press **F5** in game. The overlay shows each key's action on the current layer, the selected key's full meaning on both layers, and a list of every action with all its keys. ### On-foot layer ![F5 overlay, on-foot layer](https://raw.githubusercontent.com/wissser/Victory-Nvidia-optimized/70f8772/docs/images/kbm-overlay-on-foot.png) ### Vehicle layer ![F5 overlay, vehicle layer](https://raw.githubusercontent.com/wissser/Victory-Nvidia-optimized/70f8772/docs/images/kbm-overlay-vehicle.png) <sub>The images are rendered from the overlay's own drawing code at 2× scale, using the test `painted_in_every_swap_chain_format` with `VICTORY_KEYS_PREVIEW=<file>`. The asset policy doesn't allow images in this repo, so they're hosted on my fork.</sub> --- ## Default controls (GTA V–style) ### Both layers | Key / button | Pad | Action | |---|---|---| | A / D | Left stick ← / → | Move or steer left / right | | Space | A | Jump, climb / handbrake | | Enter | A | Accept in menus | | Left Shift | LS | Sprint / horn, nitrous | | F, E | Y | Get in or out of a vehicle / interact | | R | X | Melee | | H | B | Rest / headlights | | Backspace | B | Back in menus | | C, Mouse 3 (middle) | RS | Look behind | | Tab, Mouse 4 | LB | Weapon wheel / holster | | Mouse 5 | RB | Cover / fire (vehicle) | | V, M | View | Map | | Esc, P | Menu | Pause | | Z, ↓ | D-pad ↓ | Quick navigation / minimap | | Left Alt, → | D-pad → | Partner menu / indicate right | | ↑ | D-pad ↑ | Phone app | | ← | D-pad ← | Radio / indicate left | | Caps Lock | (layer) | Switch between the foot and vehicle layers by hand | | Mouse motion | Right stick | Camera | ### On foot | Key / button | Pad | Action | |---|---|---| | W / S | Left stick ↑ / ↓ | Move forward / back | | Left Ctrl | B | Crouch / rest | | Q, G | RB | Cover / quick throw | | Mouse 1 (left) | RT | Shoot | | Mouse 2 (right) | LT | Aim | ### In a vehicle | Key / button | Pad | Action | |---|---|---| | W | RT | Accelerate | | S, Mouse 2 | LT | Brake / reverse | | Left Ctrl | Left stick ↓ | Pitch (aircraft) | | Q | X | Yaw left (aircraft) | | G, Mouse 1 | RB | Shoot from the vehicle | **Switching layers:** the get-in/out key (**F** by default, changed with **K** in F5) switches to the other layer as the game gets in or out. Presses less than 1.5 s apart don't switch again, so a double tap can't put the layer out of step. **Caps Lock** switches the layer by hand if it ever does get out of step. **Keyboard layouts:** letter keys are read by their **position** (scan code), the same way the stand-in pad already reads its letters (e68f48a), but for all 26 letters. So WASD stays in the same place on AZERTY, QWERTZ and other layouts. --- ## F5 editor keys | Key | Does | |---|---| | Arrows | Pick a key (up and down follow the keyboard's staggered rows) | | Enter / + / − | Cycle the picked key's action | | Delete | Clear the key | | Tab | Show the on-foot or vehicle layer | | N | New copy of the current layout | | L | Load the next saved layout | | R | Reset to the defaults | | X | Delete the current layout | | K | Make the picked key the get-in/out key | | F5 | Close | While the overlay is open, keys go to the editor and not to the game, the mouse's buttons and motion are held back, and the pointer is free (the same as F1, #32 and f4608f0). A small notice in the corner shows when the layer switches during play. **Saving:** each change is saved at once as `keyboard <name>.txt`, with `keyboard active.txt` naming the layout in use. Files go in the shared `Saves` folder beside the game (`VICTORY_SAVE_SHARE`, set by the launcher), otherwise in `%LOCALAPPDATA%\victory\keyboard`. They're plain text and can be edited by hand. Lines that can't be read are skipped. ``` # Keyboard layout "default": <foot|drive> <key> = <control>. F5 in the game edits it. vehicle_key = F foot W = LUP drive W = RT foot MOUSE1 = RT drive MOUSE1 = RB ... ``` --- ## Mouse - Mouse speed drives the right stick. **2000 px/s** at sensitivity 1 pushes the stick fully, and the stick follows the mouse with **20 ms** smoothing because the motion read at each poll is uneven. - The output starts at the end of the game's own dead zone (**0.2**), so slow motion still turns the camera. At rest it returns to exactly 0, so there's no drift. - The pointer is captured and moved back to the window's centre at each sample, so turning never stops at the window's edge. This doesn't happen while F1 or F5 is open, and capture is released when the window loses focus. ## Settings | Variable | Default | F1 menu | |---|---|---| | `VICTORY_KBM` | on (`0` = off) | **MOUSE AND KEYBOARD (F5: KEYS)** | | `VICTORY_KBM_SENS` | `1` (0 – 20) | **MOUSE SENSITIVITY** (0.5, 0.75, 1, 1.5, 2, 3) | | `VICTORY_KBM_INVERT_Y` | off (`1` = on) | **MOUSE INVERT Y** | | `VICTORY_KBM_DEADZONE` | `0.2` (0 – 0.9) | n/a | | `VICTORY_MOUSE_CAPTURE` | on with mouse and keyboard (`0` / `1` force it) | **MOUSE CAPTURE**: ON (WITH KEYBOARD) / OFF / ON | | `VICTORY_MOUSE_WARP` | on with mouse and keyboard (`0` / `1` force it) | n/a | With `VICTORY_KBM=0`, the stand-in pad goes back to its fixed key table and mouse capture is opt-in again, as before. --- ## What's removed and why The two systems both drive the stand-in pad, so keeping both would give two competing F1 options. This one covers everything the old one does: rebinding any key or mouse button, and sensitivity. It adds per-layer bindings, an in-game editor and GTA V defaults. | Removed | Replaced by | |---|---| | `crates/victory-hle/src/modules/mnk.rs` | `gameinput.rs` `kbm()` / `stand_in()` | | `bindings.ini` (repo root), its launcher setup in `play.rs` and its asset-policy exception in `xtask/src/policy.rs` | Layout files in `Saves`, written by the game | | F1 **MOUSE AND KEYBOARD** (`VICTORY_MNK`) + **KEY BINDINGS** list (`menu.rs` `binds`) | F1 **MOUSE AND KEYBOARD (F5: KEYS)**, sensitivity and invert Y, plus the F5 editor | | `MNK_BINDINGS_CHANGED` | The layout is re-read as F5 changes it | | `mnk::enabled()` turning XInput pads off | Pads and the keyboard work together | **For current `VICTORY_MNK=1` users:** their `bindings.ini` is no longer read. Mouse and keyboard comes on by default with the GTA V layout, and F5 rebinds it. Thanks to ItsMK1 (VIctory-MnK-patches) for the original mouse and keyboard work this builds on. --- ## Changes by file | File | What | |---|---| | `crates/victory-gpu/src/keymap.rs` (new) | Layout model with on-foot and vehicle layers, the GTA V defaults, key-name and pad-control tables, the text format, and saving and loading. | | `crates/victory-gpu/src/host/keys.rs` (new) | The F5 overlay: keyboard and mouse picture, editor, action list, the layer-switch notice, and painting in every swap-chain format (RGBA8, BGRA8, RGB10A2, RGBA16F). | | `crates/victory-gpu/src/host.rs` | Adds the overlay to the presenter (drawn after F1 and ticked each frame). | | `crates/victory-gpu/src/host/menu.rs` | New F1 items. Removes the KEY BINDINGS list. | | `crates/victory-gpu/src/lib.rs` | Exports `keymap`. Drops `MNK_BINDINGS_CHANGED`. | | `crates/victory-hle/src/modules/gameinput.rs` | Layout to pad (buttons, sticks, triggers), mouse look, layer switching, letters by position. Drops `mnk`. | | `crates/victory-hle/src/modules/lifecycle.rs` | Capture and re-centring default on with mouse and keyboard. Free pointer and arrow cursor while F1 or F5 is open. | | `apps/victory/src/play.rs`, `xtask/src/policy.rs`, `bindings.ini`, `mnk.rs` | Removed as above. | --- ## Testing - `cargo clippy --workspace --all-targets`: no warnings in the files this PR touches. The warnings that remain were already on `main`, for example in `victory-shader` `lower.rs`, `send.rs`, `streamline.rs` and `resource.rs`. - `cargo test --workspace --release`: all pass, 666 tests. The exception is `descriptor::host::tests::views_off_their_elements_get_a_copy_of_their_bytes`, which is flaky on `main` without this change (it passed 2 of 3 reruns here; it's GPU-dependent and in code this PR doesn't touch). - New tests: - **keymap:** `a_layout_reads_back_as_written`, `the_default_is_gta_v_on_gta_vi`, `every_name_is_short_and_known`, `unknown_lines_are_passed_over` - **overlay:** `every_line_fits_and_every_character_has_a_picture`, `the_list_has_each_action_once_with_all_its_keys`, `every_key_lies_in_the_box_and_none_overlap`, `painted_in_every_swap_chain_format`, `the_switch_notice_fits_its_corner`, `keys_move_the_pick_and_change_the_layout` - **input:** `the_pc_layout_puts_keys_and_mouse_buttons_on_the_pad`, `the_pc_layout_takes_gta_v_keys_over_the_stand_in_pad`, `mouse_motion_turns_the_right_stick_past_the_dead_zone_and_settles`, `caps_lock_toggles_driving_on_the_stand_in_pad` - Played on Windows 11 with an RTX 4070 SUPER, using mouse and keyboard and the F5 overlay, on the CHECK6960/Victory-Nvidia-optimized base where this was written. This port onto `main` passes the tests above but hasn't been played on `main` yet. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Replaces the bindings.ini mouse and keyboard (mnk.rs, F1 KEY BINDINGS) with a
layout-based one on the stand-in pad (VICTORY_KBM, on unless 0):

- Keys and mouse buttons map to pad controls through an editable layout with
  separate on-foot and vehicle layers; the get-in/out key (F) switches the
  layer, Caps Lock switches it by hand. GTA V PC defaults.
- Mouse motion drives the right stick: speed-based, smoothed, starting past the
  game's dead zone; VICTORY_KBM_SENS, VICTORY_KBM_INVERT_Y, VICTORY_KBM_DEADZONE.
- F5 overlay: the keyboard and mouse with each key's action, editable in game
  (arrows, Enter/+/-, Delete, Tab, N/L/R/X/K); layouts saved as text in Saves.
- Letter keys are read by position, so WASD stays WASD on AZERTY and others.
- Mouse capture and re-centring default to on with it; the pointer is free
  while F1 or F5 is open, as before. Real pads keep working alongside.
- F1: MOUSE AND KEYBOARD (F5: KEYS), MOUSE SENSITIVITY, MOUSE INVERT Y.

Removed: mnk.rs, bindings.ini and its launcher/asset-policy entries, F1's KEY
BINDINGS list, MNK_BINDINGS_CHANGED.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 23:53:00 +00:00
This pull request has changes conflicting with the target branch.
  • apps/victory/src/play.rs
  • bindings.ini
  • crates/victory-gpu/src/host.rs
  • crates/victory-gpu/src/host/menu.rs
  • crates/victory-gpu/src/lib.rs
  • crates/victory-hle/src/modules/gameinput.rs
  • crates/victory-hle/src/modules/lifecycle.rs
  • crates/victory-hle/src/modules/mnk.rs
  • xtask/src/policy.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1739'
git switch 'github-bot/gh-1739'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1739'
git switch 'github-bot/gh-1739'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1739'
git switch 'main'
git merge --squash 'github-bot/gh-1739'
git switch 'main'
git merge --ff-only 'github-bot/gh-1739'
git switch 'main'
git merge 'github-bot/gh-1739'
git push origin 'main'
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/trustno1-coder--VIctory-NVIDIA!1739
No description provided.