Jump to content

Tile map file: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 4: Line 4:
* An array of metatiles: Each metatile is 2x2 tiles in size. This serves as a compression mechanism.
* An array of metatiles: Each metatile is 2x2 tiles in size. This serves as a compression mechanism.
* An array of layers: Each tile map file may one or multiple different "layers". tile map files only contain a single layer, but menus can have one layer per page in the menu for example. All layers in a tile map file share the same tile set and metatile set.
* An array of layers: Each tile map file may one or multiple different "layers". tile map files only contain a single layer, but menus can have one layer per page in the menu for example. All layers in a tile map file share the same tile set and metatile set.
= Compression =
Most tile map files are stored LZ77 (<code>swi 0x11</code>) compressed. When loading a tile map file, the game checks if the file starts with the ASCII characters "MP" (hex: <code>0x4d, 0x50</code>). If it does, then the file is not compressed, and used by the game as-is. If it does not start with these characters, the game will LZ77 decompress it to EWRAM. Note that the first 4 bytes after decompression ''must be discarded'' (they will contain the uncompressed length of the file).


= File format =
= File format =