Keyboard and mouse: gta6-mnk-mod in process (the 0 key) #9

Open
github-bot wants to merge 1 commit from github-bot/gh-9 into main AGit
Owner

@⁠PhialsBasement on GitHub · 2026-11-29 16:25 UTC · original
PhialsBasement:keyboard-mouse → main · +1074 −5 · 5 files · 1 commits · open

Rebased on 109cdb5, beside the native and VICTORY_PC_CONTROLS modes. While this bridge has control (the 0 key), its pad is the stand-in ahead of those modes, the keyboard device is quiet, and current_reading leaves the mouse frame sample out. Given back, the other modes are as before. Key 0 is free in native-keys.default.txt. The difference from PC controls: this one patches the game's camera (look scale, slew and axis snap off) and inverts its look curve, so the camera behaves like a mouse camera, not a faster stick.

A port of gta6-mnk-mod (the PS5 Remote Play mouse-and-keyboard bridge) into gameinput, so the Xbox build plays with keyboard and mouse natively. The README gets a "Keyboard and mouse" section: how to turn it on, the in-game settings it needs, and the keys.

What it does

  • Keyboard → the title's pad, by GTA V's PC defaults where GTA VI has the same action. A vehicle layout (W/S throttle and brake, left click RB, ...) switches in by itself: the bridge reads INPUT_VEH_ACCELERATE and INPUT_MOVE_UP_ONLY from the title's action table, as the mod read them on the PS5.

  • Mouse → camera through the right stick. The stick always shows the mouse's mean rate over the last game frame (the camera's own dt, read from memory), inverted through the game's stick-to-turn-rate curve, so the camera turns exactly as far as the mouse. Aiming uses the aim curve.

  • Raw mouse under Wine: raw input is registered for the title's window with no target and no flags. Under Wine an input sink gets nothing; this follows focus. WM_INPUT is taken in the layer's window procedure.

  • The 0 key takes control (cursor hidden and clipped to the window; the keyboard device shows no keys, so nothing gets double input) and gives it back. Ctrl+Alt+Backspace always releases. F10, the mod's key, is the menu key and needed two presses under Wine.

  • Camera patches after 10 s of play, as the mod applies them:

    • the look actions' scale goes to 3 (VICTORY_MNK_LOOK_SCALE);
    • look speed slew off: each look-speed param's accel/decel pointers go to a 1000.0 constant;
    • axis snap off: the enable byte is found next to the active MaxSpeeds contributor by its data (1, 20.0, 10.0).

    These go through the one call of CamParam_LookSpeed_Update (0x140A050A0, called directly from 0x140E4E799, never through the vtable), redirected to a stub and run on the title's thread. The param layout matches the PS5 build's.

