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

Open
github-bot wants to merge 2 commits from github-bot/gh-989 into main AGit
Owner

@⁠urielbeaupre on GitHub · 2026-11-28 10:43 UTC · original
urielbeaupre:feat/mouse-camera → main · +526 −18 · 4 files · 2 commits · open

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

**@⁠urielbeaupre** on GitHub · 2026-11-28 10:43 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/989) `urielbeaupre:feat/mouse-camera` → `main` · +526 −18 · 4 files · 2 commits · open 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)
On some PCs the title registers device callbacks for keyboards (0x10) and
gamepads (0x40000) only, never mice (0x20), so the mouse device never reaches
it and the camera does not follow the mouse. With VICTORY_KBM_GTA=1 the mouse
reaches it as the stand-in pad instead: captured motion (lifecycle's
VICTORY_MOUSE_CAPTURE path, warping by default) turns the right stick, with
a 45 ms half-life back to centre; LMB = RT, RMB = LT, MMB = R3. Keys follow
GTA V's PC layout (GTA_BUTTONS), by place as the default table; I/J/K/L
still turn the camera. Only while the window is in front, the F1 menu is
closed and the stand-in is the title's pad. Off by default; F1 row added.

Ported from VIctory's c485827 (PR #295), on this fork's capture.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With VICTORY_KBM_GTA=1 the cursor was clipped and warped whenever the game was
in front, so the window could not be moved nor its title bar reached. The
capture now holds the mouse only while locked: locked from the start (the log
says F2 releases the mouse), F2 or ` / ~ toggles it, losing the front unlocks
it, and only F2 or a left click in the client area locks it again (title bar
and border clicks are non-client messages and never lock). Unlocked: no clip,
no warp, the cursor shown, no motion on the right stick.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 14:31:20 +00:00
Author
Owner

@⁠Kucharskov on GitHub · 2026-11-28 11:35 UTC · original

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

**@⁠Kucharskov** on GitHub · 2026-11-28 11:35 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/989#issuecomment-7238652440) I can confirm that playing with this GTA V mapping is a lot better than default mapping
Author
Owner

@⁠isaac-btw on GitHub · 2026-11-28 12:19 UTC · original

Confirmed!

Also my PR #967

**@⁠isaac-btw** on GitHub · 2026-11-28 12:19 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/989#issuecomment-7239144945) Confirmed! Also my PR https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/pulls/967
Author
Owner

@⁠0z0sk0 on GitHub · 2026-11-28 21:41 UTC · original

@⁠trustno1-code very useful

**@⁠0z0sk0** on GitHub · 2026-11-28 21:41 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/989#issuecomment-7246201769) @⁠trustno1-code very useful
This pull request has changes conflicting with the target branch.
  • README.md
  • crates/victory-gpu/src/host/menu.rs
  • crates/victory-hle/src/modules/gameinput.rs
  • crates/victory-hle/src/modules/lifecycle.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/989/head:github-bot/gh-989'
git switch 'github-bot/gh-989'

Merge

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