BIN (File Format)

From MK8
Jump to: navigation, search

BIN is a file format used in Mario Kart 8 to store binary lookup tables. They consist of several sections as defined in the file / main header, in which there are groups containing specific elements of data of a given type.

The format is similar to the one used in Mario Kart 7, though it strips a lot of textual data describing the entries of the groups, which makes giving meaning to the values of the elements harder, though many elements are simply evolved or even ported from Mario Kart 7.

They are used to lookup typical tabular data like the item probabilities at distances to the lead racer, the distances for this themselves, course information, audio information, controller mappings (possibly), kart body / tire / glider settings or engine statistics.


The files are stored in big endian. In the following, C# data types are used to describe the data.


Each BIN file starts with a main header which provides information about the available sections in the file.

Offset Size Type Description
0x00 4 char[4] File identifier. Takes the form of a 4 character long ASCII string acronym of the file's purpose.
0x04 4 int File size in bytes. Sometimes slightly off from the real file size, unclear why this is the case.
0x08 2 short Number of sections following the header.
0x0A 2 short Unknown value
0x0C 4 int Version number. Always seems to be 0x00001000.
0x10 4 * Number of sections int[numberOfSections] Offsets to the sections, relative to the end of the header.

This means that the first offset is always 0, as the first section always starts directly after the header.


Each section header at the offsets given in the main header describes the number of groups of data in the section, the number of elements in each group, and the type of the elements.

Offset Size Type Description
0x00 4 char[4] Section identifier. Takes the form of a 4 character long ASCII string acronym of the section's purpose.
0x04 2 short Element count. The number of elements in a group.
0x06 2 short Group count. The number of groups in the section.
0x08 4 int Type ID. Depending on this value, the format of the section data is different.

Groups are simply arrays of the given number of elements. Depending on the type ID provided in the section header, the format (and thus size) of the elements differs. The type IDs seem to be the same as the ones used in Mario Kart 7.

The start and end of each section is aligned by 4 bytes, which is important for those sections containing strings.

Integer / Float Array (ID 0x00000000)

The group elements are simply integer or float arrays of a specific length. The game code knows the length by switching on the section identifier (it can be assumed it directly reads those into structures holding only integer members). Without this knowledge, the length of the element arrays can still be computed with the following formula:

elementLength = sectionSizeWithoutHeader / (groupCount * elementCount) / sizeof(int)

Whether the type is of integer or float has to be determined by the programmer as the game also knows about this by code.

A group looks as follows:

Offset Size Type Description
0x00 4 * elementCount * elementLength int[elementCount][elementLength] or


Integer or float arrays.

String Array (ID 0x000000A0)

The group elements are an array of offsets pointing and followed by an array of 0-terminated strings. A group looks as follows:

Offset Size Type Description
0x00 4 * elementCount int[elementCount] String offsets, relative to the end of the last one. E.g., the first offset is always 0.
- - string[elementCount] Strings, 0-terminated, pointed to by the preceeding offsets.

Other Sections

There are several other types holding other values (most ending with a list of strings) which have not been covered yet here.


The following tools can operate on BIN files: