vehicle/mousehook: add 1.5s auto-center, cinematic-aware handbrake, and Alt right-stick mode #153

Manually merged
github merged 1 commit from github-bot/gh-153 into gh-pr/153/base 2026-12-06 01:07:28 +00:00 AGit
Owner

@⁠greedtv92 on GitHub · 2026-12-05 19:51 UTC · original
greedtv92:feat/direct-mouse-driving-and-minigames → main · +574 −89 · 5 files · 1 commits · merged 2026-12-05 23:27 UTC

Rebased cleanly onto latest main (post-#150) so all settings and keybinds flow through #150's single LiveStore + CONFIG_REV cache + build_bindings + F10 -> Controls (zero duplicate config systems on the hot path), while extending upstream crates/larp-hle/src/vehicle.rs directly with zero duplicate hooks.

Summary

  • 1.5s smart vehicle camera auto-center (AutoCenterMode: on, auto, off stored in LiveStore + controls.ini vehicle_auto_center + LARP_VEHICLE_AUTO_CENTER):
    • Holds the vehicle camera free for 1.5 s after mouse motion, then smoothly lets the title auto-center behind the vehicle (GTA V PC feel). Default stays on (stock title behavior).
    • Editable live in classic F10 -> Controls (off / auto (1.5s) / on), selectable in new-look settings/extra.rs, and cycled live via F8 (persisted via LiveStore) whenever the auto-center hook is active.
  • Seat-aware & Cinematic-aware driving Handbrake (handbrake = Space, live-rebindable in F10 -> Controls including Mouse3/4/5 or Delete to clear) when keyboard_driving = 1:
    • Sends Xbox A (handbrake) and suppresses X on the shared key during normal driving.
    • Automatically detects GTA VI's Cinematic Camera (camCinematicDirector 0x098c_1470, secondary cinematic director 0x098c_1478 with m_RenderState < 3 at +0x258, or any non-camGameplayDirector 0x099f_ece8 dominant director) and yields Space back to Xbox X while keeping RMB/LMB mapped to LT/RT so on-screen prompts ENABLE / DISABLE AUTO DRIVE [Space] and SPEED 1 / 2 / 3 [RMB] [LMB] work directly.
  • Alt + Mouse 360° Right-Stick mode (right_stick_mouse = Alt, live-rebindable in F10 -> Controls, guarded against Alt+Enter/Alt+Tab, cleared on capture release) under LARP_MOUSE_CAMERA=direct:
    • Temporarily steers the analog right stick directly with the mouse for carjacking, lockpicking, and fishing minigames, plus circular unit-length normalization on I/J/K/L diagonal right-stick inputs.
  • Cached radial-wheel & WM_INPUT map-open hints with 50 ms staleness guards so high-polling mouse input stays fast without risking stale state in hybrid controller + mouse sessions.

Verification

  • cargo test -p larp-hle --lib: 67 passed, 0 failed (including vehicle::tests::auto_center_mode_delays_for_1_5s_and_cycles, vehicle::tests::cinematic_camera_active_matches_dominant_director_pointer, mouse::tests::driving_handbrake_sends_a_normally_and_yields_to_x_in_cinematic_mode, mouse::tests::auto_center_mode_parses_all_aliases_and_normalizes_right_stick, and settings::extra::tests::every_start_option_has_a_default_first_and_distinct_values).
  • cargo check -p larp: clean build with zero new warnings.
  • Verified Cinematic Mode Auto Drive (Space) and SPEED 1 / 2 / 3 (RMB / LMB) live in-game on build 1.0.2.1.
**@⁠greedtv92** on GitHub · 2026-12-05 19:51 UTC · [original](https://github.com/gamingwithhomie/larp/pull/153) `greedtv92:feat/direct-mouse-driving-and-minigames` → `main` · +574 −89 · 5 files · 1 commits · merged 2026-12-05 23:27 UTC Rebased cleanly onto latest `main` (post-`#150`) so all settings and keybinds flow through `#150`'s single `LiveStore` + `CONFIG_REV` cache + `build_bindings` + `F10 -> Controls` (zero duplicate config systems on the hot path), while extending upstream `crates/larp-hle/src/vehicle.rs` directly with zero duplicate hooks. ### Summary - **1.5s smart vehicle camera auto-center** (`AutoCenterMode`: `on`, `auto`, `off` stored in `LiveStore` + `controls.ini` `vehicle_auto_center` + `LARP_VEHICLE_AUTO_CENTER`): - Holds the vehicle camera free for 1.5 s after mouse motion, then smoothly lets the title auto-center behind the vehicle (GTA V PC feel). Default stays `on` (stock title behavior). - Editable live in classic `F10 -> Controls` (`off / auto (1.5s) / on`), selectable in new-look `settings/extra.rs`, and cycled live via `F8` (persisted via `LiveStore`) whenever the auto-center hook is active. - **Seat-aware & Cinematic-aware driving Handbrake** (`handbrake = Space`, live-rebindable in `F10 -> Controls` including Mouse3/4/5 or `Delete` to clear) when `keyboard_driving = 1`: - Sends Xbox `A` (handbrake) and suppresses `X` on the shared key during normal driving. - Automatically detects GTA VI's Cinematic Camera (`camCinematicDirector` `0x098c_1470`, secondary cinematic director `0x098c_1478` with `m_RenderState < 3` at `+0x258`, or any non-`camGameplayDirector` `0x099f_ece8` dominant director) and yields `Space` back to Xbox `X` while keeping `RMB`/`LMB` mapped to `LT`/`RT` so on-screen prompts **`ENABLE / DISABLE AUTO DRIVE [Space]`** and **`SPEED 1 / 2 / 3 [RMB] [LMB]`** work directly. - **`Alt` + Mouse 360° Right-Stick mode** (`right_stick_mouse = Alt`, live-rebindable in `F10 -> Controls`, guarded against `Alt+Enter`/`Alt+Tab`, cleared on capture release) under `LARP_MOUSE_CAMERA=direct`: - Temporarily steers the analog right stick directly with the mouse for carjacking, lockpicking, and fishing minigames, plus circular unit-length normalization on `I`/`J`/`K`/`L` diagonal right-stick inputs. - **Cached radial-wheel & `WM_INPUT` map-open hints** with 50 ms staleness guards so high-polling mouse input stays fast without risking stale state in hybrid controller + mouse sessions. ### Verification - `cargo test -p larp-hle --lib`: **67 passed, 0 failed** (including `vehicle::tests::auto_center_mode_delays_for_1_5s_and_cycles`, `vehicle::tests::cinematic_camera_active_matches_dominant_director_pointer`, `mouse::tests::driving_handbrake_sends_a_normally_and_yields_to_x_in_cinematic_mode`, `mouse::tests::auto_center_mode_parses_all_aliases_and_normalizes_right_stick`, and `settings::extra::tests::every_start_option_has_a_default_first_and_distinct_values`). - `cargo check -p larp`: clean build with zero new warnings. - Verified Cinematic Mode Auto Drive (`Space`) and `SPEED 1 / 2 / 3` (`RMB` / `LMB`) live in-game on build `1.0.2.1`.
Extends the existing opt-in direct mouse camera (LARP_MOUSE_CAMERA=direct, #46)
without modifying default right-stick mouse behavior or mapmouse.rs:
- Smart 1.5s vehicle camera auto-center hook (camFollowAutoCenter::Update at
  0x1407c5ee1 -> 0x140b69900; LARP_VEHICLE_AUTO_CENTER=auto|on|off, F8
  cycles live) + pure-memory RAGE ECS VehicleSeat detection.
- Seat-aware driving Handbrake (handbrake = Space sends Xbox A while in
  VehicleSeat::Driver and suppresses X on that shared key, separate from
  on-foot Jump/Melee).
- Hold Alt (
ight_stick_mouse) under LARP_MOUSE_CAMERA=direct to pause
  camera rotation and steer a 360-degree analog Right Stick with the mouse for
  carjacking/fishing minigames (+ circular normalization for I/J/K/L diagonals).
- Hot-path optimizations: caches is_radial_wheel_active() from the 8 ms poll
  instead of walking the HUD table inside every look_returned call, and
  fast-paths WM_INPUT when captured and no map is open.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-05 19:54:51 +00:00
github-bot force-pushed github-bot/gh-153 from c7a72d0577 to 000b3d6345 2026-12-05 20:11:38 +00:00 Compare
github-bot changed title from mousehook: add 1.5s vehicle auto-center, seat-aware handbrake, and Alt right-stick mode (opt-in) to vehicle/mousehook: add 1.5s auto-center, cinematic-aware handbrake, and Alt right-stick mode 2026-12-05 22:38:01 +00:00
github-bot force-pushed github-bot/gh-153 from 000b3d6345 to d0d62d3458 2026-12-05 22:38:04 +00:00 Compare
Author
Owner

@⁠gamingwithhomie on GitHub · 2026-12-05 22:33 UTC · original

Tried to merge after #150 (live F10 Controls editor) landed: the two PRs now overlap semantically in gameinput/mouse.rs - #150 replaced the config snapshot with a live LiveStore + revision cache, while this PR stores the same settings in atomics (SENS_BITS/VEHICLE_AUTO_CENTER_MODE/...) and builds its own bindings table, so a textual union would run two config systems on the hot path. Please rebase onto current main (#150 merged) and re-express the three features (1.5s auto-center modes + F8 cycle, seat-aware handbrake, Alt right-stick hold) on top of #150s store/build_bindings - the features themselves are wanted (chat feedback today asked for exactly the vehicle/auto-center polish). Well fast-track the re-review.

**@⁠gamingwithhomie** on GitHub · 2026-12-05 22:33 UTC · [original](https://github.com/gamingwithhomie/larp/pull/153#issuecomment-7446857384) Tried to merge after #150 (live F10 Controls editor) landed: the two PRs now overlap semantically in `gameinput/mouse.rs` - #150 replaced the config snapshot with a live `LiveStore` + revision cache, while this PR stores the same settings in atomics (`SENS_BITS`/`VEHICLE_AUTO_CENTER_MODE`/...) and builds its own bindings table, so a textual union would run two config systems on the hot path. Please rebase onto current main (#150 merged) and re-express the three features (1.5s auto-center modes + F8 cycle, seat-aware handbrake, Alt right-stick hold) on top of #150s store/`build_bindings` - the features themselves are wanted (chat feedback today asked for exactly the vehicle/auto-center polish). Well fast-track the re-review.
github-bot force-pushed github-bot/gh-153 from d0d62d3458 to dc303d49c0 2026-12-05 22:53:01 +00:00 Compare
Author
Owner

@⁠greedtv92 on GitHub · 2026-12-05 22:50 UTC · original

Rebased onto latest main (8187e7b, after #150) and re-expressed all three features cleanly on top of #150's single LiveStore + CONFIG_REV snapshot cache + build_bindings:

  • AutoCenterMode (on / auto / off) now lives in LiveStore (single VEHICLE_AUTO_CENTER_MODE atomic synced to vehicle::set_auto_center_mode), editable live in classic F10 -> Controls (off / auto (1.5s) / on), selectable in settings/extra.rs, and cycled via F8 through set_vehicle_auto_center_mode.
  • handbrake (default Space) and right_stick_mouse (default Alt) are now built inside #150's build_bindings, evaluated in eval_buttons (including Mouse3/4/5 override scoping), and live-rebindable in F10 -> Controls.
  • Cinematic Mode Auto Drive (Space -> X + RMB/LMB -> LT/RT for SPEED 1 / 2 / 3) verified live in-game on 1.0.2.1.

cargo test -p larp-hle --lib (67/67 passed) and cargo check -p larp are clean — ready for re-review!

**@⁠greedtv92** on GitHub · 2026-12-05 22:50 UTC · [original](https://github.com/gamingwithhomie/larp/pull/153#issuecomment-7447102271) Rebased onto latest `main` (`8187e7b`, after `#150`) and re-expressed all three features cleanly on top of `#150`'s single `LiveStore` + `CONFIG_REV` snapshot cache + `build_bindings`: - **`AutoCenterMode` (`on` / `auto` / `off`)** now lives in `LiveStore` (single `VEHICLE_AUTO_CENTER_MODE` atomic synced to `vehicle::set_auto_center_mode`), editable live in classic `F10 -> Controls` (`off / auto (1.5s) / on`), selectable in `settings/extra.rs`, and cycled via `F8` through `set_vehicle_auto_center_mode`. - **`handbrake` (default `Space`)** and **`right_stick_mouse` (default `Alt`)** are now built inside `#150`'s `build_bindings`, evaluated in `eval_buttons` (including Mouse3/4/5 override scoping), and live-rebindable in `F10 -> Controls`. - **Cinematic Mode Auto Drive (`Space` -> `X` + `RMB`/`LMB` -> `LT`/`RT` for `SPEED 1 / 2 / 3`)** verified live in-game on `1.0.2.1`. `cargo test -p larp-hle --lib` (67/67 passed) and `cargo check -p larp` are clean — ready for re-review!
github-bot force-pushed github-bot/gh-153 from dc303d49c0 to 449414335f 2026-12-05 23:06:33 +00:00 Compare
github-bot changed target branch from main to gh-pr/153/base 2026-12-05 23:36:45 +00:00
github-bot referenced this pull request from a commit 2026-12-06 01:07:23 +00:00
github manually merged commit 449414335f into gh-pr/153/base 2026-12-06 01:07:28 +00:00
Author
Owner

@⁠compl3xity1337 on GitHub · 2026-12-06 01:24 UTC · original

Tested on current main merged with #150: F8 auto-centre cycling and the Space handbrake work. Note: main's #134 hooks the same auto-centre call (0x1407c5ee1), so whichever installs second skips (the byte check catches it); one owner might be cleaner. Alt right-stick mode is hard to tell apart outside a minigame; detecting minigames automatically, if the game exposes a flag, might beat holding Alt.

**@⁠compl3xity1337** on GitHub · 2026-12-06 01:24 UTC · [original](https://github.com/gamingwithhomie/larp/pull/153#issuecomment-7449152341) Tested on current main merged with #150: F8 auto-centre cycling and the Space handbrake work. Note: main's #134 hooks the same auto-centre call (0x1407c5ee1), so whichever installs second skips (the byte check catches it); one owner might be cleaner. Alt right-stick mode is hard to tell apart outside a minigame; detecting minigames automatically, if the game exposes a flag, might beat holding Alt.
This discussion has been locked. Commenting is limited to contributors.
No description provided.