MKAGP BIN (File Format)

From Wexos's Wiki
Jump to navigationJump to search

MKAGP BIN is a collision format used in Mario Kart Arcade GP and Mario Kart Arcade GP 2.

File Format

The file byte order is always big endian.

Header

The file starts with the following header:

Offset Type Description
0x00 Int32 Grid width (W).
0x04 Int32 Grid length (L).
0x08 Float Grid cell X size.
0x0C Float Grid cell Y size.
0x10 Float[2] AABB minimum coordinate XZ.
0x18 Float[2] AABB maximum coordinate XZ.
0x20 Float[2] Negative AABB minimum coordinate XZ. Unknown usage.
0x28 UInt32 Grids offset.

Grid

At the end of the file, W * L grid cell headers are stored in 0x10 byte blocks.

Cell

All offsets are absolute.

Offset Type Description
0x00 UInt32 Triangles offset. Garbage data if none for this cell.
0x04 Int32 Number of Triangles.
0x08 UInt32 Cubes offset. Garbage data if none for this cell.
0x0C Int32 Number of Walls.

Triangle

Offset Type Description
0x00 Float[2] Minimal coordinate for this triangle.
0x08 Float[2] Maximal coordinate for this triangle.
0x10 Float[3][3] Triangle vertices XYZ position.
0x34 Float[3][3] Triangle edges XYZ position.
0x58 UInt32 Neighbour triangle flag, used to determine which edges connect to other triangles.
0x5C UInt32 MKAGP BIN flag.
0x60 Float[3] Triangle normal.
0x6C Float Negative dot product between triangle center and triangle normal.

Wall

There are C 0x20 walls, which are used for wall collision detection. The walls are auto-generated from all triangles by checking which edges are missing neighbour triangles.

Offset Type Description
0x00 Float[2] Min XZ of the triangle edge.
0x08 Float[2] Max XZ of the triangle edge.
0x10 Float[2] Position 1 XZ of the triangle edge forming the wall.
0x18 Float[2] Position 2 XZ of the triangle edge forming the wall.

Tools

The following tools can handle MKAGP BIN files:

  • (none)