Input: the camera follows the mouse (GTA V PC keys and mouse on the stand-in pad, VICTORY_KBM_GTA=1) #989

Open
urielbeaupre wants to merge 2 commits from upstream-pr/989 into main
urielbeaupre commented 2026-11-28 10:43:57 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by urielbeaupre on 2026-11-28T10:43:57Z.


Makes the camera follow the mouse on PCs where it doesn't (#489, and earlier #198, #375, #396). The new switch is VICTORY_KBM_GTA=1, off by default, and it can also be turned on in the F1 menu ("GTA V KEYS AND MOUSE"). It uses a GTA V PC-style keyboard and mouse layout.

Why the existing mouse device isn't enough

The GameInput mouse from #9 reaches the game only if the game registers for mouse devices. On this PC (RTX 4070 Ti, Windows 11, Series S, 63b902f) it never does. The log shows device callbacks only for kinds 0x10 (keyboard) and 0x40000 (gamepad), never 0x20. So the device is never announced and the camera doesn't turn. That is the same report as #489.

This PR feeds the mouse into the right stick of the keyboard stand-in pad instead. The game always reads that stick.

What it does

  • Camera: mouse movement deflects the right stick by 0.022 per pixel, times VICTORY_MOUSE_SENS. The stick returns to centre with a 45 ms half-life once the mouse stops. VICTORY_MOUSE_INVERT_Y=1 flips the vertical axis.
  • Focus: input counts only while the game window has focus. A button already held when the game takes the mouse is ignored until pressed again.
  • Mouse buttons: left = RT (fire), right = LT (aim), middle = R3.
  • Keys:
    • WASD to move.
    • Shift = A, Space or X = X, R or Backspace = B, Enter = A, F = Y.
    • Tab = LB, Q = RB, Ctrl = L3, C, Caps Lock or H = R3.
    • E or →, M or ↑, Z or ↓, G or ← = the D-pad.
    • V = View, Esc or P = Menu.
    • IJKL still turns the camera. Z and C are no longer the triggers in this layout.
  • Capture: the existing capture (VICTORY_MOUSE_CAPTURE) and warp (VICTORY_MOUSE_WARP=0 turns the warp off) are used for the lock.
    • F2 (or `) releases and re-takes the mouse. Released, the cursor is free and visible, and the camera ignores it.
    • Losing focus releases it, and it is taken back only by F2 or a left click inside the client area. A click on the title bar or border never takes it, and the click that does take it doesn't fire.
    • While the F1 menu is open, F2 does nothing.
  • Double turning: the GameInput mouse device is offered only with an explicit VICTORY_MOUSE_CAPTURE=1, so a game that does read it won't turn the camera twice.

It is ported from the GTA V PC-style mapping in Belobug's VIctory (PR 295 there) and adapted to this fork:

  • the stand-in pad and its position-based letter keys (R, P, G, V and M added to LETTER_POSITIONS);
  • the existing capture code;
  • switches that are on only for =1.

Tested

In play on an RTX 4070 Ti, Series S, with WoW running alongside on the other screen:

  • the camera follows the mouse, and the speed felt right at the default sensitivity;
  • F2 releases the mouse so the window can be moved;
  • a click in the picture takes it back, and the camera works again.

cargo test -p victory-hle: 195 passed, 0 failed, including the ported and new tests:

  • mapping;
  • stick decay;
  • the first-frame delta;
  • the held-button guard;
  • the lock toggle sequence.

The menu tests pass. The release and diagnostics builds build, and clippy reports no new warnings.

Not covered / limits

  • One PC. The sensitivity and decay values are the source fork's; other mice and DPI settings may want VICTORY_MOUSE_SENS.
  • With a real controller connected on the default single-pad setup, the mouse still moves the right stick.
  • Without a mouse, this layout has no keyboard triggers (Z/C are reassigned).
  • If the window loses focus during startup, the mouse starts released and needs one click inside the window.
  • The mouse wheel is not mapped.

🤖 Generated with Claude Code

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5539297939 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/989). Originally posted by [urielbeaupre](https://github.com/urielbeaupre) on 2026-11-28T10:43:57Z. --- Makes the camera follow the mouse on PCs where it doesn't (#489, and earlier #198, #375, #396). The new switch is `VICTORY_KBM_GTA=1`, off by default, and it can also be turned on in the F1 menu ("GTA V KEYS AND MOUSE"). It uses a GTA V PC-style keyboard and mouse layout. ## Why the existing mouse device isn't enough The GameInput mouse from #9 reaches the game only if the game registers for mouse devices. On this PC (RTX 4070 Ti, Windows 11, Series S, `63b902f`) it never does. The log shows device callbacks only for kinds `0x10` (keyboard) and `0x40000` (gamepad), never `0x20`. So the device is never announced and the camera doesn't turn. That is the same report as #489. This PR feeds the mouse into the **right stick of the keyboard stand-in pad** instead. The game always reads that stick. ## What it does - **Camera:** mouse movement deflects the right stick by 0.022 per pixel, times `VICTORY_MOUSE_SENS`. The stick returns to centre with a 45 ms half-life once the mouse stops. `VICTORY_MOUSE_INVERT_Y=1` flips the vertical axis. - **Focus:** input counts only while the game window has focus. A button already held when the game takes the mouse is ignored until pressed again. - **Mouse buttons:** left = RT (fire), right = LT (aim), middle = R3. - **Keys:** - WASD to move. - Shift = A, Space or X = X, R or Backspace = B, Enter = A, F = Y. - Tab = LB, Q = RB, Ctrl = L3, C, Caps Lock or H = R3. - E or →, M or ↑, Z or ↓, G or ← = the D-pad. - V = View, Esc or P = Menu. - IJKL still turns the camera. Z and C are no longer the triggers in this layout. - **Capture:** the existing capture (`VICTORY_MOUSE_CAPTURE`) and warp (`VICTORY_MOUSE_WARP=0` turns the warp off) are used for the lock. - **F2** (or `` ` ``) releases and re-takes the mouse. Released, the cursor is free and visible, and the camera ignores it. - Losing focus releases it, and it is taken back only by F2 or a left click inside the client area. A click on the title bar or border never takes it, and the click that does take it doesn't fire. - While the F1 menu is open, F2 does nothing. - **Double turning:** the GameInput mouse device is offered only with an explicit `VICTORY_MOUSE_CAPTURE=1`, so a game that does read it won't turn the camera twice. It is ported from the GTA V PC-style mapping in Belobug's VIctory (PR 295 there) and adapted to this fork: - the stand-in pad and its position-based letter keys (R, P, G, V and M added to `LETTER_POSITIONS`); - the existing capture code; - switches that are on only for `=1`. ## Tested In play on an RTX 4070 Ti, Series S, with WoW running alongside on the other screen: - the camera follows the mouse, and the speed felt right at the default sensitivity; - F2 releases the mouse so the window can be moved; - a click in the picture takes it back, and the camera works again. `cargo test -p victory-hle`: 195 passed, 0 failed, including the ported and new tests: - mapping; - stick decay; - the first-frame delta; - the held-button guard; - the lock toggle sequence. The menu tests pass. The release and diagnostics builds build, and clippy reports no new warnings. ## Not covered / limits - One PC. The sensitivity and decay values are the source fork's; other mice and DPI settings may want `VICTORY_MOUSE_SENS`. - With a real controller connected on the default single-pad setup, the mouse still moves the right stick. - Without a mouse, this layout has no keyboard triggers (Z/C are reassigned). - If the window loses focus during startup, the mouse starts released and needs one click inside the window. - The mouse wheel is not mapped. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Kucharskov commented 2026-11-28 11:35:27 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Kucharskov on 2026-11-28T11:35:27Z.


