upleb.uk

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

summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAlpaca-exe <20233126@etud.univ-evry.fr>2026-11-23 02:05:27 +0100
committerAlpaca-exe <20233126@etud.univ-evry.fr>2026-11-23 02:05:27 +0100
commitbf9a2633df08856c5beed82b78e932b2cae7d403 (patch)
tree9ff7a132d22be427cc172c38f29715ccaaf94ce9 /docs
parent03b09a086592a197db64d91655c6e65c30764d96 (diff)
gamedata_sps1: decode common.rpf SPS1 shader-preset table and join SGD5 effects
Diffstat (limited to 'docs')
-rw-r--r--docs/gamedata.md45
-rw-r--r--docs/models.md5
2 files changed, 42 insertions, 8 deletions
diff --git a/docs/gamedata.md b/docs/gamedata.md
index dd91439d2..c6e2cb546 100644
--- a/docs/gamedata.md
+++ b/docs/gamedata.md
@@ -54,7 +54,7 @@ their content.
54## Type split 54## Type split
55 55
56Stream-level split, using the requested classes. `other` is 2 `MHIU` payloads (38 streams), 1 `PAMH` and 1 56Stream-level split, using the requested classes. `other` is 2 `MHIU` payloads (38 streams), 1 `PAMH` and 1
57`SPS1Z`; there are no `RBF0`, `PSIN` or Bink 2 streams in this archive. 57`SPS1`; there are no `RBF0`, `PSIN` or Bink 2 streams in this archive.
58 58
59| Type | Streams | Stored B | Inflated B | Logical payloads | 59| Type | Streams | Stored B | Inflated B | Logical payloads |
60|---|---:|---:|---:|---:| 60|---|---:|---:|---:|---:|
@@ -63,7 +63,7 @@ Stream-level split, using the requested classes. `other` is 2 `MHIU` payloads (3
63| `PSIN` | 0 | 0 | 0 | 0 | 63| `PSIN` | 0 | 0 | 0 | 0 |
64| text / INI-like | 4 | 30,162 | 142,036 | 3 | 64| text / INI-like | 4 | 30,162 | 142,036 | 3 |
65| binary | 66 | 1,396,087 | 4,312,136 | 2 | 65| binary | 66 | 1,396,087 | 4,312,136 | 2 |
66| other (`MHIU`/`PAMH`/`SPS1Z`) | 40 | 456,483 | 2,492,026 | 4 | 66| other (`MHIU`/`PAMH`/`SPS1`) | 40 | 456,483 | 2,492,026 | 4 |
67| **total** | **954** | **5,647,255** | **50,231,123** | **276** | 67| **total** | **954** | **5,647,255** | **50,231,123** | **276** |
68 68
69By inflated bytes: 86.2% XML, 8.6% binary, 5.0% `other`, 0.3% text. XML is only 66.7% of stored bytes, 69By inflated bytes: 86.2% XML, 8.6% binary, 5.0% `other`, 0.3% text. XML is only 66.7% of stored bytes,
@@ -72,7 +72,7 @@ root element. Non-XML grouping follows the 64 KiB block rule; none of the nine n
72that is an exact multiple of 64 KiB, so their counts are unambiguous too. 72that is an exact multiple of 64 KiB, so their counts are unambiguous too.
73 73
74The four non-XML structured payloads are the only readable binary metadata here: two `MHIU` blobs (about 74The four non-XML structured payloads are the only readable binary metadata here: two `MHIU` blobs (about
751.19 MB and 1.21 MB inflated), one `PAMH` blob (48.6 KB) and one `SPS1Z` shader-parameter table (43.8 KB). 751.19 MB and 1.21 MB inflated), one `PAMH` blob (48.6 KB) and one `SPS1` shader-preset table (43,791 B).
76The two large opaque blobs (1.04 MB and 3.27 MB) have no recognised header and are left as binary. No model, 76The two large opaque blobs (1.04 MB and 3.27 MB) have no recognised header and are left as binary. No model,
77texture or audio signature is present in `common.rpf`; the two opaque blobs are not identified. 77texture or audio signature is present in `common.rpf`; the two opaque blobs are not identified.
78 78
@@ -224,6 +224,36 @@ python -I tools/gamedata_maps.py <work>\carve\common --json maps.json
224 sum of the grid. They are most likely uninitialised struct padding after the 224 sum of the grid. They are most likely uninitialised struct padding after the
225 `u8` and are reported as `pad_29`; with N = 2 this is a hypothesis. 225 `u8` and are reported as `pad_29`; with N = 2 this is a hypothesis.
226 226
227## `SPS1` shader-preset table
228
229The single `SPS1` payload in `common.rpf` (`0x650000`, `43,791` B inflated, 1 stream) is the material shader-preset
230lookup table (`tools/gamedata_sps1.py`), not an `"SPS1Z"` five-byte magic:
231
232| Offset | Type | Meaning | Measured in 1.0.2.1 `common.rpf` |
233|---|---|---|---|
234| `0x00` | `char[4]` | Magic | `"SPS1"` |
235| `0x04` | `u32` | `entry_count` | `858` (`0x0000035A`; its low byte `0x5A == 'Z'` caused the old `"SPS1Z"` reading) |
236| `0x08` | `entry[858]` | `{u8 preset_len, char preset[], u8 effect_len, char effect[], u8 render_bucket}` | `43,783` B consuming the entire payload to EOF (`0` extra bytes) |
237
238Measured over all **858** records and cross-checked against `shaders.rpf`'s two `SGD5` databases:
239
240- **Presets:** all `858` carry a unique case-insensitive `.sps` path (`8`..`51` bytes), split into `846` root
241 names and `12` one-folder paths with zero basename stem collisions.
242- **100% `SGD5` target resolution:** all **858 of 858** records (`539 of 539` distinct target effects, `4`..`47`
243 bytes) match an effect in `shaders.rpf` `SGD5` Database 0 (`0x10E39`, `910` effects; `0` in Database 1).
244- **Aliases:** `532` presets have `preset_stem == effect` and `326` alias a preset name onto a shared effect; only
245 `589` preset stems match an `SGD5` effect name directly (`269` preset stems are defined only in `SPS1`).
246- **Default render buckets (`0..7`):** `0` (`401`), `1` (`161`), `2` (`101`), `3` (`162`), `4` (`1`), `5` (`1`),
247 `6` (`30`), `7` (`1`). `63` target effects span multiple buckets across their presets (`58` in `{0, 3}`, `2` in
248 `{0, 1, 3}`, `1` in `{1, 3}`, `1` in `{0, 1, 2, 3, 6, 7}`, and `1` in `{4, 5}` — the single bucket-`4` and bucket-`5`
249 presets both point to effect hash `0xFC34F08B`, matching [`models.md`](models.md#shader-render-buckets)).
250
251```powershell
252python -I tools/gamedata_sps1.py <work>\carve\common --shaders shaders.rpf --json sps1.json
253```
254
255Only counts, bucket distributions and `--preset-hash` hashes are written; preset and effect names stay local.
256
227## Grid atlases 257## Grid atlases
228 258
229Four `GridAtlasInfo` documents describe world-space texture grids streamed by position. All four have the 259Four `GridAtlasInfo` documents describe world-space texture grids streamed by position. All four have the
@@ -712,7 +742,7 @@ are (GTA V reads them as a value pair blended by strength), and how `controlValu
712 742
713| Archive | Size | Streams | Inflated | Dominant payloads | XML | `RBF0` | `PSIN` | 743| Archive | Size | Streams | Inflated | Dominant payloads | XML | `RBF0` | `PSIN` |
714|---|---:|---:|---:|---|---:|---:|---:| 744|---|---:|---:|---:|---|---:|---:|---:|
715| `common.rpf` | 6.6 MB | 954 | 50.2 MB | XML/config, text, `MHIU`, `PAMH`, `SPS1Z` | 844 streams | 0 | 0 | 745| `common.rpf` | 6.6 MB | 954 | 50.2 MB | XML/config, text, `MHIU`, `PAMH`, `SPS1` | 844 streams | 0 | 0 |
716| `data.rpf` | 481.5 MB | 28,509 | 1,403.3 MB | models/GPU pages, 1,263 `RBF0`, 2,281 `PSIN`, 3,132 resource pages | 0 | 1,263 | 2,281 | 746| `data.rpf` | 481.5 MB | 28,509 | 1,403.3 MB | models/GPU pages, 1,263 `RBF0`, 2,281 `PSIN`, 3,132 resource pages | 0 | 1,263 | 2,281 |
717| `script.rpf` | 4.4 MB | 714 | 5.0 MB | 671 `PSIN` plus binary | 0 | 0 | 671 | 747| `script.rpf` | 4.4 MB | 714 | 5.0 MB | 671 `PSIN` plus binary | 0 | 0 | 671 |
718 748
@@ -777,11 +807,10 @@ offset across the line is one reading).
777## Readable vs binary 807## Readable vs binary
778 808
779Readable: the 266 XML documents, 3 text/INI-like files, and the two `MHIU` 2048 x 2048 809Readable: the 266 XML documents, 3 text/INI-like files, and the two `MHIU` 2048 x 2048
780heightmaps plus the `PAMH` max/min heightmap and the `SPS1Z` header. The XML is ordinary text 810heightmaps plus the `PAMH` max/min heightmap and the `SPS1` shader-preset table. The XML is ordinary text
781and can be consumed by any parser. `tools/gamedata_maps.py` decodes the `MHIU` row table and 811and can be consumed by any parser. `tools/gamedata_maps.py` decodes the `MHIU` row table and
782packed heights and the `PAMH` row table and max/min arrays. `SPS1Z` is a NUL-separated 812packed heights and the `PAMH` row table and max/min arrays, and `tools/gamedata_sps1.py` decodes the
783table of path/key strings with per-entry type/length markers; its structure is visible but its consumer is not 813`858`-entry `SPS1` preset table and joins it to `shaders.rpf`'s `SGD5` effect records.
784implemented.
785 814
786Not fully readable: the 8.6% unread span, the two opaque binary blobs, and the missing first blocks of the 9 815Not fully readable: the 8.6% unread span, the two opaque binary blobs, and the missing first blocks of the 9
787tail-only documents (their retained tails are readable but incomplete). The encrypted table of contents is 816tail-only documents (their retained tails are readable but incomplete). The encrypted table of contents is
diff --git a/docs/models.md b/docs/models.md
index 793ac5b0b..d177fa145 100644
--- a/docs/models.md
+++ b/docs/models.md
@@ -504,6 +504,11 @@ Names are per model and a building holds glass, decal and opaque shaders alike,
504in absolute terms; the enrichment against bucket 0 is the signal. For export: bucket 1 needs blending, 2 is 504in absolute terms; the enrichment against bucket 0 is the signal. For export: bucket 1 needs blending, 2 is
505a projected decal, 3 needs alpha testing, 6 is a water surface. 505a projected decal, 3 needs alpha testing, 6 is a water surface.
506 506
507`common.rpf` carries the matching preset-to-effect table (`SPS1`, decoded by `tools/gamedata_sps1.py`,
508[`gamedata.md`](gamedata.md#sps1-shader-preset-table)): `858` `.sps` presets map onto `539` `SGD5` Database 0 effects
509with a default `u8` render bucket (`0..7`), `63` effects accept multiple buckets, and the single bucket-`4`
510and bucket-`5` presets both resolve to effect `fc34f08b`.
511
507## Material shader hashes and the carved programs 512## Material shader hashes and the carved programs
508 513
509`rpf9dump` also writes each material's shader hash (`manifest.json` → `Materials[].Shader`, u32 as 8 hex digits). 514`rpf9dump` also writes each material's shader hash (`manifest.json` → `Materials[].Shader`, u32 as 8 hex digits).