Difference between revisions of "RKC (File Format)"
m (→RKCO) |
(More precisely define file format) |
||
(33 intermediate revisions by 7 users not shown) | |||
Line 1: | Line 1: | ||
− | '''RKC Files''' are files downloaded by [[Mario Kart Wii]] using the WC24 download engine. The RKC file contains data and a [[ | + | '''RKC Files''' ('''R'''evolution '''K'''art '''C'''ompetition) are files downloaded by [[Mario Kart Wii]] using the WC24 download engine. The RKC file contains data and a [[U8]] file with a new [[KMP]] for the competition. The RKC file is part of the ''DISTMAP.BIN'' file, which is stored inside the ''wc24dl.vff'' file in the savegame. |
− | The maximum file size for a RKC file in the unmodified game is 20480 bytes. It | + | The maximum file size for a RKC file in the unmodified game is 20480 bytes. It is possible to change the maximum size by modifying the memory allocation size in Nwc24Manager's constructor (offset 0x80668BA4 PAL). |
= File Format = | = File Format = | ||
− | + | The RKC files consist of an RKCT header and an RKCO header, followed by an U8 archive (RKCS). | |
− | The RKC files | ||
== RKCT == | == RKCT == | ||
− | |||
The RKCT header, or the main header, is 0x10 bytes long: | The RKCT header, or the main header, is 0x10 bytes long: | ||
{| class="wikitable" | {| class="wikitable" | ||
− | |||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
|- | |- | ||
− | | 0x00 || String || '''File magic'''. RKCT in ASCII | + | | 0x00 || String || '''File magic'''. Always ''RKCT'' in ASCII. |
|- | |- | ||
− | | 0x04 || UInt32 || '''Length of the data''' in bytes | + | | 0x04 || UInt32 || '''Length of the data''' in bytes. |
|- | |- | ||
− | | 0x08 || UInt32 || '''Length of all file headers''' (offset to the beginning of the [[ | + | | 0x08 || UInt32 || '''Length of all file headers''' (offset to the beginning of the [[U8]] file). |
|- | |- | ||
− | | | + | | 0x0C || UInt32 || '''Unknown''', always 0x640. Maybe a version number? |
|} | |} | ||
== RKCO == | == RKCO == | ||
− | + | The RKCO Header immediately follows the RKCT header. It contains all information for the competition. Stuff like Course ID, CommonObj that gets loaded and other information. The header is 0x3C bytes long: | |
− | The RKCO Header contains all information for the competition. Stuff like Course ID, CommonObj that gets loaded and other information. The header is 0x3C bytes long: | ||
{| class="wikitable" | {| class="wikitable" | ||
− | |||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
|- | |- | ||
− | | 0x00 || String || '''Section magic'''. RKCO in ASCII | + | | 0x00 || String || '''Section magic'''. Always ''RKCO'' in ASCII. |
|- | |- | ||
− | | 0x04 || UInt16 || [[#Game Modes|Game mode]] | + | | 0x04 || UInt16 || [[#Game Modes|Game mode]]. |
|- | |- | ||
− | | 0x06 || Byte || Course ID | + | | 0x06 || Byte || Course ID. |
|- | |- | ||
− | | 0x07 || Byte || '''Engine class'''. 0: 50cc, 1: 100cc, 2: 150cc, 3: battle | + | | 0x07 || Byte || '''Engine class'''. 0: 50cc, 1: 100cc, 2: 150cc, 3: battle. |
|- | |- | ||
− | | 0x08 || Byte || '''Amount of laps''' (laps, so triggered with checkpoints, not scores) | + | | 0x08 || Byte || '''Amount of laps''' (laps, so triggered with checkpoints, not scores). |
|- | |- | ||
− | | 0x09 || Byte || Padding | + | | 0x09 || Byte || Padding. |
|- | |- | ||
− | | 0x0A || UInt16 || '''Vehicle restriction'''. 0: karts only, 1: bikes only, 2: no restriction | + | | 0x0A || UInt16 || '''Vehicle restriction'''. 0: karts only, 1: bikes only, 2: no restriction. |
|- | |- | ||
− | | 0x0C || UInt16 || '''Camera angle'''. 3: normal camera, 7: camera from above | + | | 0x0C || UInt16 || '''Camera angle'''. 3: normal camera, 7: camera from above. |
|- | |- | ||
− | | 0x0E || UInt16 || '''Minimap object'''. Defines an object to be shown on the minimap | + | | 0x0E || UInt16 || '''Minimap object'''. Defines an object to be shown on the minimap. |
|- | |- | ||
| 0x10 || UInt16 || Always empty, but read by the game. | | 0x10 || UInt16 || Always empty, but read by the game. | ||
Line 54: | Line 49: | ||
| 0x12 || UInt16 || Always empty, but read by the game. | | 0x12 || UInt16 || Always empty, but read by the game. | ||
|- | |- | ||
− | | 0x14 || UInt16 || '''Cannon flag'''. If a track has no cannon, this is set to 0. If a track has a cannon and its <br/>setting is 0xFFFF, it is set to 0, too. Otherwise, it is set to the value of the cannon setting | + | | 0x14 || UInt16 || '''Cannon flag'''. If a track has no cannon, this is set to 0. If a track has a cannon and its <br/>setting is 0xFFFF, it is set to 0, too. Otherwise, it is set to the value of the cannon setting. |
|- | |- | ||
− | | 0x16 || UInt16 || Amount of CPU players | + | | 0x16 || UInt16 || Amount of CPU players. |
|- | |- | ||
− | | 0x18 || Byte[22] || '''Driver and vehicle settings for CPU players'''. First byte driver, second byte vehicle. <br/>0xFF for random driver / vehicle or unused slots | + | | 0x18 || Byte[22] || '''Driver and vehicle settings for CPU players'''. First byte driver, second byte vehicle. <br/>0xFF for random driver / vehicle or unused slots. |
|- | |- | ||
− | | 0x2E || Byte || '''Controller'''. 0x00 for ''free choice'', 0x01 for ''Wii-Wheel only'' | + | | 0x2E || Byte || '''Controller'''. 0x00 for ''free choice'', 0x01 for ''Wii-Wheel only''. |
|- | |- | ||
− | | 0x2F || Byte || Padding | + | | 0x2F || Byte || Padding. |
|- | |- | ||
| 0x30 || UInt16 || '''Common object files''' to load. Bit field for the different files. | | 0x30 || UInt16 || '''Common object files''' to load. Bit field for the different files. | ||
|- | |- | ||
− | | 0x32 || UInt16 || '''Score''' (amount of gates, amount of coins, etc) | + | | 0x32 || UInt16 || '''Score''' (amount of gates, amount of coins, etc). |
|- | |- | ||
− | | 0x34 || Byte || '''Intro settings'''. Between 0x00 and 0x03 | + | | 0x34 || Byte || '''Intro settings'''. Between 0x00 and 0x03: |
+ | * 0x00: no intro video | ||
+ | * 0x01: intro with Battle music | ||
+ | * 0x02: intro with VS Race music | ||
+ | * 0x03: Intro with Boss music | ||
|- | |- | ||
− | | 0x35 || Byte || Padding | + | | 0x35 || Byte || Padding. |
|- | |- | ||
− | | 0x36 || UInt16 || '''Unknown''', either 18000 (0x4650) for tracks with laps, | + | | 0x36 || UInt16 || '''Unknown''', either 18000 (0x4650) for tracks with laps, 36000 (0x8CA0) for tracks with a score, or 54000 (0xD2F0), exclusively used for the Giant Pokey competition. |
|- | |- | ||
− | | 0x38 || UInt16 || | + | | 0x38 || UInt16 || '''Unknown'''. |
|- | |- | ||
− | | | + | | 0x3A || UInt16 || This seems to be a '''checksum''' of the header. |
|- | |- | ||
|} | |} | ||
=== Game Modes === | === Game Modes === | ||
− | |||
Here are the known game modes: | Here are the known game modes: | ||
{| class="wikitable" | {| class="wikitable" | ||
+ | ! Value !! Description | ||
|- | |- | ||
− | + | | 0x00 || Time Trial. No position tracker. 3 Mushrooms, multiple KTPT, MSPT. | |
|- | |- | ||
− | | | + | | 0x01 || VS Race. Position tracker, single KTPT (player last), CPUs, continuing racing after finish. |
|- | |- | ||
− | | | + | | 0x03 || Many different objects. |
|- | |- | ||
− | | | + | | 0x04 || {{obj-ref|begoman_spike|Spiky Topmen}}, {{obj-ref|sanbo_big|big Pokey}}. |
|- | |- | ||
− | | | + | | 0x05 || Coins ({{obj-ref|coin|single coin}}, {{obj-ref|pile_coin|leafpile coin}}). |
|- | |- | ||
− | | | + | | 0x06 || {{obj-ref|starGate|Star gates}}. |
|- | |- | ||
− | | | + | | 0x07 || Hit CPUs with items to win (unused). No Position tracker, single KTPT (player first) or multiple, CPUs, MSPT (number of CPUs). |
|- | |- | ||
− | | 0x0B || Battle. No Position tracker, single KTPT (player first), CPUs, MSPT | + | | 0x0B || Battle. No Position tracker, single KTPT (player first) or multiple, CPUs, MSPT (number of CPUs). |
|- | |- | ||
− | | 0x0C || Battle. Position tracker, single KTPT (player first), CPUs, MSPT | + | | 0x0C || Battle. Position tracker, single KTPT (player first) or multiple, CPUs, MSPT (number of CPUs). |
|} | |} | ||
+ | |||
+ | Note that when there is no position tracker, the game always act like you're 12th. | ||
In game mode 0x03, many different [[objects]] will give you a point when you destroy, hit or activate them. The objects are: | In game mode 0x03, many different [[objects]] will give you a point when you destroy, hit or activate them. The objects are: | ||
Line 121: | Line 122: | ||
== RKCS == | == RKCS == | ||
− | |||
This is the part of a RKC file that contains the actual data. It only contains a [[YAZ0]] compressed [[U8]] file with a [[KMP]] file and some object files which are neither in the course, the competition bases or in one of the CommonObj files. | This is the part of a RKC file that contains the actual data. It only contains a [[YAZ0]] compressed [[U8]] file with a [[KMP]] file and some object files which are neither in the course, the competition bases or in one of the CommonObj files. | ||
Line 127: | Line 127: | ||
= Replacing and ripping RKC files = | = Replacing and ripping RKC files = | ||
− | |||
NOTE: The data blocks which were previously known as "RSF Files" (this name was invented by [[khacker35000vr]] to name unknown data groups) are '''not''' part of the actual competition. If you extract the VFF file and not just open it in a hex editor, you can see that there is no data after the RKC file. The "trash data" (RSF) in the VFF file after the RKC data is just random data from the previous competition, because [[Nintendo]] just copies the new RKC file to the specific offset and does not clear the rest of the file. So, when a new competition is smaller than the old one, those trash bytes stay in the file, even though they are not needed. | NOTE: The data blocks which were previously known as "RSF Files" (this name was invented by [[khacker35000vr]] to name unknown data groups) are '''not''' part of the actual competition. If you extract the VFF file and not just open it in a hex editor, you can see that there is no data after the RKC file. The "trash data" (RSF) in the VFF file after the RKC data is just random data from the previous competition, because [[Nintendo]] just copies the new RKC file to the specific offset and does not clear the rest of the file. So, when a new competition is smaller than the old one, those trash bytes stay in the file, even though they are not needed. | ||
== Replacing == | == Replacing == | ||
− | |||
* Search the RKC file in the [[VFF (File Format)|VFF File]]. | * Search the RKC file in the [[VFF (File Format)|VFF File]]. | ||
− | * Copy and paste (overwrite old data) the data of your custom RKC file at the good offset | + | * Copy and paste (overwrite old data) the data of your custom RKC file at the good offset. |
* If the new RKC file is larger than the older one this may not work. At the moment there is no tool to create larger VFF files. | * If the new RKC file is larger than the older one this may not work. At the moment there is no tool to create larger VFF files. | ||
== Ripping == | == Ripping == | ||
− | + | * Use [[Riivolution]] along with the savegame XML when a competition is in progress, or copy your savegame to SD with tools like Savegame Manager GX. | |
− | * Use [[Riivolution]] along with the savegame | ||
* Extract the wc24dl.vff with [http://marcan.st/transf/vffdump.py "vffdump.py"]. | * Extract the wc24dl.vff with [http://marcan.st/transf/vffdump.py "vffdump.py"]. | ||
− | * Open the file "DISTMAP.BIN" in a hex editor and search for "RKCT" | + | * Open the file "DISTMAP.BIN" in a hex editor and search for "RKCT". |
− | * Check the size and copy that amount of bytes to a new file (RKC) | + | * Check the size and copy that amount of bytes to a new file (RKC). |
= Misc. = | = Misc. = | ||
− | |||
* Custom tournaments are able to be made, and can be added to [[Leseratte]]'s competition system for [[Wiimmfi]]. | * Custom tournaments are able to be made, and can be added to [[Leseratte]]'s competition system for [[Wiimmfi]]. | ||
* All downloaded contents (competition and other players' ghost data) for Mario Kart Wii are saved in wc24dl.vff. | * All downloaded contents (competition and other players' ghost data) for Mario Kart Wii are saved in wc24dl.vff. | ||
= Tools = | = Tools = | ||
− | |||
The following tools can handle RKC files: | The following tools can handle RKC files: | ||
* [[RKC Editor]], by [[Leseratte]] | * [[RKC Editor]], by [[Leseratte]] | ||
+ | * [[Wexos's Toolbox]], by [[Wexos]] | ||
+ | |||
+ | A kaitai format description file can be found [https://github.com/RiiConnect24/Kaitai-Files/ on this GitHub repository]. | ||
− | [[Category:File Format]] | + | [[Category:File Format/MKW]] |
Latest revision as of 13:38, 28 September 2022
RKC Files (Revolution Kart Competition) are files downloaded by Mario Kart Wii using the WC24 download engine. The RKC file contains data and a U8 file with a new KMP for the competition. The RKC file is part of the DISTMAP.BIN file, which is stored inside the wc24dl.vff file in the savegame.
The maximum file size for a RKC file in the unmodified game is 20480 bytes. It is possible to change the maximum size by modifying the memory allocation size in Nwc24Manager's constructor (offset 0x80668BA4 PAL).
File Format
The RKC files consist of an RKCT header and an RKCO header, followed by an U8 archive (RKCS).
RKCT
The RKCT header, or the main header, is 0x10 bytes long:
Offset | Type | Description |
---|---|---|
0x00 | String | File magic. Always RKCT in ASCII. |
0x04 | UInt32 | Length of the data in bytes. |
0x08 | UInt32 | Length of all file headers (offset to the beginning of the U8 file). |
0x0C | UInt32 | Unknown, always 0x640. Maybe a version number? |
RKCO
The RKCO Header immediately follows the RKCT header. It contains all information for the competition. Stuff like Course ID, CommonObj that gets loaded and other information. The header is 0x3C bytes long:
Offset | Type | Description |
---|---|---|
0x00 | String | Section magic. Always RKCO in ASCII. |
0x04 | UInt16 | Game mode. |
0x06 | Byte | Course ID. |
0x07 | Byte | Engine class. 0: 50cc, 1: 100cc, 2: 150cc, 3: battle. |
0x08 | Byte | Amount of laps (laps, so triggered with checkpoints, not scores). |
0x09 | Byte | Padding. |
0x0A | UInt16 | Vehicle restriction. 0: karts only, 1: bikes only, 2: no restriction. |
0x0C | UInt16 | Camera angle. 3: normal camera, 7: camera from above. |
0x0E | UInt16 | Minimap object. Defines an object to be shown on the minimap. |
0x10 | UInt16 | Always empty, but read by the game. |
0x12 | UInt16 | Always empty, but read by the game. |
0x14 | UInt16 | Cannon flag. If a track has no cannon, this is set to 0. If a track has a cannon and its setting is 0xFFFF, it is set to 0, too. Otherwise, it is set to the value of the cannon setting. |
0x16 | UInt16 | Amount of CPU players. |
0x18 | Byte[22] | Driver and vehicle settings for CPU players. First byte driver, second byte vehicle. 0xFF for random driver / vehicle or unused slots. |
0x2E | Byte | Controller. 0x00 for free choice, 0x01 for Wii-Wheel only. |
0x2F | Byte | Padding. |
0x30 | UInt16 | Common object files to load. Bit field for the different files. |
0x32 | UInt16 | Score (amount of gates, amount of coins, etc). |
0x34 | Byte | Intro settings. Between 0x00 and 0x03:
|
0x35 | Byte | Padding. |
0x36 | UInt16 | Unknown, either 18000 (0x4650) for tracks with laps, 36000 (0x8CA0) for tracks with a score, or 54000 (0xD2F0), exclusively used for the Giant Pokey competition. |
0x38 | UInt16 | Unknown. |
0x3A | UInt16 | This seems to be a checksum of the header. |
Game Modes
Here are the known game modes:
Value | Description |
---|---|
0x00 | Time Trial. No position tracker. 3 Mushrooms, multiple KTPT, MSPT. |
0x01 | VS Race. Position tracker, single KTPT (player last), CPUs, continuing racing after finish. |
0x03 | Many different objects. |
0x04 | Spiky Topmen, big Pokey. |
0x05 | Coins (single coin, leafpile coin). |
0x06 | Star gates. |
0x07 | Hit CPUs with items to win (unused). No Position tracker, single KTPT (player first) or multiple, CPUs, MSPT (number of CPUs). |
0x0B | Battle. No Position tracker, single KTPT (player first) or multiple, CPUs, MSPT (number of CPUs). |
0x0C | Battle. Position tracker, single KTPT (player first) or multiple, CPUs, MSPT (number of CPUs). |
Note that when there is no position tracker, the game always act like you're 12th.
In game mode 0x03, many different objects will give you a point when you destroy, hit or activate them. The objects are:
and probably some more.
There are a few more game modes (the ones which do not appear in the list of game modes above), but their meaning and usage is unknown.
RKCS
This is the part of a RKC file that contains the actual data. It only contains a YAZ0 compressed U8 file with a KMP file and some object files which are neither in the course, the competition bases or in one of the CommonObj files.
This U8 file must contain the folders AIParam and ItemSlotTable, but both of them may be empty if you do not want to modify the AI settings or the items.
Replacing and ripping RKC files
NOTE: The data blocks which were previously known as "RSF Files" (this name was invented by khacker35000vr to name unknown data groups) are not part of the actual competition. If you extract the VFF file and not just open it in a hex editor, you can see that there is no data after the RKC file. The "trash data" (RSF) in the VFF file after the RKC data is just random data from the previous competition, because Nintendo just copies the new RKC file to the specific offset and does not clear the rest of the file. So, when a new competition is smaller than the old one, those trash bytes stay in the file, even though they are not needed.
Replacing
- Search the RKC file in the VFF File.
- Copy and paste (overwrite old data) the data of your custom RKC file at the good offset.
- If the new RKC file is larger than the older one this may not work. At the moment there is no tool to create larger VFF files.
Ripping
- Use Riivolution along with the savegame XML when a competition is in progress, or copy your savegame to SD with tools like Savegame Manager GX.
- Extract the wc24dl.vff with "vffdump.py".
- Open the file "DISTMAP.BIN" in a hex editor and search for "RKCT".
- Check the size and copy that amount of bytes to a new file (RKC).
Misc.
- Custom tournaments are able to be made, and can be added to Leseratte's competition system for Wiimmfi.
- All downloaded contents (competition and other players' ghost data) for Mario Kart Wii are saved in wc24dl.vff.
Tools
The following tools can handle RKC files:
- RKC Editor, by Leseratte
- Wexos's Toolbox, by Wexos
A kaitai format description file can be found on this GitHub repository.