Entry 242
Overlays and DATA.BIN, their last unknowns
Documented in The DATA.BIN archive, The .PRG overlay.
Filesdocs/formats/prg.mddocs/formats/data-bin.md
Asked for: settle the docs' open questions, starting with the format
pages. docs/formats/prg.md and data-bin.md are now solid.
The overlays
overlay_idat run time. Nothing reads it.mwLoadOverlay(path, dest)reads only three header fields atdest:bss_size(+0x14) and the constructor table (+0x18, +0x1c).destcomes fromoverlay_tbl[slot - 1]inccThLoadOverlay, and every call passes slot 1 (0x00400800). No instruction in the executable or an overlay loads from 0x00400804.- Which file. The event instruction
overlay numis the only caller ofccLoadOverlay: 0DEMO, 1DESKTOP, 2TOPPAGE, 3GCMN. - Destructors. The static constructors register destructors on
__global_destructor_chainthrough__register_global_object, and nothing else reads the chain. There is no__destroy_global_chain, and_exitgoes straight to the kernel. So no destructor ever runs, when an overlay is replaced or at exit. The stale records of a replaced overlay are never walked.
Mutation, Outbreak and Quarantine load the same way (each through its own
overlay_tbl).
DATA.BIN
-
usize0.ccFileListLoad(0x00164ea8) wires its two threads by it:- a
usizeother than 0:FileReadThfills the compressed ring andUngzipThinflates into the ringccStreamreads; - 0:
FileReadThfillsccStream's ring itself, andUngzipThgets noccUngzipand never decodes.
So 0 means stored without compression.
- a
-
Category 19.
ccAddFileListgives a category-19 entryoffset0,csize-1 andusize0, indirectCCSTbl.ccFileListLoadopenscdrom0:\DATA\+ name, sizes it withsceLseek, and reads it raw. The two unknowns were one: ausizeof 0 is category 19's.No volume adds a category-19 entry:
- no
{19, name}pair in any executable or overlay (a scan of every word pair); - the lists built at run time take constant categories (7, 9, 11, 15 to 18);
- every store of the constant 19 was looked at, and none is a file list.
No disc has a loose
.CCSinDATA. - no
Nothing on these two pages. What category 19 was for is not in the code; it only shows that the game can load a scene file from outside the archive.