upleb.uk

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

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKam471 <115741199+Kam471@users.noreply.github.com>2026-11-21 18:24:25 +0000
committerKam471 <115741199+Kam471@users.noreply.github.com>2026-11-21 18:26:19 +0000
commitdf87229ce4dec9e2f40cffd208b88977befbca6f (patch)
tree5a1f1efffa1144db258496f24a5b1e80619a157a
parent793b06f12765571ed5e126d1d8944cec6a4dc805 (diff)
docs: measure the BCPack texture gap and the next step
-rw-r--r--docs/design.md2
-rw-r--r--docs/textures.md289
2 files changed, 290 insertions, 1 deletions
diff --git a/docs/design.md b/docs/design.md
index 188046cc6..823ae8e19 100644
--- a/docs/design.md
+++ b/docs/design.md
@@ -90,7 +90,7 @@ add a source file, add it to `runtime\CMakeLists.txt` and to the file list in `b
90| Textures | **Solved.** Headers are in CPU segments: GPU pointer at q[k], u16 width/height/depth and DXGI format at q[k+4], mip count at byte 2 of q[k+5]. Data is AMD `SW_4K_S` tiled, largest mip first. The GPU segment is the blob run after the CPU blob. On 200 samples, 173 decode at least 1.5× smoother detiled than untiled (median 2.56×). Exports the top mip, slice 0, as DDS. **22,342 exported (1.23 GiB)**: every header whose GPU data follows its CPU blob. World and model textures in `levels.rpf` have the same blocker as meshes. GPU offsets must be 256-byte aligned, which drops the false headers in `navmeshes`/`anim`. | `tools\tex_headers.py`, `tools\tex_export.py`, `<work>\textures\` | 90| Textures | **Solved.** Headers are in CPU segments: GPU pointer at q[k], u16 width/height/depth and DXGI format at q[k+4], mip count at byte 2 of q[k+5]. Data is AMD `SW_4K_S` tiled, largest mip first. The GPU segment is the blob run after the CPU blob. On 200 samples, 173 decode at least 1.5× smoother detiled than untiled (median 2.56×). Exports the top mip, slice 0, as DDS. **22,342 exported (1.23 GiB)**: every header whose GPU data follows its CPU blob. World and model textures in `levels.rpf` have the same blocker as meshes. GPU offsets must be 256-byte aligned, which drops the false headers in `navmeshes`/`anim`. | `tools\tex_headers.py`, `tools\tex_export.py`, `<work>\textures\` |
91| Models | **Done: 155,598 models** (levels.rpf 149,811 with 1.9 billion triangles, story000 3,303, data 1,350, shared_minigame000 783, packs 314, core_restofworld 37; 0 failures). Exported with `tools\rpf9dump` (built on breadbbbb/rpf9-explorer's Core; see below). Resources are found at page offset +16 after 16 zero bytes, followed by a zlib system blob with a drawable/fragment header and then the following zlib blocks as graphics data. Positions are quantized: `bias + scale * ((q >> 8) & 0xFFFFFF)`. Output is OBJ (positions, UVs, indices) plus a manifest with real model names (e.g. `cvar_int_grg2b_toys_1`), bounds, per-mesh shader index and material texture references (parameter hash, name hash, 64-bit asset key). My earlier `0x1380`/`0x1601` descriptor notes stand, but the "data not located" blocker was wrong. | `<work>\assets\<archive>\models\` | 91| Models | **Done: 155,598 models** (levels.rpf 149,811 with 1.9 billion triangles, story000 3,303, data 1,350, shared_minigame000 783, packs 314, core_restofworld 37; 0 failures). Exported with `tools\rpf9dump` (built on breadbbbb/rpf9-explorer's Core; see below). Resources are found at page offset +16 after 16 zero bytes, followed by a zlib system blob with a drawable/fragment header and then the following zlib blocks as graphics data. Positions are quantized: `bias + scale * ((q >> 8) & 0xFFFFFF)`. Output is OBJ (positions, UVs, indices) plus a manifest with real model names (e.g. `cvar_int_grg2b_toys_1`), bounds, per-mesh shader index and material texture references (parameter hash, name hash, 64-bit asset key). My earlier `0x1380`/`0x1601` descriptor notes stand, but the "data not located" blocker was wrong. | `<work>\assets\<archive>\models\` |
92| Texture dictionaries | Same tool: TXD resources become DDS per texture. | `<work>\assets\<archive>\textures\` | 92| Texture dictionaries | Same tool: TXD resources become DDS per texture. | `<work>\assets\<archive>\textures\` |
93| World textures (TTPF) | **Done: 308,895 textures from all 57 pools, 0 failures, 48,220 entries skipped** (BCPack or unmapped). 46 pools are in `data\ttdb\**`, 11 in `pack\<name>\data\ttdb\**` (exported under `ttpf_pack\<pack>\`). `data\ttdb\**\*.ttpf` (57 pools, 58 GiB) are loose RDS5 texture pools, **not** inside RPFs. rpf9-explorer's `TtpfReader` reads the catalog and detiles them; checked visually (`ttdb_graphics`: scope reticles, clean lines). Names are generated (`texture_N_<assetkey>`); models reference textures by asset key. Some rows are skipped (BCPack or unmapped shards). | `<work>\assets\ttpf\<pool>\` + `manifest.json` | 93| World textures (TTPF) | **Done: 308,895 textures from all 57 pools, 0 failures, 48,220 entries skipped** (33,507 BCPack, 14,030 compact mapping, 678 arrays/volumes, 5 unsupported format, 0 unmapped). 46 pools are in `data\ttdb\**`, 11 in `pack\<name>\data\ttdb\**` (exported under `ttpf_pack\<pack>\`). `data\ttdb\**\*.ttpf` (57 pools, 58 GiB) are loose RDS5 texture pools, **not** inside RPFs. rpf9-explorer's `TtpfReader` reads the catalog and detiles them; checked visually (`ttdb_graphics`: scope reticles, clean lines). Names are generated (`texture_N_<assetkey>`); models reference textures by asset key. Some rows are skipped; the measured breakdown and the BCPack next step are in [textures.md](textures.md). | `<work>\assets\ttpf\<pool>\` + `manifest.json` |
94| Audio | `audio.rpf` holds raw (not zlib) **AWC** banks: Opus (codec 0x0B) and XMA2 streams. Exported as whole `.awc` files plus `audio_manifest.json` (stream ids, codec, channels, rate, duration). **Done: 7,162 banks, 27 GiB, 1,603,231 streams, about 1,324 hours** (codec 0x0B Opus 1,601,167; 5: 1,818; 2: 227; 0 PCM: 19). `tools/awc_opus.py` repackages every Opus stream **losslessly** into a standard Ogg Opus file (no re-encode; PCM streams become .wav). The AWC framing is 2048-byte blocks of [u16 length][packet], with a zero length padding the block (as rpf9-explorer's OpusPreview reads it). The final granule is trimmed to the declared sample count. Checked: 300 random streams decode with ffmpeg with no errors, lengths match the declared counts. XMA2 streams (codec 5, 1,818) are written as RIFF XMA2 files by `rpf9dump xma` (rpf9-explorer's `AwcRecovery.WriteXmaWave`) and decoded to PCM WAV by ffmpeg: all 1,818 decode. Streamed music (tag 0x48: chunks with a per-channel record table, each channel's 2048-byte subblocks after the aligned header, and a repeated-prefix skip per chunk) becomes one mono Ogg Opus per channel (3,008 banks contain music). Checked: a 4-channel music bank gives four 42.0 s channels with real levels and no decoder errors. Output: `<work>\assets\audio\ogg\<bank>\<stream id>.ogg`. **Done: 1,598,051 Opus streams + 3,116 music channels as Ogg Opus (22 GB), 19 PCM16 and 227 codec-2 streams (32-bit float PCM, 4 bytes per sample; values can exceed ±1) as WAV, 1,818 XMA2 as WAV. Every audio stream is converted; all WAVs decode.** | `<work>\assets\audio\awc\` | 94| Audio | `audio.rpf` holds raw (not zlib) **AWC** banks: Opus (codec 0x0B) and XMA2 streams. Exported as whole `.awc` files plus `audio_manifest.json` (stream ids, codec, channels, rate, duration). **Done: 7,162 banks, 27 GiB, 1,603,231 streams, about 1,324 hours** (codec 0x0B Opus 1,601,167; 5: 1,818; 2: 227; 0 PCM: 19). `tools/awc_opus.py` repackages every Opus stream **losslessly** into a standard Ogg Opus file (no re-encode; PCM streams become .wav). The AWC framing is 2048-byte blocks of [u16 length][packet], with a zero length padding the block (as rpf9-explorer's OpusPreview reads it). The final granule is trimmed to the declared sample count. Checked: 300 random streams decode with ffmpeg with no errors, lengths match the declared counts. XMA2 streams (codec 5, 1,818) are written as RIFF XMA2 files by `rpf9dump xma` (rpf9-explorer's `AwcRecovery.WriteXmaWave`) and decoded to PCM WAV by ffmpeg: all 1,818 decode. Streamed music (tag 0x48: chunks with a per-channel record table, each channel's 2048-byte subblocks after the aligned header, and a repeated-prefix skip per chunk) becomes one mono Ogg Opus per channel (3,008 banks contain music). Checked: a 4-channel music bank gives four 42.0 s channels with real levels and no decoder errors. Output: `<work>\assets\audio\ogg\<bank>\<stream id>.ogg`. **Done: 1,598,051 Opus streams + 3,116 music channels as Ogg Opus (22 GB), 19 PCM16 and 227 codec-2 streams (32-bit float PCM, 4 bytes per sample; values can exceed ±1) as WAV, 1,818 XMA2 as WAV. Every audio stream is converted; all WAVs decode.** | `<work>\assets\audio\awc\` |
95 95
96### rpf9dump (bulk export) 96### rpf9dump (bulk export)
diff --git a/docs/textures.md b/docs/textures.md
new file mode 100644
index 000000000..7ed20c0ae
--- /dev/null
+++ b/docs/textures.md
@@ -0,0 +1,289 @@
1# Textures: the BCPack gap
2
3Measured on 2026-11-21 from one retail Xbox Series install (1.0.2.1). The corpus is all 57
4RDS5 texture pools: 46 under `data/ttdb/**` and 11 under `pack/<name>/data/ttdb/**`, 57.94 GiB
5of files. Nothing below reproduces game data; every number is an aggregate or a descriptor
6field.
7
8## Outcome
9
10| | Textures |
11|---|---:|
12| catalog entries | 357,115 |
13| exported with the complete source mip chain | 98,603 |
14| exported with fewer mips | 210,292 |
15| exported at least one mip | 308,895 |
16| skipped | 48,220 |
17
18**Bottom line:** the gap is measurable and the codec mapping is certain, but BCPack itself is
19not decodable from public facts. No decoder is added; the next tractable work is the compact
20packed tail, not BCPack.
21
22This is the same 308,895 / 48,220 total already recorded in `docs/design.md`. The recount
23splits the 48,220 by cause: the old "(BCPack or unmapped)" label hides 14,713 skips whose
24recorded limitation is a layout/format check, not the codec, and overstates unmapped, which
25is zero.
26
27## Skip breakdown
28
29| Cause | Textures |
30|---|---:|
31| BCPack blocks every usable mip (`TtpfReader`: "All source mips require…") | 33,507 |
32| compact mip mapping not in the validated profile table | 14,030 |
33| 2D array / volume descriptor (`dimension != 1` or `depth != 1`) | 678 |
34| element format not in the parser table (DXGI 11, `R16G16B16A16_UNORM`) | 5 |
35| no mapped allocation ("unmapped shard") | 0 |
36| **total** | **48,220** |
37
38The compact row is not one thing:
39
40- 13,979 of the 14,030 carry the descriptor's auxiliary-mapping bits. 13,954 of those are
41 mode 4 or 6; the other 25 are modes 5, 7, 36 and 38. The other 51 compact records are modes
42 1, 32 or 34 without the aux flag.
43- 11,570 of the 14,030 have no BCPack chunk anywhere. They fail because
44 `ValidatedCompactProfile` has no entry for their
45 `(mode, width, height, mips, nonTail, bytes)` tuple, not because of a codec.
46- 19 compact records could not be mapped to a layout for the storage cross-tab. They are
47 included in the 14,030 and also fail the profile table.
48
49The five format-11 records are 4×4, 8×4 or 128×4 `R16G16B16A16_UNORM`; the parser's
50element-size table has no 8-byte entry for format 11. The 678 array/volume records are
51non-2D descriptors (arrays or volumes), which the reader deliberately rejects until it has a
52validated slice layout.
53
54## The BCPack footprint
55
56The skip count is only the fully blocked textures. Counting mip 0 and the lower mips
57independently of the parser's profile checks gives the full footprint:
58
59| mip 0 | lower mips | Textures |
60|---|---|---:|
61| zlib/raw | zlib/raw | 305,264 |
62| BCPack | at least one zlib/raw | 14,935 |
63| zlib/raw | at least one BCPack | 9,999 |
64| BCPack | every mip BCPack | 26,215 |
65| no usable layout | — | 702 |
66| **total** | | **357,115** |
67
68- **41,150 textures have BCPack in mip 0** (26,215 + 14,935).
69- **26,215 have no zlib/raw mip at all**, so they cannot export anything.
70- 5,845 export from a lower mip because mip 0 is BCPack (`BaseMipLevel > 0`).
71- 9,090 of the 14,935 are still skipped: 8,515 because no usable mip is entirely zlib/raw
72 (the zlib block is mixed with BCPack or outside the usable range), 575 because the compact
73 profile is not validated.
74- 9,356 export the top mip but stop before at least one BCPack lower mip; 643 more are
75 skipped for the compact profile before an export can happen.
76
77Cross-tabulated against the skip table:
78
79| Parser cause | all zlib | mip 0 zlib, lower BCPack | mip 0 BCPack, lower zlib | all BCPack | no layout | total |
80|---|---:|---:|---:|---:|---:|---:|
81| BCPack | 0 | 0 | 8,515 | 24,992 | 0 | 33,507 |
82| compact profile | 11,570 | 643 | 575 | 1,223 | 19 | 14,030 |
83| array/volume | 0 | 0 | 0 | 0 | 678 | 678 |
84| format 11 | 0 | 0 | 0 | 0 | 5 | 5 |
85| **total** | **11,570** | **643** | **9,090** | **26,215** | **702** | **48,220** |
86
87The partial exports are a separate gap. Of the 210,292:
88
89| Partial reason | Textures |
90|---|---:|
91| compact profile, standalone mips exported, packed tail missing | 196,257 |
92| lower mips BCPack | 8,052 |
93| catalog top-only record | 314 |
94| other (lower-mip export, mixed ranges) | 5,669 |
95| **total** | **210,292** |
96
97The packed-tail gap affects more textures than the BCPack skip count (196,257 partial
98exports vs 33,507 skips), but it loses only the small mips. It is also not a BCPack problem:
99196,257 textures stop at the last standalone mip because `UsableMipLimit = NonTailMipCount`
100for compact profiles, regardless of codec.
101
102## What BCPack is
103
104BCPack is the Xbox Series hardware decompression codec for BCn texture data. The public GDK
105enum exposes seven modes, one per BCn format (BC1–BC7); DirectStorage applies it after DEFLATE
106and before the optional swizzle. It is not a replacement for BCn: it is an entropy-coded
107preconditioner whose output is a standard BCn block stream. That is why a BCPack chunk has a
108BCn codec id, not a separate texture format, and why the container can mix zlib and BCPack
109chunks inside one texture.
110
111## What the container says
112
113The RDS5 index is readable without game code:
114
115| Field | Value |
116|---|---|
117| magic | `RDS5` at 0x00 |
118| virtual size | 56 bits at 0x08; top byte 0x16 |
119| entry count | u32 at 0x04; `chunks = count − 2`, and the table's last entry is the sentinel |
120| chunk table | 0x18, 8 bytes per entry, `(count − 1) * 8` bytes |
121| ETPF index | `align(0x18 + (count − 1) * 8, 0x100)`; version 634 (`0x27A`) |
122| texture records | a 16-byte ETPF header, then `area` bytes of records (at least 16 × textures) |
123| asset keys | one u64 per record after the descriptor array; IDs are 32 bytes each |
124
125Chunk entry `(u64 value)`:
126
127| Field | Bits | Meaning |
128|---|---:|---|
129| physical offset | 0–25 | × 256; 256-byte aligned |
130| codec | 26–29 | 0 raw, 1–7 BCPack BC1–BC7, 8 zlib |
131| virtual offset | 30–51 | × 4096; 4 KiB aligned |
132| padding | 52–63 | 12-bit byte count at the end of the physical range |
133
134The parser reads 357,115 texture records and 1,026,833 chunks from the 57 pools with no
135exceptions. The chunk table's offsets are 256-byte aligned (physical) and 4 KiB aligned
136(virtual), and the virtual ranges cover every allocation the parser could lay out. The
13712-bit padding on BCPack chunks is zero-filled (see the header section).
138
139### Codec ids are the BCPack mode
140
141The on-disk codec ids are `0x04, 0x0C, 0x10, 0x14, 0x18, 0x1C, 0x20`; shifting right by 26
142normalizes them to 1, 3, 4, 5, 6, 7, 8. Across **1,026,833 chunks there is not one
143format/codec mismatch**:
144
145| codec | BCn mode | DXGI formats seen | Chunks | Packed MiB | Decoded MiB | Saving |
146|---:|---|---|---:|---:|---:|---:|
147| 0 | raw | 83, 98, 99 | 5 | 0.1 | 0.1 | 0.0% |
148| 1 | BC1 | 71, 72 | 102,725 | 10,637.9 | 14,630.9 | 27.3% |
149| 2 | BC2 | — | 0 | — | — | — |
150| 3 | BC3 | 77, 78 | 35 | 7.4 | 10.1 | 26.3% |
151| 4 | BC4 | 80 | 77 | 1.4 | 1.5 | 6.2% |
152| 5 | BC5 | 83 | 333 | 60.6 | 74.6 | 18.8% |
153| 6 | BC6H | 95, 96 | 268 | 67.8 | 79.1 | 14.2% |
154| 7 | BC7 | 98, 99 | 5,167 | 1,097.3 | 1,221.5 | 10.2% |
155| 8 | zlib (RFC 1950) | all | 918,223 | 47,179.3 | 128,529.3 | 63.3% |
156| **total** | | | **1,026,833** | **59,051.8** | **144,547.1** | **59.1%** |
157
158BCPack is 11.6 GiB of the 57.7 GiB chunk payload (20.1%), and BC1 is 10.4 GiB of that
159(89.6%). The saving column is `1 − Σ packed / Σ decoded`; it includes tile padding, so it is
160not the codec's saving on block data alone.
161
162This mapping is the strongest evidence that the codec field is the GDK's
163`DSTORAGE_BCPACK_MODE` (1 = BC1 … 7 = BC7), not a generic compression id. The field is per
164chunk, so a texture can mix zlib and BCPack mips; 15,201 partial exports do.
165
166### The descriptor `mode` is tiling, not codec
167
168The ETPF descriptor's `mode` field (`b >> 23`) is the mip/tile family: mode 0 uses 64 KiB
169blocks (`SW_64KB_D`), every other observed mode uses 4 KiB blocks (`SW_4KB_S`). It is
170independent of the chunk codec. Formats 71/72 use 8-byte BC1 blocks, 74/75/77/78/83/84/95/96/
17198/99 use 16-byte blocks, and 80/81 use 8-byte BC4 blocks. No BC2 (codec 2) texture exists in
172this install.
173
174## The chunk header
175
176A BCPack chunk is not a self-describing container. A 256-byte dump of the first chunk of
177each of the three entries below contains no magic, version, total length or format at offset
1780. The only readable structure is the lane record area:
179
180- The independent SixNG notes describe the first 48 bytes as eight lane records,
181 column-interleaved: one byte per lane per round, six rounds. The byte-1 regularity below is
182 consistent with that layout.
183- The rest is entropy-coded lane data (rANS renormalization and prefetch in the SixNG
184 description). Entropy on 300 sampled chunks per codec is 7.96–7.99 bits/byte. No
185 general-purpose wrapper was found in the sampled chunks; zlib, gzip, bzip2 and LZMA reject
186 the first bytes, and raw-deflate attempts on random data are not a valid stream.
187- Padding is zero-filled: every padding run starts with zero bytes (checked `min(16, pad)`
188 bytes of all 108,229 padded BCPack chunks: 102,368 BC1, 35 BC3, 76 BC4, 332 BC5, 268 BC6H,
189 5,150 BC7). That is how the physical ranges reach the next 256-byte boundary.
190
191Three skipped entries, with the fields the container actually exposes:
192
193| Pool / index | Descriptor | Allocation | Chunks |
194|---|---|---:|---|
195| `graphics/ttdb_graphics.ttpf` #309 | 128×128 BC1_UNORM, 8 mips, mode 2 (4 KiB) | 12,288 B | 1 × codec 1: packed 7,648, pad 544 |
196| `ui/ttdb_ui.ttpf` #0 | 512×512 BC1_UNORM, 1 mip, mode 0 (64 KiB) | 131,072 B | 1 × codec 1: packed 87,933, pad 899 |
197| `terrain/ttdb_terrain_0_7.ttpf` #1537 | 512×1024 BC7_UNORM, 8 mips, mode 4 (4 KiB) | 700,416 B | 4 × codec 7; top chunk packed 499,734 of 524,288, pad 234 |
198
199The first two bytes of those payloads are lane 0 and lane 1 modes: `0x1f 0xde`,
200`0x35 0xde`, and `0x30 0x30`. The full-corpus counts are the useful part:
201
202| Codec | Chunks | Byte 1 value | Count |
203|---|---:|---|---:|
204| 1 (BC1) | 102,725 | `0xde` | 102,725 / 102,725 |
205| 3 (BC3) | 35 | `0xdb` | 35 / 35 |
206| 4 (BC4) | 77 | `0xde` | 77 / 77 |
207| 5 (BC5) | 333 | `0xdb` | 333 / 333 |
208| 6 (BC6H) | 268 | `0x30`–`0x36` | 268 / 268 |
209| 7 (BC7) | 5,167 | `0x30`–`0x33` | 4,978 / 5,167 |
210
211The byte-1 value is constant within a codec (BC1/BC4 use `0xde`, BC3/BC5 use `0xdb`), and it
212is the only fixed-offset value found. Byte 0 is often `0x30`–`0x37` on BC1, but the rest
213includes `0x14`–`0x1f`, `0x5f` and `0xde`, so it is not a magic. BC6H uses only `0x30`–`0x36`;
214BC7 has no constant byte 1 and its remaining 189 records use `0xdb`, `0x1c`–`0x1e` and
215similar lane modes. The 256-byte dumps are not committed because they are game bytes; the
216table above and the container descriptors are the readable facts.
217
218## Public sources and licences
219
220| Source | Facts used | Licence / use |
221|---|---|---|
222| [DSTORAGE_BCPACK_MODE](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/dstorage/enums/dstorage_bcpack_mode) | Modes 1–7 are BC1, BC2, BC3, BC4, BC5, BC6H, BC7; Xbox Series only | [Microsoft Learn Terms of Use](https://learn.microsoft.com/en-us/legal/termsofuse): informational, personal/non-commercial use; linked and paraphrased, no text or code copied |
223| [DirectStorage overview](https://learn.microsoft.com/en-us/gaming/gdk/docs/features/console/storage/directstorage/directstorage-overview) | BCPack is a custom entropy coder for BCn data; colour endpoints are separated from palette indices and coded with rANS; decompression order is DEFLATE, BCPack, swizzle | Same Microsoft Learn terms; linked and paraphrased |
224| [SixNG, `formats/06-bcpack.md`](https://github.com/walkthestars/GTA6-Asset-Info/blob/main/formats/06-bcpack.md) | Independent notes: 0% decoded, no public specification or decoder, lane/header observations, open unknowns | [GPL-3.0](https://github.com/walkthestars/GTA6-Asset-Info/blob/main/LICENSE); notes only, no code copied |
225| [SixNG, `formats/05-ttpf.md`](https://github.com/walkthestars/GTA6-Asset-Info/blob/main/formats/05-ttpf.md) | Independent codec-id table and pool structure | GPL-3.0; notes only |
226| [rpf9-explorer](https://github.com/breadbbbb/rpf9-explorer) | The `TtpfReader` catalog checks and limitation strings measured here | [MIT](https://github.com/breadbbbb/rpf9-explorer/blob/main/README.md) |
227| [GitHub repository search `bcpack`](https://github.com/search?q=bcpack&type=repositories) | No BCPack decoder; the only GTA VI result is the GPL-3.0 notes above | Search on 2026-11-21 |
228
229Microsoft's documentation gives the algorithm class and the mode enum, not the bitstream.
230The public enum is documented for Xbox Series consoles; this note does not cover an Xbox One
231variant. No public bitstream specification and no open-source BCPack decoder were found: the
232SixNG notes are documentation, and the only open code found for this format is the container
233parser (`rpf9-explorer`, MIT). The SixNG notes reach the same conclusion from the data: the
234rANS coder and stream layout are partly mapped, there is no decoder, and BC1 is the only mode
235studied beyond its headers.
236
237## Why there is no decoder in this change
238
239A clean-room decoder needs a published bitstream description or a reference implementation
240under a compatible licence. Neither was found publicly. The public facts stop well short of a
241block decoder:
242
2431. **Models.** The rANS frequency tables for the endpoint planes and the adaptive models for
244 the index lanes are not published. Without them the symbol stream cannot be decoded.
2452. **Record layout.** Varying plane and extension lanes have no understood byte-length field;
246 the constant lanes do, but they are only the easy case.
2473. **Lane semantics.** What lane 0 codes, how the four index lanes map to 2-bit indices, and
248 how extension lanes are ordered are unknown.
2494. **Block order and timing.** Whether blocks are linear or swizzled, and exactly when a lane
250 reads versus decodes within a round, are not settled.
2515. **Modes.** Public notes only studied BC1; BC4, BC5 and BC7 streams are unstudied beyond
252 their headers.
253
254The payload is **not** a documented BC7 or BC6H variant. BCPack decompresses *to* standard
255BC1–BC7 blocks; the compressed stream is a separate entropy-coded representation. A decoder
256built from synthetic blocks would test our guesses, not the format.
257
258The console-side decompressor is hardware; the GDK implementation is not public source and
259is not usable in a GPL-3.0 program. This change does not link it, copy it or work around it.
260No DRM, key or protection work was done; only already-plain chunk bytes were read.
261
262**What is missing, in one line:** the rANS models, the varying/extension lane record
263layouts, lane-0/index-lane semantics, block order, and the BC4/5/6H/7 streams. The container
264and the algorithm class are known; the bitstream is not.
265
266## Next step
267
2681. **Do not fake a BCPack decoder.** The current fallback (export the largest lower mip that
269 is zlib/raw) is used by 5,845 textures and should stay.
2702. **Fix the compact packed tail first.** 196,257 of the 210,292 partial exports stop at
271 `NonTailMipCount`; the tail layout is documented (SixNG §5) and needs no BCPack decoder.
272 This is the largest tractable texture gap.
2733. **Then the small independent gaps:** 678 array/volume layouts and 5 DXGI 11 textures.
274 Neither needs BCPack.
2754. **If a public decoder or bitstream spec appears under a compatible licence,** add it behind
276 `TtpfReader.DecodeChunk`; the container already carries the mode (codec id) and decoded
277 size, so no index work is needed.
2785. **If someone resumes the reverse engineering,** use the hard check the SixNG notes propose:
279 every lane must consume exactly its byte budget and finish at the rANS lower bound, with a
280 fixed symbol count. Reference blocks are the missing input; none are public.
281
282## Reproduce
283
284`rpf9dump ttpf` writes one `manifest.json` per pool with a `Limitation` field for every
285catalog record, and its summary line has the same `ok` / `skip` totals. The split above comes
286from a read-only mirror of `TtpfReader`'s catalog checks: it mmaps each pool and reads only
287the 24-byte RDS5 header, the chunk table, the ETPF records and the chunk ranges. It writes no
288texture data. The mirror is not committed because it duplicates `TtpfReader`; the counts are
289the evidence.