LFL (File Format)

From Custom Mario Kart
Jump to navigation Jump to search

LFL (LE-CODE File List) is a simple archive format developed by Wiimm. It is used as sub-archive for LTA files to manage common files.


LE-CODE supports track dependent versions of different files of Common.szs. To keep all track related files together, track authors are advised to place those files into the sub-directory ./Common/ of the track's SZS. See »LE-CODE/Track« for details.

The game loads the common files before it loads the track's SZS. So it is mandatory, to store the common files outside of the track files. And this is where the LFL file format comes into play. When creating a LTA file, each SZS file is checked to see whether it contains ./Common/* files. If so, then these are extracted and saved as an LFL file. The format of an LFL file is chosen so that LE-CODE can easily access it.


  • LFL is a chain of files. Each node contains metrics, the filename and the data. The end of the chain is a special termination node.
  • LE-CODE can easily iterate through the chain.
  • Because of the small size of common files, the data is not compressed. This makes accessing easier.
  • LFL files are created automatically when generating LTA files.
  • When comparing file names, capitalization is ignored. Therefore, all file names are converted to lowercase letters. The files themselves are sorted alphabetically. This makes it easier to recognize identical LFL files.
  • The leading ./ and a leading common/ are removed from the file names. For example, file name ./common/ObjFlow.bin becomes objflow.bin.
  • The entire LFL file is aligned to 32 bytes within the LTA and is loaded in one step. The data within an LFL file is aligned to 4 bytes.

File Format

All integer values are stored in network byte order (big endian).

File Header

File header of LFL files
Offset Name Type Description
0x00 magic char[4] File magic, always »L-FL«
0x04 version uint32 Major version number, 1 at the moment.
0x08 file_size uint32 Total size of this LFL file. Aligned to 4 bytes.
0x0c End of file header and begin of chain list

Nodes (chain list)

The chain begins at file offset 0x0c direct behind the file header. All offsets within a node are relative to the node itself. So each node can be used isolated. A node with data_size=0 is the termination node and ends the chain.

File header of LFL files
Offset Name Type Description
0x00 data_offset char[4] Offset of data. Relative to start of node. Aligned to 4 bytes.
0x04 data_size uint32 Size of data. Value 0 ends the chain.
0x08 offset_to_next uint32 Offset to next node. Aligned to 4 bytes.
0x0c file_name char[*] File name. Lower case. Leading ./ and common/ removed.
? data binary Data of file. Aligned to 4 bytes.

Manage LFL files

As of version 2.37a of Wiimms SZS Tools, the LFL file format is supported. If creating an LTA file, LFL files crated automatically if common files are available.

Other commands: Command wszst filetype detects LTA files. Command wszst list (including all list variants) lists the content of LTA files. Command wszst extract extracts all included files. wszst create --lfl creates a LFL file.