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:
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.