Step 2d of docs/world-format-eu07.md (#516). With world.binary 1 in eu07.ini (off by default; then nothing is
written and nothing changes) the loader looks for <scenery>.logic.eu07 in the folder of the sceneries:
- current: made by this build (GIT_HASH and SRC_DATE), from the files the tape names as they are now (names,
sizes, times of the last change) and with the same load settings (traction loaded, the binary terrain file
standing in for the terrain includes, the text put ahead of the scenery, the trainset overrides): the
scenery is replayed from the tape through the same parsers, with no file opened and no include expanded;
- not there or not current: the scenery is read from its files as before, the parser records its tape, and
the cache is written once the scenery is loaded, through a temporary file. The log says which of the two.
Never in the editor, which keeps track of the files of the nodes, nor for a Rainsted override ($.scn).
The cache file gains package blocks, data of the whole package rather than of a tile; the tape goes into them
in parts of at most 64 MB until the logic is split into regions (step 3). The SBT check moved ahead of the
parser, unchanged, as the cache depends on it.
Not checked yet in the game: that a run from the replayed scenery gives the same physicslog bit for bit.
Tests: the cache file name, FNV-1a, package blocks written and read back, and the logic cache read back while
current and refused for another build, other settings or a changed included file.
Step 2a of docs/world-format-eu07.md (#516, section 7): the container of the cache, one file per package and
layer. A header (magic and type as EU07_FILEHEADER, the versions, the body, package, layer, tile level, count
of levels of detail, and the engine and source hashes), a table of sections, the name table, a directory of
40-byte entries sorted by tile id and level of detail, and the tile blocks at multiples of 4 KB, packed with
zstd in frames of 64 KB and checked by a CRC-32. A block unpacks to tagged chunks; a reader skips what it
doesn't know, a section of a newer minor version included. Everything is little-endian and read field by
field. The writer gives the same bytes for the same contents. Nothing in the game uses it yet.
Tests: the CRC against zlib's value, a file written and read back (header, names, directory, every block),
a large block in frames, the same bytes twice, what the writer refuses, and broken files: another type or
major version, cut short, a block not matching its CRC; a newer minor version still opens.