diff options
| author | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 23:14:27 -0500 |
|---|---|---|
| committer | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 23:14:27 -0500 |
| commit | 98fa503f8a19c3ed65df1f4f2f0e4571aa42c4f7 (patch) | |
| tree | 9f17c922e8deebaa4d0cd0a8eb59125349f5bda0 /docs | |
| parent | 0db7fed551c4d48d7b97a9c4d609fc11d17ae19c (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')
| -rw-r--r-- | docs/modding.md | 33 |
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 | ||
| 106 | That RVA is the only version-specific piece; it can go in `game/xbox-1.0.2.1.json` once confirmed, and | 106 | That RVA is the only version-specific piece; it can go in `game/xbox-1.0.2.1.json` once confirmed, and |
| 107 | the manifests stay as they are. | 107 | the 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 | ||
| 116 | camera context (on foot, in a vehicle, ...) with a getter that takes the context and returns an enum; the | ||
| 117 | mod answers `first_person_value` for the listed `contexts` (every context when the list is left out) and | ||
| 118 | the 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 | ||
| 122 | carved `common`, `data` or `script` streams, but the game's own tuning data refers to a first-person view | ||
| 123 | in several systems: a ladder/mount tunable `FirstPersonDirectionDot`, a `UseFirstPersonCameraMatrix` flag on | ||
| 124 | every cloth-collision capsule (horse saddle and satchel capsules among them, so the code is RDR2's branch of | ||
| 125 | the engine, which shipped a first-person mode), a hit-reaction `RecoveryDirection` of `FIRST_PERSON_VIEW`, | ||
| 126 | and a `firstpersonshooter_hud` UI texture. So the mod switches on a mode the engine has rather than building | ||
| 127 | a 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 | ||
| 132 | settings 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 | ||
| 135 | line'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 | ||
| 137 | metadata per mode, and the callers of the `UseFirstPersonCameraMatrix` check in the cloth code (they ask | ||
| 138 | whether the active view is first person). The hook (`hook_image_results` in `runtime/src/code_hooks.h`) runs | ||
| 139 | the original and overrides its result; it is for getters with at most four register arguments and an | ||
| 140 | integer result. ctest `code_hooks` and `mods` cover the thunk and the override. | ||