Difference between revisions of "MKTV Replay (File Format)"
(initial findings) |
(Filename; driver data; course info; number of players; timestamp (hours/minutes are verified and show up on the replay summary screen in-game)) |
||
Line 2: | Line 2: | ||
{{textbox|center white|Platform Notice|This article is about [[Mario Kart 8]] for [[Wii U]]. It's likely that [[Mario Kart 8 Deluxe]] uses the same or a very similar file format, but this was not verified.}} | {{textbox|center white|Platform Notice|This article is about [[Mario Kart 8]] for [[Wii U]]. It's likely that [[Mario Kart 8 Deluxe]] uses the same or a very similar file format, but this was not verified.}} | ||
− | In [[Mario Kart 8]], MKTV Replay Data is stored in ''[[DAT (File Format)|DAT]]''-files. | + | In [[Mario Kart 8]], MKTV Replay Data is stored in ''[[DAT (File Format)|DAT]]''-files. These files contain recordings of races or battles. The 12 most recent replays are stored in the <i>common</i> save folder. Up to 6 replays can be favourited. Favourited replays are stored in a user's save folder instead. |
= Filename = | = Filename = | ||
− | The filename | + | Like [[Ghost Data (File Format)|ghost data]], MKTV Replays also encode some of their data in their filenames. The data stored for each of the 12 players is identical. If there are less than 12 players, the filename is padded with mostly values of <i>ff</i>. |
+ | |||
+ | <!-- Offsets and size are a bit weird, since the filename's characters should be interpreted as HEX values. A better formatting for this table would be nice, as the current way feels a bit off. --> | ||
+ | {| class="wikitable" | ||
+ | |+ MKTV Replay Filename | ||
+ | |- | ||
+ | ! Offset (#characters) | ||
+ | ! Size (#characters) | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0 || 2 || '''Ghost Type'''. Always "rp". | ||
+ | |- | ||
+ | | 2 || 2 || '''Replay Number'''. The most recent replays in the <i>common<i> folder are numbered 0-11. Favourited replays are numbered separately from 0-5. | ||
+ | |- | ||
+ | | 4 || 2 || '''Track ID'''. | ||
+ | |- | ||
+ | | 6 || 15 || '''Unknown'''. | ||
+ | |- | ||
+ | | 21 || colspan=2 {{unknown|'''Player 1''' Driver Data.}} | ||
+ | |- | ||
+ | | 21 || 2 || '''Character ID'''. | ||
+ | |- | ||
+ | | 23 || 2 || '''Character Variant ID'''. Only used for Yoshi, Shy Guy, and Mii (standard or Amiibo suit). | ||
+ | |- | ||
+ | | 25 || 2 || '''Vehicle Body ID'''. | ||
+ | |- | ||
+ | | 27 || 2 || '''Tires ID'''. | ||
+ | |- | ||
+ | | 29 || 2 || '''Glider ID'''. | ||
+ | |- | ||
+ | | 31 || 2 || Possibly a '''CPU-marker'''. Always seems to be <i>28</i> for CPUs. Usually <i>08</i> for human players, but a value of <i>09</i> was seen as well (for a race with the Mii character). A value of <i>88</i> is used if the driver slot is unused. A motion control flag or Mii weight class could be embedded here too, as those are also located in [[Ghost Data (File Format)#Filename|ghost data filenames]]. | ||
+ | |- | ||
+ | | 33 || 12 || {{unknown|'''Player 2''' Driver Data.}} | ||
+ | |- | ||
+ | | 45 || 12 || {{unknown|'''Player 3''' Driver Data.}} | ||
+ | |- | ||
+ | | 57 || 12 || {{unknown|'''Player 4''' Driver Data.}} | ||
+ | |- | ||
+ | | 69 || 12 || {{unknown|'''Player 5''' Driver Data.}} | ||
+ | |- | ||
+ | | 81 || 12 || {{unknown|'''Player 6''' Driver Data.}} | ||
+ | |- | ||
+ | | 93 || 12 || {{unknown|'''Player 7''' Driver Data.}} | ||
+ | |- | ||
+ | | 105 || 12 || {{unknown|'''Player 8''' Driver Data.}} | ||
+ | |- | ||
+ | | 117 || 12 || {{unknown|'''Player 9''' Driver Data.}} | ||
+ | |- | ||
+ | | 129 || 12 || {{unknown|'''Player 10''' Driver Data.}} | ||
+ | |- | ||
+ | | 141 || 12 || {{unknown|'''Player 11''' Driver Data.}} | ||
+ | |- | ||
+ | | 153 || 12 || {{unknown|'''Player 12''' Driver Data.}} | ||
+ | |- | ||
+ | | 165 || 5 || {{unknown|Probably '''Padding'''. Always 0.}} | ||
+ | |- | ||
+ | | 170 || 12 || {{unknown|End of filename; ".dat" extension here.}} | ||
+ | |} | ||
= Header = | = Header = | ||
Line 39: | Line 96: | ||
* Team indicator (blue vs red vs solo) | * Team indicator (blue vs red vs solo) | ||
* Battle indicator (VS/GP mode vs battle mode) | * Battle indicator (VS/GP mode vs battle mode) | ||
+ | |||
+ | == Timestamp == | ||
+ | When a replay is created, the timestamp from the user's local time is used and included in the replay data. | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |+ Timestamp | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x54 || 4 || '''Year'''. | ||
+ | |- | ||
+ | | 0x58 || 4 || '''Month'''. | ||
+ | |- | ||
+ | | 0x5c || 4 || '''Day'''. | ||
+ | |- | ||
+ | | 0x60 || 4 || '''Day of Week''', with 0x00 being Sunday. | ||
+ | |- | ||
+ | | 0x64 || 4 || '''Hour'''. | ||
+ | |- | ||
+ | | 0x68 || 4 || '''Minute'''. | ||
+ | |- | ||
+ | | 0x6c || 4 || '''Second'''. | ||
+ | |- | ||
+ | | 0x70 || colspan=2 {{unknown|End of timestamp}} | ||
+ | |} | ||
+ | |||
+ | == Driver Data == | ||
+ | Each player's character and vehicle combination are stored in consecutive 0x1c byte sized blocks. This format is the same for all twelve players. If there are less than 12 players, the data for missing players is mostly zeroed out. | ||
+ | |||
+ | {|class="wikitable" | ||
+ | |+ Individual Driver Data | ||
+ | ! Offset !! Size !! Description | ||
+ | |- | ||
+ | | 0x74 || 4 || '''Vehicle Body ID'''. | ||
+ | |- | ||
+ | | 0x78 || 4 || '''Tires ID'''. | ||
+ | |- | ||
+ | | 0x7c || 4 || '''Glider ID'''. | ||
+ | |- | ||
+ | | 0x80 || 4 || '''Character ID'''. | ||
+ | |- | ||
+ | | 0x84 || 1 || '''Character Variant ID''' Only used for Yoshi, Shy Guy, and Mii (standard or Amiibo suit). | ||
+ | |- | ||
+ | | 0x85 || 1 || '''Mii Weight Class'''. Only used for Mii (standard or Amiibo suit). | ||
+ | |- | ||
+ | | 0x86 || 2 || {{Unknown-left|Probably '''Padding''' (always 0).}} | ||
+ | |- | ||
+ | | 0x88 || 4 || {{Unknown-left|Possibly '''CPU Flag'''. 0x00 for human, 0x02 for CPU, 0x04 for no driver.}} | ||
+ | |- | ||
+ | | 0x8c || 4 || {{Unknown-left|Probably '''Padding''' (always 0).}} | ||
+ | |- | ||
+ | | 0x90 || colspan=2 {{unknown|End of individual driver data}} | ||
+ | |} | ||
+ | |||
+ | {|class="wikitable mw-collapsible mw-collapsed" | ||
+ | |+ Driver Data | ||
+ | ! Offset !! Description | ||
+ | |- | ||
+ | | 0x78 || Player 1 | ||
+ | |- | ||
+ | | 0x90 || Player 2 | ||
+ | |- | ||
+ | | 0xac || Player 3 | ||
+ | |- | ||
+ | | 0xc8 || Player 4 | ||
+ | |- | ||
+ | | 0xe4 || Player 5 | ||
+ | |- | ||
+ | | 0x100 || Player 6 | ||
+ | |- | ||
+ | | 0x11c || Player 7 | ||
+ | |- | ||
+ | | 0x138 || Player 8 | ||
+ | |- | ||
+ | | 0x154 || Player 9 | ||
+ | |- | ||
+ | | 0x170 || Player 10 | ||
+ | |- | ||
+ | | 0x18c || Player 11 | ||
+ | |- | ||
+ | | 0x1a8 || Player 12 | ||
+ | |- | ||
+ | | 0x1c4 || {{unknown|End of driver data}} | ||
+ | |} | ||
+ | |||
+ | == Course Info == | ||
+ | {|class="wikitable" | ||
+ | |+ Course Info | ||
+ | ! Offset !! Size !! Description | ||
+ | |- | ||
+ | | 0x1c4 || 4 || '''Track ID'''. | ||
+ | |- | ||
+ | | 0x1c8 || colspan=2 {{unknown|End of course info}} | ||
+ | |} | ||
+ | |||
+ | == Driver Count == | ||
+ | {|class="wikitable" | ||
+ | |+ Driver count | ||
+ | ! Offset !! Size !! Description | ||
+ | |- | ||
+ | | 0x1f0 || 4 || '''Number of Drivers''' (includes CPUs). | ||
+ | |- | ||
+ | | 0x1f4 || colspan=2 {{unknown|End of driver count}} | ||
+ | |} | ||
== Player Data == | == Player Data == | ||
− | The | + | The [[Mii]] and name of each player are stored in consecutive 0x100 byte sized blocks. Each block of player data has an identical format to that of the [[Ghost Data (File Format)#Mii_Info|Mii Info block for ghost data]]. The format below is the same for all 12 players. If there are less than 12 players, the data for missing players is zeroed out. |
{|class="wikitable" | {|class="wikitable" | ||
− | |+ Player Data | + | |+ Individual Player Data |
! Offset !! Size !! Description | ! Offset !! Size !! Description | ||
|- | |- | ||
Line 71: | Line 234: | ||
| 0x344 || 36 || {{Unknown-left|'''Unknown''' (mostly 0).}} | | 0x344 || 36 || {{Unknown-left|'''Unknown''' (mostly 0).}} | ||
|- | |- | ||
− | | 0x368 || colspan=2 {{unknown|End of player data}} | + | | 0x368 || colspan=2 {{unknown|End of individual player data}} |
+ | |} | ||
+ | |||
+ | {|class="wikitable mw-collapsible mw-collapsed" | ||
+ | |+ Player Data | ||
+ | ! Offset !! Description | ||
+ | |- | ||
+ | | 0x268 || Player 1 | ||
+ | |- | ||
+ | | 0x368 || Player 2 | ||
+ | |- | ||
+ | | 0x468 || Player 3 | ||
+ | |- | ||
+ | | 0x568 || Player 4 | ||
+ | |- | ||
+ | | 0x668 || Player 5 | ||
+ | |- | ||
+ | | 0x768 || Player 6 | ||
+ | |- | ||
+ | | 0x868 || Player 7 | ||
+ | |- | ||
+ | | 0x968 || Player 8 | ||
+ | |- | ||
+ | | 0xa68 || Player 9 | ||
+ | |- | ||
+ | | 0xb68 || Player 10 | ||
+ | |- | ||
+ | | 0xc68 || Player 11 | ||
+ | |- | ||
+ | | 0xd68 || Player 12 | ||
+ | |- | ||
+ | | 0xe68 || {{unknown|End of player data}} | ||
|} | |} | ||
− | + | ||
[[Category:File Format]] | [[Category:File Format]] |
Latest revision as of 16:00, 2 July 2022
In Mario Kart 8, MKTV Replay Data is stored in DAT-files. These files contain recordings of races or battles. The 12 most recent replays are stored in the common save folder. Up to 6 replays can be favourited. Favourited replays are stored in a user's save folder instead.
Filename
Like ghost data, MKTV Replays also encode some of their data in their filenames. The data stored for each of the 12 players is identical. If there are less than 12 players, the filename is padded with mostly values of ff.
Offset (#characters) | Size (#characters) | Description |
---|---|---|
0 | 2 | Ghost Type. Always "rp". |
2 | 2 | Replay Number. The most recent replays in the common folder are numbered 0-11. Favourited replays are numbered separately from 0-5. |
4 | 2 | Track ID. |
6 | 15 | Unknown. |
21 | Player 1 Driver Data. | |
21 | 2 | Character ID. |
23 | 2 | Character Variant ID. Only used for Yoshi, Shy Guy, and Mii (standard or Amiibo suit). |
25 | 2 | Vehicle Body ID. |
27 | 2 | Tires ID. |
29 | 2 | Glider ID. |
31 | 2 | Possibly a CPU-marker. Always seems to be 28 for CPUs. Usually 08 for human players, but a value of 09 was seen as well (for a race with the Mii character). A value of 88 is used if the driver slot is unused. A motion control flag or Mii weight class could be embedded here too, as those are also located in ghost data filenames. |
33 | 12 | Player 2 Driver Data. |
45 | 12 | Player 3 Driver Data. |
57 | 12 | Player 4 Driver Data. |
69 | 12 | Player 5 Driver Data. |
81 | 12 | Player 6 Driver Data. |
93 | 12 | Player 7 Driver Data. |
105 | 12 | Player 8 Driver Data. |
117 | 12 | Player 9 Driver Data. |
129 | 12 | Player 10 Driver Data. |
141 | 12 | Player 11 Driver Data. |
153 | 12 | Player 12 Driver Data. |
165 | 5 | Probably Padding. Always 0. |
170 | 12 | End of filename; ".dat" extension here. |
Header
Offset | Size | Description |
---|---|---|
0x00 | 4 | "CTR0" in ASCII. Unknown abbreviation. 'R' likely stands for 'Replay'. |
0x04 | 4 | Unknown. Likely game version. |
0x08 | 4 | File Size (in bytes). |
0x0c | 44 | Probably Padding (always 0) |
0x38 | 4 | Unknown |
0x3c | 4 | CRC-32 Checksum over all bytes after this header until the end of the file. |
0x40 | 8 | Probably Padding (always 0) |
0x48 | End of header |
Data
This section is a WIP. It is likely that MKTV replays use a similar format as ghost data, of which is still a lot unknown. It is probably easier to decode that first before attempting to dive further into MKTV replays.
However, the following data must also be stored in replays, but is likely not stored in ghost data:
- Number of points scored this race/battle, or player VR/BR
- Team indicator (blue vs red vs solo)
- Battle indicator (VS/GP mode vs battle mode)
Timestamp
When a replay is created, the timestamp from the user's local time is used and included in the replay data.
Offset | Size | Description |
---|---|---|
0x54 | 4 | Year. |
0x58 | 4 | Month. |
0x5c | 4 | Day. |
0x60 | 4 | Day of Week, with 0x00 being Sunday. |
0x64 | 4 | Hour. |
0x68 | 4 | Minute. |
0x6c | 4 | Second. |
0x70 | End of timestamp |
Driver Data
Each player's character and vehicle combination are stored in consecutive 0x1c byte sized blocks. This format is the same for all twelve players. If there are less than 12 players, the data for missing players is mostly zeroed out.
Offset | Size | Description |
---|---|---|
0x74 | 4 | Vehicle Body ID. |
0x78 | 4 | Tires ID. |
0x7c | 4 | Glider ID. |
0x80 | 4 | Character ID. |
0x84 | 1 | Character Variant ID Only used for Yoshi, Shy Guy, and Mii (standard or Amiibo suit). |
0x85 | 1 | Mii Weight Class. Only used for Mii (standard or Amiibo suit). |
0x86 | 2 | Probably Padding (always 0). |
0x88 | 4 | Possibly CPU Flag. 0x00 for human, 0x02 for CPU, 0x04 for no driver. |
0x8c | 4 | Probably Padding (always 0). |
0x90 | End of individual driver data |
Offset | Description |
---|---|
0x78 | Player 1 |
0x90 | Player 2 |
0xac | Player 3 |
0xc8 | Player 4 |
0xe4 | Player 5 |
0x100 | Player 6 |
0x11c | Player 7 |
0x138 | Player 8 |
0x154 | Player 9 |
0x170 | Player 10 |
0x18c | Player 11 |
0x1a8 | Player 12 |
0x1c4 | End of driver data |
Course Info
Offset | Size | Description |
---|---|---|
0x1c4 | 4 | Track ID. |
0x1c8 | End of course info |
Driver Count
Offset | Size | Description |
---|---|---|
0x1f0 | 4 | Number of Drivers (includes CPUs). |
0x1f4 | End of driver count |
Player Data
The Mii and name of each player are stored in consecutive 0x100 byte sized blocks. Each block of player data has an identical format to that of the Mii Info block for ghost data. The format below is the same for all 12 players. If there are less than 12 players, the data for missing players is zeroed out.
Offset | Size | Description |
---|---|---|
0x268 | 8 | Unknown. |
0x270 | 92 | Mii Data. See full description on 3dsbrew. Note that the embedded Mii name is in UTF-16 (little Endian). For CPU Players, a no name Mii is used. |
0x2cc | 2 | Probably Padding. |
0x2ce | 2 | CRC-16 XMODEM Checksum of the Mii Data and additional padding. |
0x2d0 | 1 | Player Country ID. |
0x2d1 | 1 | Player Sub-region ID. |
0x2d2 | 2 | Probably Padding (always 0). |
0x2d4 | 1 | Player Country ID repeat (purpose unknown). |
0x2d5 | 1 | Player Sub-region ID repeat (purpose unknown). |
0x2d6 | 80 | Unknown. |
0x330 | 20 | Mii Name in UTF-16 big Endian. In local play this is the name of the character a player or CPU is playing as. In online play, this is the name of the Mii a player is using. |
0x344 | 36 | Unknown (mostly 0). |
0x368 | End of individual player data |
Offset | Description |
---|---|
0x268 | Player 1 |
0x368 | Player 2 |
0x468 | Player 3 |
0x568 | Player 4 |
0x668 | Player 5 |
0x768 | Player 6 |
0x868 | Player 7 |
0x968 | Player 8 |
0xa68 | Player 9 |
0xb68 | Player 10 |
0xc68 | Player 11 |
0xd68 | Player 12 |
0xe68 | End of player data |