diff options
| author | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-21 22:09:26 -0500 |
|---|---|---|
| committer | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-21 22:09:26 -0500 |
| commit | 3d4f0df6c4d1560e3117d5df1e37e186d53473a5 (patch) | |
| tree | 3385a2e12d6ffe694f1c4aaf983ec072837d4b0e /docs | |
| parent | ec4840ab361f512e027a8f43248f2983800348bc (diff) | |
| parent | cd6ade80c9ca72a3296cf52177f9a715349b7c8c (diff) | |
Merge pull request #787 from 465d6a0eac
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/gamedata.md | 49 |
1 files changed, 40 insertions, 9 deletions
diff --git a/docs/gamedata.md b/docs/gamedata.md index b7ea0aab9..3a1a7aad7 100644 --- a/docs/gamedata.md +++ b/docs/gamedata.md | |||
| @@ -133,17 +133,17 @@ and 1,100 x 1,100) was an artifact. The prefix is the zeroed row headers of | |||
| 133 | the empty rows, and the grid is 2048 x 2048. The largest square that ends at | 133 | the empty rows, and the grid is 2048 x 2048. The largest square that ends at |
| 134 | the payload end happened to fit the byte count, but it is not the format. | 134 | the payload end happened to fit the byte count, but it is not the format. |
| 135 | 135 | ||
| 136 | ### `PAMH`: `HMAP` v1.2, 144 x 164 max/min heightmap | 136 | ### `PAMH`: `HMAP` max/min heightmap (`common.rpf` 144 x 164, tiles 64 x 64) |
| 137 | 137 | ||
| 138 | | Header | Offset | Type | Measured | | 138 | | Header | Offset | Type | Measured | |
| 139 | |---|---|---|---| | 139 | |---|---|---|---| |
| 140 | | magic | 0x00 | 4 bytes | `PAMH` (little-endian `HMAP`) | | 140 | | magic | 0x00 | 4 bytes | `PAMH` (little-endian `HMAP`) | |
| 141 | | version | 0x04 | 2 x `u8` | 1.2 | | 141 | | version | 0x04 | 2 x `u8` | 1.2 in `common.rpf`; overwritten in the `levels.rpf` tiles | |
| 142 | | pad | 0x06 | `u16` | 0 | | 142 | | pad | 0x06 | `u16` | 0 in `common.rpf`; text in the tiles | |
| 143 | | flag word | 0x08 | `u32` | `0x1BBC8CED` (GTA V's `compressed` field) | | 143 | | flag word | 0x08 | `u32` | `0x1BBC8CED` in `common.rpf`; padding in the tiles | |
| 144 | | width, height | 0x0C | 2 x `u16` | 144, 164 | | 144 | | width, height | 0x0C | 2 x `u16` | 144, 164 in `common.rpf`; 64, 64 in every tile | |
| 145 | | six bounds | 0x10 | 6 x `f32` | `(-13312, -9728, -302)` to `(5120, 11264, 404)` | | 145 | | six bounds | 0x10 | 6 x `f32` | `(-13312, -9728, -302)` to `(5120, 11264, 404)` | |
| 146 | | data size | 0x28 | `u32` | 48,544 | | 146 | | data size | 0x28 | `u32` | 48,544 in `common.rpf`; 8,704 in a tile | |
| 147 | 147 | ||
| 148 | At 0x2C there are 164 row records, then `width * height` **max** bytes and | 148 | At 0x2C there are 164 row records, then `width * height` **max** bytes and |
| 149 | `width * height` **min** bytes. The measured max layer runs 110..255 and the | 149 | `width * height` **min** bytes. The measured max layer runs 110..255 and the |
| @@ -154,6 +154,34 @@ on land. The min layer is the ground or sea floor. | |||
| 154 | The earlier u16 reading interleaved the two arrays: every measured `0x6E6E` | 154 | The earlier u16 reading interleaved the two arrays: every measured `0x6E6E` |
| 155 | was a `(110, 110)` max/min pair, not the value 28,270. | 155 | was a `(110, 110)` max/min pair, not the value 28,270. |
| 156 | 156 | ||
| 157 | ### The 1,476 `PAMH` tiles in `levels.rpf` | ||
| 158 | |||
| 159 | `levels.rpf` holds 1,476 more `PAMH` payloads. All of them decode with the | ||
| 160 | same rules: a 44-byte header, 64 x 64 cells, 64 full-width row records with | ||
| 161 | `start = 0`, `count = 64` and `offset = y * 64`, then 4,096 **max** bytes and | ||
| 162 | 4,096 **min** bytes. That is 6,045,696 cells in total. | ||
| 163 | |||
| 164 | - The tiles are a 36 x 41 rectangle with **512 m** spacing, so they cover the | ||
| 165 | same `(-13312, -9728)` to `(5120, 11264)` box as the `common.rpf` payload, | ||
| 166 | with the same Z box `-302` to `404`. | ||
| 167 | - Max values span 0..255 and min values 0..254. `min <= max` in all but 62 | ||
| 168 | cells, all in the tile at `(-5120, 2048)`, where the encoder wrote a min | ||
| 169 | above its max. | ||
| 170 | - Bytes 0x05..0x0B are leftover text, not a version minor and a flag. 0x04 | ||
| 171 | stays 1, 0x05.. hold the tile name `n_m` (column + 1, row + 1), and the | ||
| 172 | remaining bytes keep the tail of the string `height`, right-aligned at 0x0B. | ||
| 173 | The 28 distinct 0x08..0x0B words are all text; none is zero and none changes | ||
| 174 | the arrays. | ||
| 175 | - The census groups by grid size, not by the 0x04 version bytes, because | ||
| 176 | 0x05 is the first digit of the name. Nothing depends on the 0x08 word. | ||
| 177 | |||
| 178 | ```powershell | ||
| 179 | python -I tools/gamedata_maps.py <work>\carve\levels --json levels.json | ||
| 180 | ``` | ||
| 181 | |||
| 182 | The tool prints one `PAMH census 64x64: ...` line and writes the per-group | ||
| 183 | counts. Only header fields and counts are written, never the height bytes. | ||
| 184 | |||
| 157 | ### Cross-check and Z mapping | 185 | ### Cross-check and Z mapping |
| 158 | 186 | ||
| 159 | MHIU and PAMH cover slightly different boxes at different resolutions. | 187 | MHIU and PAMH cover slightly different boxes at different resolutions. |
| @@ -176,9 +204,12 @@ python -I tools/gamedata_maps.py <work>\carve\common --json maps.json | |||
| 176 | 204 | ||
| 177 | ### Checksum and unknown fields | 205 | ### Checksum and unknown fields |
| 178 | 206 | ||
| 179 | - `PAMH` 0x08 is the HMAP `compressed` word (GTA V writes 1). The measured | 207 | - `PAMH` 0x08 is GTA V's `compressed` word only in the `common.rpf` payload, |
| 180 | `0x1BBC8CED` is not CRC32, Adler32, FNV-1a, joaat32 or a hashlib digest of | 208 | where it holds `0x1BBC8CED`. In the 1,476 `levels.rpf` tiles bytes 0x04..0x0B |
| 181 | the max/min arrays; it is reported as a flag word, not a proven checksum. | 209 | are leftover text (tile name plus `height`), so 0x08 is padding there. The |
| 210 | `0x1BBC8CED` value is not CRC32, Adler32, FNV-1a, joaat32 or a hashlib | ||
| 211 | digest of the max/min arrays; it is reported as a flag word, not a proven | ||
| 212 | checksum. | ||
| 182 | - `MHIU` 0x28 is a `u8` default height, not a 32-bit word (ASSET-48). Its | 213 | - `MHIU` 0x28 is a `u8` default height, not a 32-bit word (ASSET-48). Its |
| 183 | value is 23 in both payloads, the same value the empty rows were measured | 214 | value is 23 in both payloads, the same value the empty rows were measured |
| 184 | to hold, and the row cropping above uses it. A full scan of all 12 archives | 215 | to hold, and the row cropping above uses it. A full scan of all 12 archives |