Direct 1:1 mouse camera (opt-in, LARP_MOUSE_CAMERA=direct), ported from Darner #46

Manually merged
github merged 1 commit from github-bot/gh-46 into main 2026-12-05 19:00:57 +00:00 AGit
Owner

@⁠IndianStalker on GitHub · 2026-12-05 16:21 UTC · original
IndianStalker:direct-mouse-camera → main · +705 −1 · 6 files · 1 commits · merged 2026-12-05 19:00 UTC

What it does

Adds an optional direct mouse camera. With LARP_MOUSE_CAMERA=direct (and mouse and keyboard on), the mouse turns the game's look camera directly instead of moving the right stick: no stick, no dead zone, no smoothing, no acceleration. Aiming and scopes slow it with the game's own zoom scale.

Off by default. Without the switch nothing changes: the mouse keeps going to the right stick as today.

How

  • crates/larp-hle/src/mousehook.rs (new): hooks look_pull (0x140e4e3d0, build 1.0.2.1 only; the prologue is checked first, otherwise nothing is hooked) and adds the raw mouse counts × sensitivity × zoom to the camera's heading and pitch.
  • crates/larp-loader/src/callhook.rs (new): the entry/return hook helper it uses.
  • gameinput/mouse.rs: Raw Input motion also feeds the camera; while the camera is live, the stick gets 0 from the mouse.
  • apps/larp/src/run.rs: installs the hook before the title runs.

Falls back to the stick automatically

  • In menus and on the map (the game hasn't asked for the camera for 100 ms).
  • While the weapon / radio wheel is open (the mouse picks the sector as before).

Settings

  • LARP_MOUSE_CAMERA=direct: turns it on.
  • controls.ini sensitivity and invert_y apply to both modes.
  • LARP_MOUSE_CAMERA_SENS: radians per mouse count (default 0.0015, Darner's).

Credit

The look hook, the radial wheel check and callhook.rs are from Darner (TrustNo1, GPL-3.0). This is a port onto larp's existing mouse and keyboard code.

Tested

Builds on main (b39145e) with no new warnings. Now being played on an RTX 4070 Ti (Series X, mouse and keyboard); I'll add the results here.

🤖 Generated with Claude Code

**@⁠IndianStalker** on GitHub · 2026-12-05 16:21 UTC · [original](https://github.com/gamingwithhomie/larp/pull/46) `IndianStalker:direct-mouse-camera` → `main` · +705 −1 · 6 files · 1 commits · merged 2026-12-05 19:00 UTC ## What it does Adds an optional direct mouse camera. With `LARP_MOUSE_CAMERA=direct` (and mouse and keyboard on), the mouse turns the game's look camera directly instead of moving the right stick: no stick, no dead zone, no smoothing, no acceleration. Aiming and scopes slow it with the game's own zoom scale. **Off by default.** Without the switch nothing changes: the mouse keeps going to the right stick as today. ## How - `crates/larp-hle/src/mousehook.rs` (new): hooks `look_pull` (`0x140e4e3d0`, build 1.0.2.1 only; the prologue is checked first, otherwise nothing is hooked) and adds the raw mouse counts × sensitivity × zoom to the camera's heading and pitch. - `crates/larp-loader/src/callhook.rs` (new): the entry/return hook helper it uses. - `gameinput/mouse.rs`: Raw Input motion also feeds the camera; while the camera is live, the stick gets 0 from the mouse. - `apps/larp/src/run.rs`: installs the hook before the title runs. ## Falls back to the stick automatically - In menus and on the map (the game hasn't asked for the camera for 100 ms). - While the weapon / radio wheel is open (the mouse picks the sector as before). ## Settings - `LARP_MOUSE_CAMERA=direct`: turns it on. - `controls.ini` `sensitivity` and `invert_y` apply to both modes. - `LARP_MOUSE_CAMERA_SENS`: radians per mouse count (default `0.0015`, Darner's). ## Credit The look hook, the radial wheel check and `callhook.rs` are from Darner (TrustNo1, GPL-3.0). This is a port onto larp's existing mouse and keyboard code. ## Tested Builds on `main` (`b39145e`) with no new warnings. Now being played on an RTX 4070 Ti (Series X, mouse and keyboard); I'll add the results here. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Off by default. With LARP_MOUSE_CAMERA=direct (and mouse and keyboard on),
the mouse turns the title's look camera directly: larp-hle/src/mousehook.rs
hooks look_pull (0x140e4e3d0, build 1.0.2.1 only; the prologue is checked)
and adds the raw mouse counts, times the sensitivity and the title's own
zoom scale (aiming and scopes slow it), to the camera's heading and pitch.
No stick, no dead zone, no smoothing, no acceleration.

While the weapon / radio wheel is open, or the title has not asked for the
camera in the last 100 ms (menus, the map), the mouse stays on the right
stick as before. controls.ini sensitivity and invert_y apply to both;
LARP_MOUSE_CAMERA_SENS sets the radians per count (default 0.0015).

The look hook, the radial wheel check and larp-loader/src/callhook.rs are
Darner's (TrustNo1, GPL-3.0, git.gtahub.st/trustno1/Darner).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-05 17:23:14 +00:00
Author
Owner

@⁠execor2137 on GitHub · 2026-12-05 18:35 UTC · original

This works great, feels nothing like analog sticks. Feels like native PC game.

**@⁠execor2137** on GitHub · 2026-12-05 18:35 UTC · [original](https://github.com/gamingwithhomie/larp/pull/46#issuecomment-7443264837) This works great, feels nothing like analog sticks. Feels like native PC game.
github manually merged commit 8e3c0b7616 into main 2026-12-05 19:00:57 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.