Keyboard and mouse: one mouse sample per game frame, optional auto-start (builds on #9) #260

Closed
github-bot wants to merge 2 commits from github-bot/gh-260 into main AGit
Owner

@⁠Noronus on GitHub · 2026-12-02 21:56 UTC · original
Noronus:mnk-frame-sampling → main · +1104 −6 · 5 files · 2 commits · closed without merging

This builds on #9 by @⁠PhialsBasement. The first commit is that PR's, cherry-picked unchanged with its author. The second is mine. If #9 is merged first I can rebase to just the second commit, or it can be taken into #9 instead.

What the second commit changes

  • One sample per game frame. The stick showed the mouse's mean rate over a sliding window, refreshed by the 2 ms poll. When frame times jitter, counts can be seen twice or not at all. Now each GetCurrentReading of a new frame takes the counts since the previous one, and converts them with the camera's own dt. The stick is let go if the title stops reading for 120 ms.
  • Look scale only while the bridge has control. It was raised all the time, which also sped up the native mouse mode.
  • VICTORY_MNK_START=1 (off by default) takes control by itself, once, when the title is in the world. The 0 key still gives it back.
  • README and the unit test follow. The default VICTORY_MNK_SPEED is unchanged.

Tested

  • Played under Proton on a Wayland desktop at roughly 35 to 48 fps, based on e2ba62e. The logged time between the title's reads matched the camera's dt (for example 24.57 ms and 24.57 ms). The stutter noticed with #9 before was no longer reported, and the aim was preferred over the native mode.
  • This branch on current main type-checks, and the two look-model tests pass when run on their own.

Not tested

  • This exact branch has not been played. The session above also had temporary logging, and VICTORY_MNK_START was added after it.
  • In one session the camera did not move with the mouse, in this mode or the native one, although raw input arrived and the title read the pad at the right rate. It also happened once before #9 was applied. The cause is not known and this PR does not address it.

🤖 Generated with Claude Code

**@⁠Noronus** on GitHub · 2026-12-02 21:56 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/260) `Noronus:mnk-frame-sampling` → `main` · +1104 −6 · 5 files · 2 commits · closed without merging This builds on #9 by @⁠PhialsBasement. The first commit is that PR's, cherry-picked unchanged with its author. The second is mine. If #9 is merged first I can rebase to just the second commit, or it can be taken into #9 instead. **What the second commit changes** - **One sample per game frame.** The stick showed the mouse's mean rate over a sliding window, refreshed by the 2 ms poll. When frame times jitter, counts can be seen twice or not at all. Now each `GetCurrentReading` of a new frame takes the counts since the previous one, and converts them with the camera's own `dt`. The stick is let go if the title stops reading for 120 ms. - **Look scale only while the bridge has control.** It was raised all the time, which also sped up the native mouse mode. - **`VICTORY_MNK_START=1`** (off by default) takes control by itself, once, when the title is in the world. The 0 key still gives it back. - README and the unit test follow. The default `VICTORY_MNK_SPEED` is unchanged. **Tested** - Played under Proton on a Wayland desktop at roughly 35 to 48 fps, based on e2ba62e. The logged time between the title's reads matched the camera's `dt` (for example 24.57 ms and 24.57 ms). The stutter noticed with #9 before was no longer reported, and the aim was preferred over the native mode. - This branch on current main type-checks, and the two look-model tests pass when run on their own. **Not tested** - This exact branch has not been played. The session above also had temporary logging, and `VICTORY_MNK_START` was added after it. - In one session the camera did not move with the mouse, in this mode or the native one, although raw input arrived and the title read the pad at the right rate. It also happened once before #9 was applied. The cause is not known and this PR does not address it. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A port of gta6-mnk-mod (mouse-pad) into the gameinput module, beside the
native and PC-controls modes:

* the keyboard drives the title pad by GTA V PC defaults, with a vehicle
  layout chosen from the title input actions (VEH_ACCELERATE,
  MOVE_UP_ONLY, read from the action table);
* raw mouse turns the camera through the right stick: the stick shows
  the mouse mean rate over the last game frame (the camera dt),
  inverted through the game look curve;
* the 0 key takes control (cursor hidden and clipped, keyboard device
  quiet) and gives it back; Ctrl+Alt+Backspace always releases. While
  it has control its pad is the stand-in, ahead of the native mode, and
  current_reading leaves the mouse frame sample out; given back, the
  other modes are as before. WM_INPUT reaches it before mouse.rs takes
  the message;
* after 10 s of play: the look actions scale goes to 3, and the look
  speed slew and axis snapping are off, through the one call of
  CamParam_LookSpeed_Update (0x140A050A0, from 0x140E4E799), on the
  title thread. Every site is checked before it is written.

run.sh turns it on for play (VICTORY_MNK=0 in run.conf or on the
command line turns it off). README: how to use it, the in-game settings
it needs, and its keys.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 2758bc2f99)
The stick showed the mouse's mean rate over a sliding window, refreshed by
the 2 ms poll. When frames jitter, counts are then seen twice or not at all.
Now each GetCurrentReading of a new frame takes the counts since the last one.

The look scale is raised only while the bridge has control, so it no longer
speeds up the native mode. VICTORY_MNK_START=1 takes control by itself once
the title is in the world; off by default.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 22:00:43 +00:00
github-bot closed this pull request 2026-12-02 22:06:06 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.