Skip to content

Data layer: location maps, metatiles, exits and treasures in readable form - #131

Merged
ThisIsAkill merged 3 commits into
mainfrom
data-maps
Oct 30, 2026
Merged

ThisIsAkill merged 3 commits into
mainfrom
data-maps

Conversation

@ThisIsAkill

@ThisIsAkill ThisIsAkill commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Rebuilds the location map data from readable text (tools/maps.py). Verify counts it in a new maps category (555,262 B), never as source.

Only packs a location record names are converted.

  • maps.derive_named reads the 512 LocRom records: MapProps as 16 bits, and Tileset12/Tileset3 with $FF (LocRom_SetNone) naming nothing.
  • check() asserts that the named set equals the converted set, as graphics.derive_packed does.
  • Six packs no location names stay as packed bytes: Map_PropsPtrs 10, 30, 141 and 172, LocGfx_Meta12Ptrs 54 and LocGfx_Meta3Ptrs 3.

Location maps: 197 Map_PropsPtrs packs (380,613 B packed, 995,296 B unpacked).

  • Proof. LocLoad_UnkA33B reads the six-byte MapProps header. Map_UnpackTilePlanes then reads:
    • layers 1 and 2, sized from Size1;
    • layer 3, when Size3 bit 7 is set;
    • three attribute bytes per layer-1 tile, as single entries or runs.
  • Form. One hex grid per layer, plus a grid of attribute triples.
  • Runs. Every map writes its runs the same way (every repeat of two or more, up to 256). The assembler rebuilds them from the grid, and extraction refuses any map written another way.
  • Short streams. A few maps' streams end before the attribute plane is full. The game reads whatever follows in WRAM there, and the text marks those cells --------.

Metatiles: 71 whole-table packs (174,649 B packed, 253,952 B unpacked).

  • Proof. Map_WriteRow1 and the other writers send each metatile's four words unchanged to the BG tilemaps, so they are SNES tilemap words.
  • Form. Each word as TTT/P with its p, h and v flags.

Exits and treasures are records:

  • ExitRom: 814 × 7 B.
  • TreasureRom: 249 × 4 B, with Tile and Contents read 16-bit by Field_CheckTileInFront.
  • Both counts come from the end entries of their offset tables.

Kept as bytes:

  • the six unnamed packs above;
  • the ten 1-byte Meta12 packs;
  • two entries that aren't valid packs ($F5:EE02 and $EF:B168);
  • the scene layer packs, which come next.

Tests. tools/test_maps.py runs in make test-tools and in the no-ROM CI job. All 22 refusals and the named-set check have a test that fails without them.

Merge with main. Main is merged in, including #130. Every gate passes with CHRONORET_REQUIRE_STRACE=1. The whole ROM is still accounted for (MATCH, VERIFIED).

An independent audit found it sound. Its one finding, the unnamed packs, is fixed here.

…records

- tools/maps.py: the 201 Map_PropsPtrs packs (mapprops pieces) as text: the
  MapProps header, a hex grid per layer plane and a grid of the
  attribute triples, as LocLoad_UnkA33B and Map_UnpackTilePlanes read
  them; the assembler re-makes the runs (every repeat of two or more, up
  to 256, as all maps are written) and refuses what the reader would not
  read. Five maps whose stream ends early mark the cells the game takes
  from WRAM. The 73 whole-table metatile packs (LocGfx_Meta12Ptrs /
  Meta3Ptrs, metatiles pieces) as four SNES tilemap words per metatile,
  which the row and column writers send unchanged to the BG tilemaps.
  The build assembles both to build/maps/ and packs them back
  byte-exact; verify counts them as "maps".
- ExitRom (814 x 7 B) and TreasureRom (249 x 4 B) become records, their
  counts from their offset tables' end entries.
- tools/test_maps.py: round trips, every refusal (22 of 22 fail without
  their check), the manifest's pieces; in make test-tools and the no-ROM
  CI job.
- tools/maps.py: derive_named reads the 512 LocRom records' MapProps,
  Tileset12 and Tileset3 ($FF names none) and check() compares the packs
  they name with the manifest's mapprops and metatiles pieces, both ways,
  as graphics.derive_packed does for the packed graphics. The six whole
  packs no record names (Map_PropsPtrs 10, 30, 141, 172, LocGfx_Meta12Ptrs
  54, LocGfx_Meta3Ptrs 3; UNNAMED) stay plain packed pieces.
- maps: 197 maps and 71 metatile packs, 555,262 B (was 560,208); packed
  gains the 4,946 B; the whole ROM is still accounted for.
- tools/test_maps.py: derive_named and the comparison on a synthetic ROM
  and survey, and check() itself on a synthetic ROM, without the ROM;
  each new check fails a test without it.
@ThisIsAkill
ThisIsAkill marked this pull request as ready for review October 30, 2026 02:29
@ThisIsAkill
ThisIsAkill merged commit edcc805 into main Oct 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant