Parse the level core class tables: moby, tie and shrub
These were ruled out for want of an entry size. The size is knowable exactly, because each table ends precisely where the next begins: moby 238 entries at 192, 32 bytes: 192 + 238*32 = 7808 = tie's tie 74 entries at 7808, 32 bytes: 7808 + 74*32 = 10176 = shrub's shrub 7 entries at 10176, 48 bytes: 10176 + 7*48 = 10512 = textures That closes on 27 of 27 levels, which is what makes it evidence rather than a coincidence: any wrong entry size breaks the chain immediately. It is the same "does this hold on every level" discriminator the project already uses for the container pair table. Across the disc: 5,796 moby, 1,864 tie and 358 shrub classes, plus the 1,595 tfrag textures. Class entries are 32 bytes -- asset offset, class number, two unknown words and 16 bytes of texture slots -- and a shrub entry adds 16 bytes of billboard slots for 48. The header now decodes through to the texture tables rather than skipping 0x18..0x30 wholesale, which also recovers the moby, tie and shrub texture ranges. Two more pairs sit between shrub textures and the textures base offset. Two things worth recording. ClassEntry::parse read its 16 texture bytes before its four i32s, because the struct literal that uses them comes after the loop that advances the cursor -- so every entry was parsed backwards. Struct literal field order does not reorder the reads that already happened. And every shrub class on level 0 carries all-zero billboard slots, so the dimensions are optional rather than something worth asserting on. This is the third instance of the same failure shape. The gameplay extent was "an unidentified compression" because it was parsed compressed; the tfrag record framing was "unrecoverable" because the entry size was never known. Both looked like properties of the format and were properties of the question. Also records that point lights are a runtime feature rather than missing work: every one of the 18,102 patches has point_lights == 0xffff and the eight-slot bank is filled by gameplay, so there is nothing for them to light in a static level render. And that PCSX2 is not installed, so the comparison loop cannot be built yet -- which is why lighting magnitudes stay unverified.
This commit is contained in:
+6
-8
@@ -142,14 +142,12 @@ Phase 1 hands over the extents; this phase works out what each one contains.
|
||||
|
||||
- [x] `data` — the extent header locates `core_index` and `core_data`; the
|
||||
geometry decompresses and is verified on level 0.
|
||||
- [ ] `core_index` class tables — the header base is confirmed (the compressed
|
||||
and decompressed sizes of `core_data` sit at the same offsets in all 27
|
||||
levels), and every offset lands inside `core_data`. But the class-table
|
||||
fields do not decode under any field order or stride tried. Ruled out and
|
||||
written up in `plan/level-assets.md`. Identifying `tfrag` by its own
|
||||
structure instead, which is what the note suggested, worked: tfrag,
|
||||
texture and lighting data are all parsed. The class tables themselves
|
||||
remain unread.
|
||||
- [x] `core_index` class tables — moby, tie and shrub. They were ruled out
|
||||
for want of an entry size, which is knowable exactly: each table ends
|
||||
precisely where the next begins, and that chain closes on 27 of 27
|
||||
levels. 32 bytes per moby/tie entry, 48 per shrub. Across the disc:
|
||||
**5,796 moby, 1,864 tie, 358 shrub classes**. Identifying `tfrag` by its
|
||||
own structure is what led here.
|
||||
- [x] `occlusion` and `sky` offsets located and their first bytes read.
|
||||
- [x] Region layout of `core_data` established: tfrag, occlusion, sky, collision
|
||||
and `textures_base` are offsets, strictly increasing on all 27 levels.
|
||||
|
||||
Reference in New Issue
Block a user