KMG (File Format)

From Custom Mario Kart
Revision as of 15:36, 29 June 2019 by Palapeli (talk | contribs)
Jump to navigation Jump to search
Under Construction
This article is not finished. Help improve it by adding accurate information or correcting grammar and spelling.

KMG (Kart MiniGame) is a file format from Mario Kart Wii, exclusively used as minigame.kmg, a sub file of /Race/Common.szs. It contains information for Battle Mode, such as time limits and score increments.

File Format

Header

Offset Type Description
0x00 String File magic. Always RKMG in ASCII.
0x04 UInt32 Length of the file in bytes.
0x08 UInt32 Unknown.
0x0C UInt32 Offset to Coin Runners Data, relative to 0x10.
0x10 End of file header, start of Balloon Battle Data.

Balloon Battle Data

This section contains parameters used on Balloon Battle. It consists of three sections: a Time Limit Table, an Unknown Table and a Balloon Battle Parameters sub-section. It is located at 0x10.

Balloon Battle Parameters

After the tables, there is a sub-section that contains different parameters, located at 0x1C8.

Offset Information
0x00 Number of points scored when hitting a player.
0x02 Number of extra points scored when defeating a player (originally unused).
0x04 Number of points scored when losing all balloons.
0x06 Number of points scored when hit by a player (originally unused).
0x08 Unknown.
0x0A Unknown.
0x0C Unknown.
0x0E Unknown.
0x10 Unknown.
0x12 Unknown.

Coin Runners Data

This section contains parameters used on Coin Runners. It consists of seven sections: a Time Limit Table, 5 Unknown Tables and a Coin Runners Parameters sub-section. It is located at 0x1DC.

Coin Runners Parameters

After the tables, there is a sub-section that contains different parameters, located at 0x704.

Offset Information
0x00 Unknown.
0x02 Unknown.
0x04 Unknown.
0x06 Unknown.
0x08 Unknown.
0x0A Unknown.
0x0C Unknown.
0x0E Minimum amount of coins lost when falling out of bounds.
0x10 Minimum amount of coins lost when hit by a player.
0x12 Percentage of coins to lose (from 0 to 100).

Other Structures

These structures are used multiple times throughout the file.

Time Limit Table

There are two identical tables that contain time limit information for Balloon Battle and Coin Runners. These tables contain 110 unsigned 16-bit values that each define the time limit for each number of players on each stage in seconds.

The entries are ordered following the Course IDs for the battle stages minus 0x20.

Format of a Time Limit Table Entry
Offset Information
0x00 Time limit for 2 players.
0x02 Time limit for 3 players.
0x04 Time limit for 4 players.
0x06 Time limit for 5 players.
0x08 Time limit for 6 players.
0x0A Time limit for 7 players.
0x0C Time limit for 8 players.
0x0E Time limit for 9 players.
0x10 Time limit for 10 players.
0x12 Time limit for 11 players.
0x14 Time limit for 12 players.

Here's an offset table for reference (relative to the start of the Time Limit Table):

Stage 2 Players 3 Players 4 Players 5 Players 6 Players 7 Players 8 Players 9 Players 10 Players 11 Players 12 Players
Delfino Pier 0x00 0x02 0x04 0x06 0x08 0x0A 0x0C 0x0E 0x10 0x12 0x14
Block Plaza 0x16 0x18 0x1A 0x1C 0x1E 0x20 0x22 0x24 0x26 0x28 0x2A
Chain Chomp Wheel 0x2C 0x2E 0x30 0x32 0x34 0x36 0x38 0x3A 0x3C 0x3E 0x40
Funky Stadium 0x42 0x44 0x46 0x48 0x4A 0x4C 0x4E 0x50 0x52 0x54 0x56
Thwomp Desert 0x58 0x5A 0x5C 0x5E 0x60 0x62 0x64 0x66 0x68 0x6A 0x6C
GCN Cookie Land 0x6E 0x70 0x72 0x74 0x76 0x78 0x7A 0x7C 0x7E 0x80 0x82
DS Twilight House 0x84 0x86 0x88 0x8A 0x8C 0x8E 0x90 0x92 0x94 0x96 0x98
SNES Battle Course 4 0x9A 0x9C 0x9E 0xA0 0xA2 0xA4 0xA6 0xA8 0xAA 0xAC 0xAE
GBA Battle Course 3 0xB0 0xB2 0xB4 0xB6 0xB8 0xBA 0xBC 0xBE 0xC0 0xC2 0xC4
N64 Skyscraper 0xC6 0xC8 0xCA 0xCC 0xCE 0xD0 0xD2 0xD4 0xD6 0xD8 0xDA

All of the default time limit values are 180 (3 minutes).

Unknown Tables

For both Balloon Battle and Coin Runners, there are 0xDC-byte tables that control unknown parameters. They are read the same way the Time Limit Table is.

Tools

The following tools can handle KMG files:

  • (none)