Slot Usage

From Custom Mario Kart
Revision as of 23:23, 15 June 2019 by Wiimm (talk | contribs) (→‎LE-CODE)
Jump to navigation Jump to search

This article describes some technical aspects of slots for custom track distribution maintainers.


Original Mario Kart Wii

The tracks of Mario Kart Wii are internally addressed by slot identifiers beginning with value 0. The game uses integers (at least 31 bit unsigned) to identify a track. But the network protocol is the bottleneck: track identifiers are transmitted as single byte. So there are only 256 slots available if playing online.

Track slot usage of Mario Kart Wii
Slots Hex Slots Dec N Usage
0x00–0x1f 0–31 32 Original racing tracks (T11–T84)
0x20–0x29 32–41 10 Original battle arenas (A11–A25)
0x2a–0x35 42–53 12 not used
0x36 54 1 Galaxy Colosseum
0x37–0x3a 55–58 4 Special scenes like Winning run demo
0x3b–0x41 59–65 7 not used
0x42 66 1 Maybe reserved.
0x43 67 1 Online Protocol: No track selected yet
0x44–0xfe 68–254 187 not used
0xff 255 1 Online Protocol: Random selected

There is a total of 206 (12+7+187) free slots in Nintendo mode.

CT-CODE

CT-CODE (or CT-Code; an abbreviation of Custom Track Code) is an extension of Mario Kart Wii. CT-CODE was developed by MrBean35000vr and Chadderz for their CTGP Revolution. The name CT-CODE was created by Wiimm, when he implemented CT-CODE support in his SZS Tools.

The main purpose is to allow more than 32 racing tracks in one distribution. So it uses free slots and misapply some other slots.

Slot Usage of CT-CODE
Slots Hex Slots Dec N Usage
0x00–0x1f 0–31 32 Original racing tracks (T11–T84)
0x20–0x41 32–65 34 Custom tracks
0x42 66 1 Maybe reserved.
0x43 67 1 Online Protocol: No track selected yet
0x44–0xfe 68–254 187 Custom tracks
0xff 255 1 Online Protocol: Random selected

CT-CODE uses the free slots and overrides arena and special slots to get space for 221 custom tracks in addition to the 32 original racing tracks.

The BMG message id for track names is calculated by: 0x4000 + slot.

LE-CODE

LE-CODE (or LE-Code; an abbreviation of Leseratte Code) is an extension of Mario Kart Wii. LE-CODE was developed by Leseratte. The name LE-CODE was created by Wiimm, when he implemented LE-CODE support in his SZS Tools.

LE-CODE changes not only the behavior of the game, it changes the online protocol too. The most important modification is, that track identifiers are transmitted as 16 bit value (15 bits unsigned). So 32768 different slots (plus 1 for random) can be used — more than enough for custom tracks. If using about 4000 custom tracks, the game runs in other limits like total game size or usability for track selection. Therefor Leseratte and Wiimm decided to limit the number of supported slots to 4096 (0x1000); it's a space decision too. This limit is implemented in the LE-CODE executor as well in Wiimms SZS Tools and mkw-ana.

Slot usage of LE-CODE
Slots Hex Slots Dec N Usage
0x000–0x01f 0–31 32 Original racing tracks (T11–T84)
0x020–0x02b 32–41 10 Original battle arenas (A11–A25)
0x02a–0x035 42–53 12 not used
0x036 54 1 Galaxy Colosseum
0x037–0x03a 55–58 4 Special scenes like Winning run demo
0x03b–0x03d 59–61 3 not used
0x03e–0x041 62–65 4 used for special random selections
0x042 66 1 Maybe reserved.
0x043 67 1 Online Protocol: No track selected yet
0x044–0xfff 68–4095 4028 Custom tracks
0x1000–0x7fff 4096–32767 28672 CT usage possible, but excluded for different reasons
0xffff 65535 1 Online Protocol: Random selected

The BMG message id for track names is calculated by: 0x7000 + slot.

Slot Comparison

The following table shows all used slots by Nintendo, CT-CODE and LE-CODE. Due to network protocol limits, Nintendo and CT-CODE can only use the first 256 slots, while LE-CODE can use 65536 slots. Anyway, it is limited to 4096 slots plus 1 slot for random selection for different reasons; see section above.

Track slot usage of all variants
Slots Hex Slots Dec N LE-CODE Nintendo Usage CT-CODE
0x00–0x1f 0–31 32 Original racing tracks (T11–T84)
0x20–0x29 32–41 10 Battle arenas (A11–A25) 34 custom tracks
0x2a–0x35 42–53 12 not used
0x36 54 1 Galaxy Colosseum
0x37–0x3a 55–58 4 Special scenes like Winning run demo
0x3b–0x3d 59–61 3 not used not used
0x3e–0x41 62–65 4 used for special random selections
0x42 66 1 Maybe reserved.
0x43 67 1 Online Protocol: No track selected yet
0x44–0xfe 68–254 187 4028 custom tracks not used 187 custom tracks
0xff 255 1 Online Protocol: Random selected
0x100–0xfff 256–4095 3840 no online support
0x1000–0x7fff 4096–32767 28672 CT usage possible, but
excluded for different reasons
0x8000-0xfffe 32768–65534 32767 no online support
0xffff 65535 1 Online Protocol:
Random selected