KMP (File Format)/Mario Kart 7
KMP files are used in Mario Kart 7. It contains information about how the course is played, such as start positions, check points and the CPU routes.
This article describes the Mario Kart 7 KMP format. For other formats, see KMP (File Format).
File Format
File Header
All KMP files starts with the following header:
Offset | Type | Description |
---|---|---|
0x00 | Char[4] | File magic. Always CDMD (Citra Dash Mapping Data) in LE. (DMDC) in ASCII. |
0x04 | UInt32 | Length of the file' in bytes. |
0x08 | UInt16 | N = Number of sections in the file. |
0x0A | UInt16 | Header size in bytes. |
0x0C | UInt32 | Version number of the file. The final game format uses 0xC1C. |
0x10 | UInt32[N] | N section offsets. The type of each section can be detected by analysing the first 4 bytes of the section. The offsets are relative to the end of this header. |
Section Header
Every section starts with this section header. The section header is a 0x08 byte structure as follows:
Offset | Type | Description |
---|---|---|
0x00 | Char[4] | The section name in ASCII. |
0x04 | UInt16 | Number of entries. |
0x06 | UInt16 | Additional value. The POTI section stores the total number of points of all routes. The CAME section stores 0xFFFF. All other values 0x0000. |
TPTK
The TPTK (kart point) section describes kart points; the starting positions of racers. Each entry is a 0x1A byte structure as follows:
Offset | Type | Description |
---|---|---|
0x00 | Float[3] | A 3D position vector of the start position. |
0x0C | Float[3] | A 3D rotation vector of the start position. |
0x18 | UInt16 | Player index. |
0x1A | UInt16 | Padding? |
This section is only used in battle tracks. The start point is written as an object in the JBOG section in the regular tracks.
TPNE
The TPNE (enemy point) section describes enemy points; the routes of CPU racers. The CPU racers attempt to follow the path described by each group of points (as determined by HPNE). Each entry is a 0x18 byte structure as follows:
Offset | Type | Description |
---|---|---|
0x00 | Float[3] | A 3D position vector of the enemy position. |
0x0C | Float | This value controls, how much the enemies leave the direct point-to-point line to the left and right side. |
0x10 | UInt32 | Unknown. |
0x14 | UInt32 | Unknown. |
HPNE
The HPNE (enemy path) section describes enemy points grouping; how the routes of CPU racers link together. Each entry is a 0x48 byte structure as follows:
Offset | Type | Description |
---|---|---|
0x00 | UInt16 | Point start. The index of the first TPNE entry in this group. |
0x02 | UInt16 | Point length. The number of TPNE entries in this group. |
0x04 | UInt16[16] | Previous group. The indicies of up to 16 the previous TPNE groups entries may have followed. Unneeded slots are set to value 0xFFFF. |
0x24 | UInt16[16] | Next group. The indicies of up to 16 next TPNE group entries to follow. Unneeded slots are set to value 0xFFFF. |
0x44 | UInt32 | Unknown. |
TPTI
The TPTI (item point) section describes item points; the routes of items such as red shells. The items attempt to follow the path described by each group of points (as determined by HPTI). Each entry is a 0x14 byte structure as follows:
Offset | Type | Description |
---|---|---|
0x00 | Float[3] | A 3D position vector of the item position. |
0x0C | Float | Bullet Bill can be controlled a little bit by left and right. And this value defines the range. |
0x10 | UInt32 | Unknown. |
HPTI
The HPTI (item path) section describes item point grouping; how the routes of items link together. Each entry is a 0x1C byte structure as follows:
Offset | Type | Description |
---|---|---|
0x00 | UInt16 | Point start. The index of the first TPTI entry in this group. |
0x02 | UInt16 | Point length. The number of TPTI entries in this group. |
0x04 | UInt16[6] | Previous group. The indicies of up to 6 the previous TPTI groups entries may have followed. Unneeded slots are set to value 0xFFFF. |
0x10 | UInt16[6] | Next group. The indicies of up to 6 next TPTI group entries to follow. Unneeded slots are set to value 0xFFFF. |
TPKC
The TPKC (checkpoint) section describes check points; the routes players must follow to count laps. The racers must follow the path described by each group of points (as determined by HPKC). Each entry is a 0x18 byte structure as follows:
Offset | Type | Description |
---|---|---|
0x00 | Float[2] | A 2D position vector (X and Z coordinate) of the left point of the check point line. |
0x08 | Float[2] | A 2D position vector (X and Z coordinate) of the right point of the check point line. |
0x10 | Byte | Respawn ID. |
0x11 | Byte | Checkpoint type. |
0x12 | Byte | Previous check point in this group's sequence; 0xFF for the first point of the group. |
0x13 | Byte | Next check point in this group's sequence; 0xFF for the last point of the group. |
0x14 | Byte | Unknown. |
0x15 | Byte | Unknown. |
0x16 | Byte | Unknown. |
0x17 | Byte | Unknown. |
HPKC
The HPKC (checkpoint path) section describes check point grouping; how the routes of check points link together. Each entry is a 0x10 byte structure as follows:
Offset | Type | Description |
---|---|---|
0x00 | Byte | Point start. The index of the first TPKC entry in this group. |
0x01 | Byte | Point length. The number of TPKC entries in this group. |
0x02 | Byte[6] | Previous group. The indicies of up to 6 the previous TPKC groups entries may have followed. Unneeded slots are set to value 0xFF. |
0x08 | Byte[6] | Next group. The indicies of up to 6 next TPKC group entries to follow. Unneeded slots are set to value 0xFF. |
0x0E | UInt16 | Unknown. |
JBOG
The JBOG (game object) section describes objects; things on the course such as item boxes and coins. Each entry is a 0x40 byte structure as follows:
Offset | Type | Description |
---|---|---|
0x00 | UInt16 | Object ID to identify the Object. |
0x02 | UInt16 | Unknown. |
0x04 | Float[3] | A 3D position vector of the object. |
0x10 | Float[3] | A 3D rotation vector of the object. |
0x1C | Float[3] | A 3D scale vector of the object's scale. |
0x28 | UInt16 | Route used by the object. This is index link into the ITOP section. The value 0xFFFF means "no route". |
0x2A | UInt16[8] | Up to 8 object specific settings. |
0x3A | UInt16 | Object presence flags. |
0x3C | UInt16 | Unknown. |
0x3E | UInt16 | Unknown. |
ITOP
The ITOP section describes routes; these are routes for many things including cameras and objects.
Each entry is a 0x04 byte structure as follows, which is followed by 0x10 byte structures:
Offset | Type | Description |
---|---|---|
0x00 | UInt16 | Number of points in the route. |
0x02 | Byte | Route setting 1. |
0x03 | Byte | Route setting 2. |
Each point in each entry is as follows:
Offset | Type | Description |
---|---|---|
0x00 | Float[3] | A 3D position vector of the route position. |
0x0C | UInt16 | Route point setting 1. |
0x0E | UInt16 | Route point setting 2. |
AERA
The AERA section describes areas; used to determine which camera to use for example. Each entry is a 0x30 byte structure as follows:
Offset | Type | Description |
---|---|---|
0x00 | Byte | Area mode. 0 = box, 1 = cylinder. |
0x01 | Byte | Area type. |
0x02 | Byte | Index of EMAC. |
0x03 | Byte | Priority value. A higher number means a higher priority to choose which area activates if multiple areas intersected. |
0x04 | Float[3] | A 3D position vector of the area. |
0x10 | Float[3] | A 3D rotation vector of the area's rotation. |
0x1C | Float[3] | A 3D scale vector of the area's scale. |
0x28 | UInt16 | Unknown. |
0x2A | UInt16 | Unknown. |
0x2C | UInt16 | Unknown. |
0x2E | UInt16 | Unknown. |
EMAC
The EMAC section describes cameras; used to determine cameras for starting routes, time trial pans, etc. Each entry is a 0x48 byte structure as follows:
Offset | Type | Description |
---|---|---|
0x00 | Byte | Camera type. |
0x01 | Byte | Next camera entry index. Value 0xFF means: no next camera. |
0x02 | Byte | Unknown. |
0x03 | Byte | Route used by the camera. This is index link into the ITPO section. The value 0xFF means "no route". |
0x04 | UInt16 | Route speed. |
0x06 | UInt16 | FOV speed. |
0x08 | UInt16 | Viewpoint speed. |
0x0A | Byte | Unknown. |
0x0B | Byte | Unknown. |
0x0C | Float[3] | A 3D position vector of the camera. |
0x18 | Float[3] | A 3D rotation vector of the camera. |
0x24 | Float | The angle of the FOV (start). |
0x28 | Float | The angle of the FOV (end). |
0x2C | Float[3] | Start vector of the view point. |
0x38 | Float[3] | Destination vector of the view point. |
0x44 | Float | The time how long this Camera is active. |
TPGJ
The TPGJ section describes Jugem points; the respawn points. Each entry is a 0x1C byte structure as follows:
Offset | Type | Description |
---|---|---|
0x00 | Float[3] | A 3D position vector of the respawn position. |
0x0C | Float[3] | A 3D rotation vector of the respawn position. |
0x18 | UInt16 | The ID of this respawn position. |
0x1A | UInt16 | Unknown. |
TPNC
It seems that this section is usused.
TPSM
It seems that this section is usused.
IGTS
Offset | Type | Description |
---|---|---|
0x00 | Byte | Unknown. |
0x01 | Byte | Unknown. |
0x02 | Byte | Unknown. |
0x03 | Byte | Unknown. |
0x04 | UInt32 | Unknown. |
0x08 | UInt16 | Unknown. |
0x0A | UInt16 | Unknown. |
SROC
It seems that this section is usused.
TPLG
Each entry is a 0x18 byte structure as follows:
Offset | Type | Description |
---|---|---|
0x00 | Float[3] | A 3D position vector of the point. |
0x0C | Float | Point scale. |
0x10 | UInt32 | Unknown. |
0x14 | UInt32 | Unknown. |
HPLG
Each entry is a 0x0C byte structure as follows:
Offse | Type | Description |
---|---|---|
0x00 | Byte | Point start. The index of the first TPLG entry in this group. |
0x01 | Byte | Point length. The number of TPLG entries in this group. |
0x02 | Byte[6] | Previous groups. The indicies of up to 6 the previous TPLG groups entries may have followed. Unneeded slots are set to value 0xFF. |
0x08 | Byte[6] | Next groups. The indicies of up to 6 next TPLG group entries to follow. Unneeded slots are set to value 0xFF. |
0x0C | UInt32 | Unknown. |
0x10 | UInt32 | Unknown. |
Tools
The following tools can handle KMP files:
- Every File Explorer, by Gericom (not editable)
- KMP Expander, by Ermelber