Skip to content

Latest commit

 

History

History
191 lines (152 loc) · 7.24 KB

File metadata and controls

191 lines (152 loc) · 7.24 KB

Real-time files

Eleven of the eighteen root entries carry file number 1 — three BOLT libraries and eight streams. Between them they are 96.5 % of the image.

Read them by sector, not through the directory record. Every one is Form 2, 2,324 bytes of payload, and every directory size is a Form 1 fiction:

file sectors true payload directory says padding
boltlib0.blt 3,446 8,008,504 7,057,408 0.0 %
boltlib1.blt 3,446 8,008,504 7,057,408 0.0 %
boltlib2.blt 3,446 8,008,504 7,057,408 0.0 %
fordir.rtf 5,958 13,846,392 12,201,984 62.4 %
cavdir.rtf 11,009 25,584,916 22,546,432 60.6 %
labdir.rtf 9,952 23,128,448 20,381,696 63.5 %
anims.rtf 58,515 135,988,860 119,838,720 42.1 %
forest.rtf 1,909 4,436,516 3,909,632 44.9 %
labrat.rtf 4,539 10,548,636 9,295,872 52.7 %
cavern.rtf 9,210 21,404,040 18,862,080 47.9 %
help.rtf 15,569 36,182,356 31,885,312 8.9 %

39.7 % of every real-time sector carries nothing — 50,416 sectors, 117 MB, 38.3 % of the whole image. That is the cost of streaming at exactly 1×: unused bandwidth cannot be banked, so it becomes empty sectors. Link spent 49.6 % the same way; Origami 26.7 %.

The odd one out is help.rtf at 8.9 %, and that is not an accident. It is the only file on the disc that runs every one of its channels at full rate all the way through — see 07-audio.md.

Channel plan

python tools/cdirtf.py census

The eight streaming files use four channel numbers and no more:

channel carries
0 bit-rate padding, with no type bits set
15 the video stream, and the soundtrack beside it
16 BOLT data, in short bursts of 2–6 sectors
31 a one-sector descriptor that opens each animation

help.rtf is the exception and uses channels 8–15 for eight parallel audio streams. The .blt libraries are entirely channel 16, one record, one EOF.

A representative file, fordir.rtf:

ch  0  pad     3718 sectors   62.4 %
ch 15  VIDEO   1480 sectors   24.8 %
ch 15  AUDIO    714 sectors   12.0 %
ch 16  VIDEO     40 sectors    0.7 %
ch 31  VIDEO      6 sectors    0.1 %

The audio share is 12.0 % on all three *dir.rtf files and 10.6–11.5 % on the three level files — one audio sector in eight, which is exactly one Level B mono channel's worth. The soundtrack rides alongside the picture on the same channel number and is separated by the submode bits, not by the channel.

Channel 16's presence in fordir, cavdir, labdir and anims and its absence from forest, labrat and cavern is the clearest structural split on the disc. The four files that stream BOLT data are the four that draw menus and interfaces; the three that do not are the three puzzle levels, which have their assets in the library already.

tcanim.toc — the animation directory

472 bytes, and every one of them is accounted for.

python tools/cditoc.py list
python tools/cditoc.py check
0    u8   1     version
1    u8   7     number of real-time files
2    u8   0
3    u8   89    number of animations
4    89 records of 4 bytes:
       u8   file index into the name table
       u8   8   constant on all 89
       u16  sector offset within that file
360  7 name slots of 16 bytes, NUL-padded:
       anims fordir labdir cavdir forest labrat cavern

4 + 89×4 + 7×16 = 472. Exact.

The claim, and the proof

Every record's sector offset should land on a channel-31 sector carrying EOR — the one-sector descriptor that opens an animation.

python tools/cditoc.py check
89 of 89 entries land on a channel-31 EOR sector

Eighty-nine out of eighty-nine. And the count per file matches the number of channel-31 EOR sectors in that file, independently measured:

file TOC entries channel-31 EOR sectors
anims 15 15
fordir 6 6
labdir 9 9
cavdir 12 12
forest 9 9
labrat 16 16
cavern 22 22
89 89

So the disc holds 89 addressable animations across seven files, and this 472-byte table is the whole index. Note that the seven filenames appear nowhere else — the executable does not contain the strings anims, forest, cavern, labrat, fordir, cavdir or labdir. They exist only here.

The Traffic Cop

The subsystem that reads this table is named in the executable's own error strings:

Traffic Cop Could Not Open Animation:%d
Traffic Cop Could Not play Animation:%d
Traffic Cop Could Not Close Animation:%d
Illegal Animation Definition:%d.  No Menubar should be allowed.

which resolves the TC_ prefix on 40 symbols: TC_TOC_Init, TC_TOC_Get_Anim, TC_Open_Animation, TC_Play_Animation, TC_Close_Animation, TC_Get_Animation_Parameter, TC_Set_Animation_Paramter (shipped misspelled), TC_Display_Update, TC_BufSeq_Init, TC_AnimEfx_Update, TC_MM_Alloc, TC_Lock, TC_Abort, TC_Set_DiscError. TC is Traffic Cop — the disc's own name for its streaming scheduler.

The channel-31 descriptor

One sector, Form 2, EOR set, at the head of each animation. The payload is about 50 non-zero bytes in the first 96 and zero thereafter:

0000  00 00 00 32 28 0f 0f 10 01 00 00 11 00 01 00 00
0010  00 01 00 1c 00 22 00 06 00 00 00 00 10 00 00 01
0020  00 00 00 00 ff 00 00 03 00 01 21 15 00 00 00 00
0030  ff 00 00 00 00 28 0a 01 03 14 00 00 00 01 08 00
0040  00 01 00 02 00 01 06 01 00 b4 00 2e 06 0c 00 03
0050  00 67 06 0d 00 01 ff ff 04 13 00 00 00 10 00 01

Byte 3 varies between descriptors (0x32, 0x2c, 0x2c …) and looks like a length; bytes 4–6 are 28 0f 0f on all of them. The ff ff pairs and the 04 13 00 00-style quads match the shape of the id-27 and id-31 records inside the BOLT library. This is an animation definition record and it is not fully decoded here — see 10-open-questions.md.

Video

Channel 15's video stream is compressed, and not by any of the codings the subheader admits to. Reassembled and measured:

autocorrelation at pitch 128/256/320/384/512/768/1152:  0.106 - 0.129
                                     random baseline:   ~0.11
bytes with bit 7 set:                                   43.6 %
maximum byte value:                                     255

No pitch peak at any candidate width, and bit 7 set on nearly half the bytes. Raw CLUT data of any depth autocorrelates at its line pitch; this does not. Testing it as MCD212 RL7 gives a line-end hit rate that climbs monotonically with the assumed width — 89 % at 240, 99 % at 768 — which is the signature of a test that is not discriminating rather than of a width that is right.

The likely reading is that these are BOLT-compressed frames, expanded by the same Decompress the library uses and drawn by DrawPic / RLEDrawPic, with Decompress still unidentified. The video-coding byte in the subheader is 0x00 throughout, which would nominally mean CLUT4 at normal resolution, and that is not what the data is — a reminder that the coding byte is authoritative only for streams the MCD212 decodes itself.

boltlib0.blt uses coding 0x02 for all 3,446 of its sectors and its content is a BOLT archive, which makes the point twice.