diff options
Diffstat (limited to 'docs/modding.md')
| -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. | ||