Safety: every patch site is checked before it is written (the call's bytes, action ids by hash, the look param's id 58, the snap byte's neighbours), and left alone on anything unexpected, with a log line saying why. VICTORY_MNK=0 turns it all off; run.sh play turns it on.

Tested on Wine 11.21, RX 9070 XT, Ryzen 7 5800X3D, Series X profile: played on foot and in vehicles with the camera patches applied (the log confirms each one). The look model and the frame-mean sender have unit tests (cargo test -p victory-hle mnk).

AI-assisted (Claude Code).

🤖 Generated with Claude Code

**@⁠PhialsBasement** on GitHub · 2026-11-29 16:25 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/9) `PhialsBasement:keyboard-mouse` → `main` · +1074 −5 · 5 files · 1 commits · open **Rebased on 109cdb5**, beside the native and `VICTORY_PC_CONTROLS` modes. While this bridge has control (the 0 key), its pad is the stand-in ahead of those modes, the keyboard device is quiet, and `current_reading` leaves the mouse frame sample out. Given back, the other modes are as before. Key 0 is free in `native-keys.default.txt`. The difference from PC controls: this one patches the game's camera (look scale, slew and axis snap off) and inverts its look curve, so the camera behaves like a mouse camera, not a faster stick. A port of [gta6-mnk-mod](https://github.com/PhialsBasement/gta6-mnk-mod) (the PS5 Remote Play mouse-and-keyboard bridge) into `gameinput`, so the Xbox build plays with keyboard and mouse natively. The README gets a "Keyboard and mouse" section: how to turn it on, the in-game settings it needs, and the keys. **What it does** - **Keyboard → the title's pad**, by GTA V's PC defaults where GTA VI has the same action. A vehicle layout (W/S throttle and brake, left click RB, ...) switches in by itself: the bridge reads `INPUT_VEH_ACCELERATE` and `INPUT_MOVE_UP_ONLY` from the title's action table, as the mod read them on the PS5. - **Mouse → camera** through the right stick. The stick always shows the mouse's mean rate over the last game frame (the camera's own `dt`, read from memory), inverted through the game's stick-to-turn-rate curve, so the camera turns exactly as far as the mouse. Aiming uses the aim curve. - **Raw mouse under Wine:** raw input is registered for the title's window with no target and no flags. Under Wine an input sink gets nothing; this follows focus. `WM_INPUT` is taken in the layer's window procedure. - **The 0 key** takes control (cursor hidden and clipped to the window; the keyboard device shows no keys, so nothing gets double input) and gives it back. Ctrl+Alt+Backspace always releases. F10, the mod's key, is the menu key and needed two presses under Wine. - **Camera patches** after 10 s of play, as the mod applies them: - the look actions' scale goes to 3 (`VICTORY_MNK_LOOK_SCALE`); - look speed slew off: each look-speed param's accel/decel pointers go to a 1000.0 constant; - axis snap off: the enable byte is found next to the active MaxSpeeds contributor by its data (1, 20.0, 10.0). These go through the one call of `CamParam_LookSpeed_Update` (`0x140A050A0`, called directly from `0x140E4E799`, never through the vtable), redirected to a stub and run on the title's thread. The param layout matches the PS5 build's. **Safety:** every patch site is checked before it is written (the call's bytes, action ids by hash, the look param's id 58, the snap byte's neighbours), and left alone on anything unexpected, with a log line saying why. `VICTORY_MNK=0` turns it all off; `run.sh play` turns it on. **Tested** on Wine 11.21, RX 9070 XT, Ryzen 7 5800X3D, Series X profile: played on foot and in vehicles with the camera patches applied (the log confirms each one). The look model and the frame-mean sender have unit tests (`cargo test -p victory-hle mnk`). AI-assisted (Claude Code). 🤖 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]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 07:41:04 +00:00
Author
Owner

@⁠Luxuride on GitHub · 2026-12-04 12:00 UTC · original

This is the real feature in this batch — a working in-process M&K path is worth more to users than the micro-optimisations around it. Worth after a rebase, with three things fixed first.

  1. run.sh:37-38 exports VICTORY_MNK=1 for every play run. That ships a hardcoded-offset in-process code patcher enabled by default, including on builds where the offsets do not match. Default it to 0 and let run.conf opt in.
  2. Only the code hook is validated: crates/victory-hle/src/modules/gameinput/mnk.rs:226 UPDATE_CALL = 0xe4_e799 is byte-checked, but :202 ACTION_COUNT = 0xab7_7bd4, :203 ACTION_ARRAY = 0xab7_7bd8 and :216 CAMERA_DT = 0xabb_ef4c are read raw. On another build or region that reads garbage for "in vehicle" / "menu open" / look scale and remaps the pad mid-game instead of failing loudly. Validate them like the hook, or gate on an image hash.
  3. VICTORY_MNK, VICTORY_MNK_SPEED, VICTORY_MNK_LOOK_SCALE, VICTORY_MNK_INVERT_Y are documented only in the README section. Add them to run.conf.default (and docs/SETTINGS.md) so the menu can show them — as run.conf.default:2-3 says, a switch that is not there is invisible in F1.

Credit for the tests in mnk.rs:921; what is missing is one measurable claim (aim deviation, frame cost), not correctness.

Conflicts are limited to run.sh, so the rebase itself should be cheap.

**@⁠Luxuride** on GitHub · 2026-12-04 12:00 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/9#issuecomment-7410835002) This is the real feature in this batch — a working in-process M&K path is worth more to users than the micro-optimisations around it. **Worth after a rebase**, with three things fixed first. 1. `run.sh:37-38` exports `VICTORY_MNK=1` for every play run. That ships a hardcoded-offset in-process code patcher enabled by default, including on builds where the offsets do not match. Default it to 0 and let `run.conf` opt in. 2. Only the code hook is validated: `crates/victory-hle/src/modules/gameinput/mnk.rs:226` `UPDATE_CALL = 0xe4_e799` is byte-checked, but `:202` `ACTION_COUNT = 0xab7_7bd4`, `:203` `ACTION_ARRAY = 0xab7_7bd8` and `:216` `CAMERA_DT = 0xabb_ef4c` are read raw. On another build or region that reads garbage for "in vehicle" / "menu open" / look scale and remaps the pad mid-game instead of failing loudly. Validate them like the hook, or gate on an image hash. 3. `VICTORY_MNK`, `VICTORY_MNK_SPEED`, `VICTORY_MNK_LOOK_SCALE`, `VICTORY_MNK_INVERT_Y` are documented only in the README section. Add them to `run.conf.default` (and `docs/SETTINGS.md`) so the menu can show them — as `run.conf.default:2-3` says, a switch that is not there is invisible in F1. Credit for the tests in `mnk.rs:921`; what is missing is one measurable claim (aim deviation, frame cost), not correctness. Conflicts are limited to `run.sh`, so the rebase itself should be cheap.
This pull request has changes conflicting with the target branch.
  • crates/victory-hle/src/modules/gameinput.rs
  • run.sh
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/9/head:github-bot/gh-9'
git switch 'github-bot/gh-9'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-9'
git switch 'github-bot/gh-9'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-9'
git switch 'github-bot/gh-9'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-9'
git switch 'main'
git merge --squash 'github-bot/gh-9'
git switch 'main'
git merge --ff-only 'github-bot/gh-9'
git switch 'main'
git merge 'github-bot/gh-9'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.