Mouse look, a mouse menu mode and configurable keyboard and mouse controls #652

Closed
HardR1176 wants to merge 1 commit from upstream-pr/652 into main
HardR1176 commented 2026-11-28 02:45:58 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by HardR1176 on 2026-11-28T02:45:58Z.


With VICTORY_MOUSE_CAPTURE=1 the cursor is captured, but the title only asks GameInput for a pad (kind=0x40000) and a keyboard (kind=0x10), never a mouse, so mouse movement reached nothing. This makes the captured mouse drive the pad the title already reads.

What it does

  • Play mode (default): mouse motion moves the right stick (smoothed, lifted past the title's dead zone so slow movement still turns the camera); left button = RT, right button = LT. The cursor is re-centred while mouse look is on (VICTORY_MOUSE_WARP=0 turns that off), otherwise motion stops at the window edge.
  • Menu mode: motion moves the left stick (the map cursor; no dead-zone lift, so a resting hand doesn't move the selection), left click = A, right click = B, side buttons = LB / RB, wheel = D-pad up / down (one press per notch, held ~70 ms so a frame sees it). The middle button or the pause key switches modes; MOUSE: MENU shows in the corner (the other corner when the F3 panel is up).
  • victory-controls.txt: written with the defaults at first start, beside victory-settings.txt (or VICTORY_CONTROLS_FILE). It binds keys and mouse buttons to each pad input, per mouse mode, plus the mode switch and the mouse speed. It's re-read within a second of being saved, so changes apply while playing. Lines it can't read are skipped and logged. VICTORY_MOUSE_LOOK sets the speed when the file doesn't.
  • F2: a controls page drawn like the F1 menu, listing what the file currently binds and how many lines weren't understood.

The default keyboard bindings are the existing stand-in pad table, unchanged (a test checks this). A letter in the file is the key where a US keyboard has it, the same as the stand-in pad's letters since e68f48a, so bindings sit under the same fingers on AZERTY and other layouts; LETTER_POSITIONS now covers all 26 letters for that.

Files

  • crates/victory-hle/src/modules/gameinput/bindings.rs (new): the file format, parser, defaults, F2 page text.
  • crates/victory-hle/src/modules/gameinput.rs: the mouse-to-pad translator, binding the stand-in pad through the file, reloading.
  • crates/victory-hle/src/modules/lifecycle.rs: wheel messages from the window hook; re-centring default.
  • crates/victory-gpu/src/lib.rs, crates/victory-gpu/src/host/menu.rs: shared mode / page state, F2 page, corner indicator.

Testing

  • Rebased on 8fc2254. cargo test --workspace --locked passes.
  • New unit tests for the mouse translator (both modes, wheel pulses, mode switching, rebinding), the file parser, defaults, page layout and first-start file write, and letters bound in the file counting by their place. The existing the_stand_in_pad_reads_letters_by_their_place test passes through the bindings.
  • cargo clippy -p victory-hle -p victory-gpu --no-deps --all-targets -- -D warnings is clean, with and without --all-features. cargo xtask policy --staged passes.
  • Workspace cargo clippy --all-targets -- -D warnings currently stops on lints in files this PR doesn't touch: crates/victory-shader/src/emit/mod.rs:2768 (let_and_return), crates/victory-gpu/src/shadow.rs:1708 and, with --all-features, crates/victory-gpu/src/descriptor.rs:1234 (manual_is_multiple_of).
  • Tried in game on Windows: mouse look and the controls page.

Open points

  • The speed scale and smoothing were tuned by feel; one tester ended up at speed 5.
  • A title's own pointer (if any) isn't involved: menu mode drives the pad's controls, it doesn't draw or move a cursor.

🤖 Generated with Claude Code

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5535928552 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/652). Originally posted by [HardR1176](https://github.com/HardR1176) on 2026-11-28T02:45:58Z. --- With `VICTORY_MOUSE_CAPTURE=1` the cursor is captured, but the title only asks GameInput for a pad (`kind=0x40000`) and a keyboard (`kind=0x10`), never a mouse, so mouse movement reached nothing. This makes the captured mouse drive the pad the title already reads. ### What it does - **Play mode (default):** mouse motion moves the right stick (smoothed, lifted past the title's dead zone so slow movement still turns the camera); left button = RT, right button = LT. The cursor is re-centred while mouse look is on (`VICTORY_MOUSE_WARP=0` turns that off), otherwise motion stops at the window edge. - **Menu mode:** motion moves the left stick (the map cursor; no dead-zone lift, so a resting hand doesn't move the selection), left click = A, right click = B, side buttons = LB / RB, wheel = D-pad up / down (one press per notch, held ~70 ms so a frame sees it). The middle button or the pause key switches modes; `MOUSE: MENU` shows in the corner (the other corner when the F3 panel is up). - **`victory-controls.txt`:** written with the defaults at first start, beside `victory-settings.txt` (or `VICTORY_CONTROLS_FILE`). It binds keys and mouse buttons to each pad input, per mouse mode, plus the mode switch and the mouse speed. It's re-read within a second of being saved, so changes apply while playing. Lines it can't read are skipped and logged. `VICTORY_MOUSE_LOOK` sets the speed when the file doesn't. - **F2:** a controls page drawn like the F1 menu, listing what the file currently binds and how many lines weren't understood. The default keyboard bindings are the existing stand-in pad table, unchanged (a test checks this). A letter in the file is the key where a US keyboard has it, the same as the stand-in pad's letters since e68f48a, so bindings sit under the same fingers on AZERTY and other layouts; `LETTER_POSITIONS` now covers all 26 letters for that. ### Files - `crates/victory-hle/src/modules/gameinput/bindings.rs` (new): the file format, parser, defaults, F2 page text. - `crates/victory-hle/src/modules/gameinput.rs`: the mouse-to-pad translator, binding the stand-in pad through the file, reloading. - `crates/victory-hle/src/modules/lifecycle.rs`: wheel messages from the window hook; re-centring default. - `crates/victory-gpu/src/lib.rs`, `crates/victory-gpu/src/host/menu.rs`: shared mode / page state, F2 page, corner indicator. ### Testing - Rebased on `8fc2254`. `cargo test --workspace --locked` passes. - New unit tests for the mouse translator (both modes, wheel pulses, mode switching, rebinding), the file parser, defaults, page layout and first-start file write, and letters bound in the file counting by their place. The existing `the_stand_in_pad_reads_letters_by_their_place` test passes through the bindings. - `cargo clippy -p victory-hle -p victory-gpu --no-deps --all-targets -- -D warnings` is clean, with and without `--all-features`. `cargo xtask policy --staged` passes. - Workspace `cargo clippy --all-targets -- -D warnings` currently stops on lints in files this PR doesn't touch: `crates/victory-shader/src/emit/mod.rs:2768` (`let_and_return`), `crates/victory-gpu/src/shadow.rs:1708` and, with `--all-features`, `crates/victory-gpu/src/descriptor.rs:1234` (`manual_is_multiple_of`). - Tried in game on Windows: mouse look and the controls page. ### Open points - The speed scale and smoothing were tuned by feel; one tester ended up at speed 5. - A title's own pointer (if any) isn't involved: menu mode drives the pad's controls, it doesn't draw or move a cursor. 🤖 Generated with [Claude Code](https://claude.com/claude-code)

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
trustno1-coder/VIctory-NVIDIA!652
No description provided.