upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs/modding.md
diff options
context:
space:
mode:
authorItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-22 23:14:27 -0500
committerItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-22 23:14:27 -0500
commit98fa503f8a19c3ed65df1f4f2f0e4571aa42c4f7 (patch)
tree9f17c922e8deebaa4d0cd0a8eb59125349f5bda0 /docs/modding.md
parent0db7fed551c4d48d7b97a9c4d609fc11d17ae19c (diff)
Mods: first-person view, the base (camera section, view-mode getter hook)
mod.json gains "camera": {"view_mode": "first_person"|"default", "first_person_value", "contexts"}. gta6rt --view-mode-getter RVA hooks the game's view-mode getter with a result-override thunk (code_hooks.h: the original runs, then its result and first argument go through leonida::mods::override_view_mode), so the listed contexts answer first person and the others keep the game's mode. mods/first_person asks for it on foot. docs/modding.md records why switching a mode is enough: the game's tuning data refers to a first-person view (FirstPersonDirectionDot, UseFirstPersonCameraMatrix on cloth capsules, FIRST_PERSON_VIEW hit-reaction recovery, a firstpersonshooter HUD texture; RDR2's engine branch), while GTA V's camera class names are not present by joaat. The context numbering and the first-person enum value (4, GTA V's) are manifest settings to confirm in the executable. ctest mods and code_hooks cover the parser, the override and the thunk on x64 code in memory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'docs/modding.md')
-rw-r--r--docs/modding.md33
1 files changed, 33 insertions, 0 deletions
diff --git a/docs/modding.md b/docs/modding.md
index b658aee22..3414923c5 100644
--- a/docs/modding.md
+++ b/docs/modding.md
@@ -105,3 +105,36 @@ the thunk on small x64 functions in memory.
105 105
106That RVA is the only version-specific piece; it can go in `game/xbox-1.0.2.1.json` once confirmed, and 106That RVA is the only version-specific piece; it can go in `game/xbox-1.0.2.1.json` once confirmed, and
107the manifests stay as they are. 107the manifests stay as they are.
108
109## First-person view (`mods/first_person`)
110
111```json
112{ "camera": { "view_mode": "first_person", "first_person_value": 4, "contexts": [0] } }
113```
114
115`camera.view_mode` is `first_person` or `default` (leave the game's choice). The game picks a view mode per
116camera context (on foot, in a vehicle, ...) with a getter that takes the context and returns an enum; the
117mod answers `first_person_value` for the listed `contexts` (every context when the list is left out) and
118the game's own answer otherwise. When several enabled mods have a `camera` section, the last folder wins.
119
120**Evidence that the engine has a first-person view.** The camera metadata classes GTA V uses
121(`camFirstPersonShooterCameraMetadata`, `camFollowPedCameraMetadata`, ...) do not appear by `joaat` in the
122carved `common`, `data` or `script` streams, but the game's own tuning data refers to a first-person view
123in several systems: a ladder/mount tunable `FirstPersonDirectionDot`, a `UseFirstPersonCameraMatrix` flag on
124every cloth-collision capsule (horse saddle and satchel capsules among them, so the code is RDR2's branch of
125the engine, which shipped a first-person mode), a hit-reaction `RecoveryDirection` of `FIRST_PERSON_VIEW`,
126and a `firstpersonshooter_hud` UI texture. So the mod switches on a mode the engine has rather than building
127a camera. Whether the game exposes it to the player is not known.
128
129**Assumptions to confirm in the executable:** that the view mode is chosen through one getter of the form
130`mode = get(context)`, that context 0 is on foot, and that first person is enum value 4 (GTA V's
131`camViewModeSettings` order: third person near, medium, far, cinematic, first person). All three are
132settings in `mod.json`, so a different answer changes the manifest, not the runtime.
133
134**Day one:** find the getter, then run `gta6rt --dry-run <exe> --view-mode-getter RVA` and check the log
135line's count of redirected calls. Leads: the code that reads the view-mode input (GTA V's
136`INPUT_NEXT_CAMERA`, an action hash), the switch over the five view-mode values that selects a camera
137metadata per mode, and the callers of the `UseFirstPersonCameraMatrix` check in the cloth code (they ask
138whether the active view is first person). The hook (`hook_image_results` in `runtime/src/code_hooks.h`) runs
139the original and overrides its result; it is for getters with at most four register arguments and an
140integer result. ctest `code_hooks` and `mods` cover the thunk and the override.