I can confirm that playing with this GTA V mapping is a lot better than default mapping

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7238652440 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/989#issuecomment-7238652440). Originally posted by [Kucharskov](https://github.com/Kucharskov) on 2026-11-28T11:35:27Z. --- I can confirm that playing with this GTA V mapping is a lot better than default mapping
isaac-btw commented 2026-11-28 12:19:14 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by isaac-btw on 2026-11-28T12:19:14Z.


Confirmed!

Also my PR https://github.com/trustno1-coder/VIctory-NVIDIA/pull/967

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7239144945 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/989#issuecomment-7239144945). Originally posted by [isaac-btw](https://github.com/isaac-btw) on 2026-11-28T12:19:14Z. --- Confirmed! Also my PR https://github.com/trustno1-coder/VIctory-NVIDIA/pull/967
0z0sk0 commented 2026-11-28 21:41:32 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by 0z0sk0 on 2026-11-28T21:41:32Z.


@trustno1-code very useful

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7246201769 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/989#issuecomment-7246201769). Originally posted by [0z0sk0](https://github.com/0z0sk0) on 2026-11-28T21:41:32Z. --- @trustno1-code very useful
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/989:upstream-pr/989'
git switch 'upstream-pr/989'

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/989'
git switch 'upstream-pr/989'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/989'
git switch 'upstream-pr/989'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/989'
git switch 'main'
git merge --squash 'upstream-pr/989'
git switch 'main'
git merge --ff-only 'upstream-pr/989'
git switch 'main'
git merge 'upstream-pr/989'
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
trustno1-coder/VIctory-NVIDIA!989
No description provided.