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

Closed
github-bot wants to merge 1 commit from github-bot/gh-652 into main AGit
Owner

@⁠HardR1176 on GitHub · 2026-11-28 02:45 UTC · original
mouse-look-and-controls → main · +1138 −52 · 5 files · 1 commits · closed without merging

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

**@⁠HardR1176** on GitHub · 2026-11-28 02:45 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/652) `mouse-look-and-controls` → `main` · +1138 −52 · 5 files · 1 commits · closed without merging 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)
The title asks GameInput for a pad and a keyboard only, never a mouse, so
with VICTORY_MOUSE_CAPTURE the captured mouse reached nothing. The captured
mouse now drives the pad the title reads:

- Play mode: motion moves the right stick (smoothed, lifted past the
  title's dead zone), the left and right buttons the triggers. The cursor
  is re-centred by default while mouse look is on (VICTORY_MOUSE_WARP=0
  turns that off), so motion does not stop at the window's edge.
- Menu mode: motion moves the left stick (the map's cursor, no dead-zone
  lift so a resting hand does not move the selection), left click A,
  right click B, the side buttons LB and RB, the wheel the D-pad's up and
  down (one press per notch, held long enough for a frame to see it).
  The middle button and the pause key switch modes; "MOUSE: MENU" shows
  in the corner while it is on.
- victory-controls.txt, beside victory-settings.txt and written with the
  defaults at the first start, binds keys and mouse buttons to the pad's
  inputs per mode, the mode switch and the mouse's speed. It is read
  again within a second of being saved. VICTORY_MOUSE_LOOK sets the speed
  when the file does not.
- F2 shows the controls as the file sets them, and how many of its lines
  were not understood (each is logged).

The defaults keep the stand-in pad's keyboard table as it was.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 02:48:24 +00:00
github-bot force-pushed github-bot/gh-652 from e48b22b440 to d8e4f3eae4 2026-11-28 03:01:04 +00:00 Compare
github-bot closed this pull request 2026-11-30 23:48:15 +00:00

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