First-person view toggle (F10 menu row, F7, LARP_FIRST_PERSON) #86

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

@⁠SheppardX on GitHub · 2026-12-05 18:00 UTC · original
SheppardX:feature/first-person-toggle → main · +244 −8 · 16 files · 1 commits · merged 2026-12-05 19:00 UTC

Summary

Adds a toggle for the title's own first-person camera, which no control in the game reaches. Off by default.

  • F10 menu: a "First-person view" row on the Picture page (live, no restart).
  • F7: switches it in game, with the menu open or closed. Like a menu change, it is written to settings.ini.
  • settings.ini / environment: first_person = on|off, or LARP_FIRST_PERSON=1.

Only for build 1.0.2.1 (b99f876b…); on any other build the hook's byte check refuses and the option does nothing.

How it works

The title picks the first-person camera when its view mode at [title+0x5073C20() + 0x98] is 2 (its own test at title+0xB79480). While the option is on, the entry of the camera selector (title+0x8317A0) holds that mode at 2; switched off, the value it found there is put back. A short black cut, as when the title itself changes view.

The selector's arguments are unknown, so the detour goes through a naked thunk that keeps the flags, every volatile register and xmm0–xmm5, calls the Rust side on a 16-byte aligned stack with shadow space, then jumps to the original.

Tried and dropped (noted in the code so nobody repeats them): asking for the first-person camera's hash at the camera switch (title+0x1DBBD50), or holding the director's phone flags (+0xBEB..+0xBEE), both leave the camera at hip height.

Changes

  • crates/larp-game/src/hooks.rs: FirstPerson hook entry (selector, accessor, offset).
  • crates/larp-game/src/settings.rs: Target::FirstPerson and the first_person setting.
  • crates/larp-hle/src/firstperson.rs (new): the on/off state and the mode hold, with a unit test.
  • crates/larp-hle/src/settings.rs, settings/menu.rs, modules/gameinput.rs: the setting's arms, and F7 as a menu action.
  • apps/larp/src/hooks.rs, run.rs: the detour and its register-keeping thunk.
  • locales/*.json: setting.first_person.label / .about in all 7 languages.

Verification

On this branch (93042a5):

  • cargo test --locked -p larp-core -p larp-hle -p larp-game -p larp: all passed, including holds_first_person_and_gives_the_titles_mode_back and the locale completeness test.
  • cargo clippy --workspace --all-targets --locked: no warnings in the changed code (the two in apps/larp/src/hooks.rs:486 and run.rs:7 are already on main).
  • cargo build --release --locked -p larp: succeeded.

In game: the same hook and view-mode write were confirmed working on foot and in a car (controller) under another Series compatibility layer on the same build. In larp, a run of an earlier build of this change logged the menu toggle reaching the layer; a full in-game check of this exact branch has not been done yet.

Notes:

  • F7 is also the diagnostics build's frame-capture key (record_keys, #[cfg(feature = "diagnostics")]); in such a build F7 does both.
  • No controller combo: clicking both sticks also fires the title's own stick actions.

🤖 Generated with Claude Code

**@⁠SheppardX** on GitHub · 2026-12-05 18:00 UTC · [original](https://github.com/gamingwithhomie/larp/pull/86) `SheppardX:feature/first-person-toggle` → `main` · +244 −8 · 16 files · 1 commits · merged 2026-12-05 19:00 UTC ## Summary Adds a toggle for the title's own first-person camera, which no control in the game reaches. Off by default. - **F10 menu:** a "First-person view" row on the Picture page (live, no restart). - **F7:** switches it in game, with the menu open or closed. Like a menu change, it is written to `settings.ini`. - **`settings.ini` / environment:** `first_person = on|off`, or `LARP_FIRST_PERSON=1`. Only for build 1.0.2.1 (`b99f876b…`); on any other build the hook's byte check refuses and the option does nothing. ## How it works The title picks the first-person camera when its view mode at `[title+0x5073C20() + 0x98]` is 2 (its own test at `title+0xB79480`). While the option is on, the entry of the camera selector (`title+0x8317A0`) holds that mode at 2; switched off, the value it found there is put back. A short black cut, as when the title itself changes view. The selector's arguments are unknown, so the detour goes through a naked thunk that keeps the flags, every volatile register and xmm0–xmm5, calls the Rust side on a 16-byte aligned stack with shadow space, then jumps to the original. Tried and dropped (noted in the code so nobody repeats them): asking for the first-person camera's hash at the camera switch (`title+0x1DBBD50`), or holding the director's phone flags (`+0xBEB..+0xBEE`), both leave the camera at hip height. ## Changes - `crates/larp-game/src/hooks.rs`: `FirstPerson` hook entry (selector, accessor, offset). - `crates/larp-game/src/settings.rs`: `Target::FirstPerson` and the `first_person` setting. - `crates/larp-hle/src/firstperson.rs` (new): the on/off state and the mode hold, with a unit test. - `crates/larp-hle/src/settings.rs`, `settings/menu.rs`, `modules/gameinput.rs`: the setting's arms, and F7 as a menu action. - `apps/larp/src/hooks.rs`, `run.rs`: the detour and its register-keeping thunk. - `locales/*.json`: `setting.first_person.label` / `.about` in all 7 languages. ## Verification On this branch (`93042a5`): - `cargo test --locked -p larp-core -p larp-hle -p larp-game -p larp`: all passed, including `holds_first_person_and_gives_the_titles_mode_back` and the locale completeness test. - `cargo clippy --workspace --all-targets --locked`: no warnings in the changed code (the two in `apps/larp/src/hooks.rs:486` and `run.rs:7` are already on `main`). - `cargo build --release --locked -p larp`: succeeded. In game: the same hook and view-mode write were confirmed working on foot and in a car (controller) under another Series compatibility layer on the same build. In larp, a run of an earlier build of this change logged the menu toggle reaching the layer; a full in-game check of this exact branch has not been done yet. Notes: - F7 is also the diagnostics build's frame-capture key (`record_keys`, `#[cfg(feature = "diagnostics")]`); in such a build F7 does both. - No controller combo: clicking both sticks also fires the title's own stick actions. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The title has a first-person camera that no control reaches. While the new
`first_person` option is on, the camera selector's entry (title+0x8317A0,
detoured with every volatile register, the flags and xmm0-5 kept) holds the
view mode at [title+0x5073C20() + 0x98] at 2, the value the title's own test
takes for the first-person camera; switched off, the mode it found is put back.

- larp-game: `Target::FirstPerson`, the `first_person` setting (Picture page,
  When::Now, LARP_FIRST_PERSON), and the build's `FirstPerson` hook entry.
- larp-hle: `firstperson` (state and the mode hold, with a unit test), the
  setting's arms, and F7 in the menu's keys (toggles the option, writes it
  to settings.ini like a menu change).
- apps/larp: the selector's detour and its register-keeping thunk.
- locales: setting.first_person.{label,about} in all seven catalogs.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-05 18:03:32 +00:00
github manually merged commit 3c852b9ca1 into main 2026-12-05 19:00:51 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.