Difference between revisions of "RKC (File Format)"

From Custom Mario Kart
Jump to navigation Jump to search
Line 1: Line 1:
'''RKC Files''' are files downloaded by Mario Kart Wii using the WC24 download engine. The RKC file contains data and an SZS file with a new [[KMP (File Format)|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.  
+
'''RKC Files''' are files downloaded by [[Mario Kart Wii]] using the WC24 download engine. The RKC file contains data and a [[SZS]] 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 an RKC file in the unmodified game is 20,480 bytes. It might be possible to change that maximum size by finding the call to malloc() which allocates the space for the RKC data in the game's memory.  
+
The maximum file size for a RKC file in the unmodified game is 20480 bytes. It might be possible to change the maximum size by finding the call to malloc() which allocates the space for the RKC data in the game's memory.  
  
Known editors:
+
= File Format =
* [[RKC Editor]] by Leseratte
 
<br/>
 
  
== Header ==
+
The RKC files contain multiple headers, they are all explained here.
The RKC Files contain multiple headers, they are all explained here.
+
 
 +
== RKCT ==
 +
 
 +
The RKCT header, or the main header, is 0x10 bytes long:
  
=== RKCT ===
 
The RKCT, or main header, is 0x10 in length.
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Offset
+
! Offset !! Type !! Description
! Type
 
! Description
 
 
|-
 
|-
| 0x00
+
| 0x00 || String || '''File magic'''. RKCT in ASCII
| char[4]
 
| {{yes|'RKCT' in ASCII; File identifier}}
 
 
|-
 
|-
| 0x04
+
| 0x04 || UInt32 || '''Length of the data''' in bytes
| int
 
| {{yes|Length of the data in bytes.}}
 
 
|-
 
|-
| 0x08
+
| 0x08 || Int32 || '''Length of all file headers''' (offset to the beginning of the [[SZS (File Format)|YAZ0]] file)
| int
 
| {{yes|Length of all file headers. (offset to the beginning of the [[SZS (File Format)|Yaz0]] file)}}
 
 
|-
 
|-
| 0x0C
+
| 0x0C || UInt32 || '''Unknown''', always 0x640. Maybe a version number?
| int
 
| {{maybe|'''Unknown''' (always 0x640 &#x3D; 1600), maybe a version number?}}
 
 
|}
 
|}
  
=== RKCO ===
+
== RKCO ==
The RKCO Header contains all information for the competition. Stuff like course id, CommonObj that gets loaded and other information.
+
 
This header is 0x3C in length
+
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
+
! Offset !! Type !! Description
! Type
 
! Description
 
 
|-
 
|-
| 0x00
+
| 0x00 || String || '''Section magic'''. RKCO in ASCII
| char[4]
 
| {{yes|'RKCO' in ASCII; File identifier}}
 
 
|-
 
|-
| 0x04
+
| 0x04 || UInt16 || [[#Game Modes|Game mode]]
| short
 
| {{yes|'''Game mode''' - laps or points. Possible values: <br/>0, 1, 11, 12: Race, see below<br/>3: many different objects, see the list below<br/>4: Spikey Topmen, 5: Coins, 6: Stargates}}
 
 
|-
 
|-
| 0x06
+
| 0x06 || Byte || Course ID
| byte
 
| {{yes|'''Course ID'''}}
 
 
|-
 
|-
| 0x07
+
| 0x07 || Byte || '''Engine class'''. 0: 50cc, 1: 100cc, 2: 150cc, 3: battle
| byte
 
| {{yes|'''Engine class'''. 0: 50cc, 1: 100cc, 2: 150cc, 3: battle}}
 
 
|-
 
|-
| 0x08
+
| 0x08 || Byte || '''Amount of laps''' (laps, so triggered with checkpoints, not scores)
| byte
 
| {{yes|'''Amount of laps''' (laps, so triggered with checkpoints, not scores)}}
 
 
|-
 
|-
| 0x09
+
| 0x09 || Byte || Padding
| byte
 
| {{yes|''(always empty, unused)''}}
 
 
|-
 
|-
| 0x0A
+
| 0x0A || UInt16 || '''Vehicle restriction'''. 0: karts only, 1: bikes only, 2: no restriction
| short
 
| {{yes|'''Vehicle restriction''' (0: karts only, 1: bikes only, 2: no restriction)}}
 
 
|-
 
|-
| 0x0C
+
| 0x0C || UInt16 || '''Camera angle'''. 3: normal camera, 7: camera from above
| short
 
| {{yes|'''Camera angle''' (3: normal camera, 7: camera from above)}}
 
 
|-
 
|-
| 0x0E
+
| 0x0E || UInt16 || '''Minimap object'''. Defines an object to be shown on the minimap
| short
 
| {{yes|'''Minimap object'''. Defines an object to be shown on the minimap}}
 
 
|-
 
|-
| 0x10
+
| 0x10 || UInt16 || Padding
| short
 
| {{maybe|''(always empty)''}}
 
 
|-
 
|-
| 0x12
+
| 0x12 || UInt16 || Padding
| short
 
| {{maybe|''(always empty)''}}
 
 
|-
 
|-
| 0x14
+
| 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
| short
 
| {{yes|'''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
+
| 0x16 || UInt16 || Amount of CPU players
| short
 
| {{yes|'''Amount of CPU players'''}}
 
 
|-
 
|-
| 0x18
+
| 0x18 || Int16[11] || '''Driver and vehicle settings for CPU players'''. First byte driver, second byte vehicle. <br/>0xFF for random driver / vehicle or unused slots
| short[11]
 
| {{yes|'''Driver and vehicle settings for CPU players'''. First byte driver, second byte vehicle. <br/>0xFF for random driver / vehicle or unused slots}}
 
 
|-
 
|-
| 0x2E
+
| 0x2E || Byte || '''Controller'''. 0x00 for ''free choice'', 0x01 for ''Wii-Wheel only''
| byte
 
| {{yes|'''Controller'''. 0x00 for "free choice", 0x01 for "Wii-Wheel-only" }}
 
 
|-
 
|-
| 0x2F
+
| 0x2F || Byte || Padding
| byte
 
| {{yes|''(always empty, unused)''}}
 
 
|-
 
|-
| 0x30
+
| 0x30 || UInt16 || '''Common object files''' to load. Bit field for the different files.
| short
 
| {{yes|'''Common object files''' to load. Bit field for the different files. }}
 
 
|-
 
|-
| 0x32
+
| 0x32 || UInt16 || '''Score''' (amount of gates, amount of coins, etc)
| short
 
| {{yes|'''Score''' (amount of gates, amount of coins, ...)}}
 
 
|-
 
|-
| 0x34
+
| 0x34 || Byte || '''Intro settings'''. Between 0x00 and 0x03, 0x00: no intro video
| byte
 
| {{yes|'''Intro settings'''. Between 0x00 and 0x03, 0x00: no intro video}}
 
 
|-
 
|-
| 0x35
+
| 0x35 || Byte || Padding
| byte
 
| {{yes|''(always empty, unused)''}}
 
 
|-
 
|-
| 0x36
+
| 0x36 || UInt16 || '''Unknown''', either 0x4650 for tracks with laps, or 0x8CA0 for tracks with a score. <br/>Not used by the game
| short
 
| {{maybe|Unknown, either 18,000 for tracks with laps, or 36,000 for tracks with a score. <br/>Not used by the game}}
 
 
|-
 
|-
| 0x38
+
| 0x38 || UInt16 || Padding
| short
 
| {{yes|''(always empty, unused)''}}
 
 
|-
 
|-
| 0x3A
+
| 0x3A || UInt16 || This seems to be a '''checksum'''
| short
 
| {{maybe|This seems to be a checksum. }}
 
 
|-
 
|-
 
|}
 
|}
  
Description of the "normal" game modes:
+
=== Game Modes ===
  
0: Time Trial => No position tracker. 3 Mushrooms, multiple KTPT, MSPT<br/>
+
Here are the known game modes:
1: VS Race => Position tracker, single KTPT (player last), CPUs, continuing racing after finish<br/>
 
11: Battle => No Position tracker, single KTPT (player first), CPUs, MSPT<br/>
 
12: Battle => Position tracker, single KTPT (player first), CPUs, MSPT<br/>
 
  
Game mode 3 is interesting; in this game mode, many different objects give you a point when you destroy / hit / activate them, including the following:  
+
{| 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 || Spikey Topmen
 +
|-
 +
| 0x05 || Coins
 +
|-
 +
| 0x06 || Star gates
 +
|-
 +
| 0x0B || Battle. No Position tracker, single KTPT (player first), CPUs, MSPT
 +
|-
 +
| 0x0C || Battle. Position tracker, single KTPT (player first), CPUs, MSPT
 +
|}
 +
 
 +
In game mode 0x03, many different [[objects]] will give you a point when you destroy, hit or activate them. The objects are:
  
<ul>
+
* {{obj-ref|basabasa|Bat}}
<li>Goomba</li>
+
* {{obj-ref|K_bomb_car|Bomb Car}}
<li>Crab</li>
+
* {{obj-ref|poihana|Cataquack}}
<li>Cataquack</li>
+
* {{obj-ref|crab|Crab}}
<li>Monty Mole</li>
+
* {{obj-ref|kuribo|Goomba}}
<li>Leaf pile</li>
+
* {{obj-ref|karehayama|Leaf Pile}}
<li>woodbox</li>
+
* {{obj-ref|choropu|Monty Mole}}
<li>The bats from Warios Gold Mine</li>
+
* {{obj-ref|sanbo|Pokey}}
<li>Bomb cars (no normal cars!) from Moonview Highway</li>
+
* {{obj-ref|woodbox|Woodbox}}
<li>Pokeys from DS Desert Hills / Dry Dry Ruins</li>
+
and probably some more.
<li>and probably some more which I forgot</li>
 
</ul>
 
  
 
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.
 
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 ===
+
== RKCS ==
This is the part of a RKC file that contains the actual data. It only contains a Yaz0 compression (SZS file) of a KMP file and some object files which are neither in the course the competition bases on nor in one of the CommonObj files.
 
  
This SZS 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.
+
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.  
  
The KMP file of the competition has a few interesting things:
+
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.
* Not all sections are included (if there are no CPU players, there is no need for CPU routes), if there are no items, or at least no bullet bill and no red shell, the item routes may also be missing.
 
* The MSPT section is included (stop point) and may have multiple entries
 
* There can be multiple start points, like in a battle.
 
  
 
= 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 when 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, but 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 the Savegame Manager GX
 
* Use [[riivolution]] along with the savegame xml when a competition is in progress, or copy your savegame to SD with tools like the Savegame Manager GX
 
* 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. ==
+
 
* Custom tournaments are able to be made, and can be added to Leseratte's competition system for Wiimmfi.
+
= 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.
 
* 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]]
  
 
[[Category:File Format]]
 
[[Category:File Format]]

Revision as of 00:36, 20 July 2016

RKC Files are files downloaded by Mario Kart Wii using the WC24 download engine. The RKC file contains data and a SZS 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 might be possible to change the maximum size by finding the call to malloc() which allocates the space for the RKC data in the game's memory.

File Format

The RKC files contain multiple headers, they are all explained here.

RKCT

The RKCT header, or the main header, is 0x10 bytes long:

Offset Type Description
0x00 String File magic. RKCT in ASCII
0x04 UInt32 Length of the data in bytes
0x08 Int32 Length of all file headers (offset to the beginning of the YAZ0 file)
0x0C UInt32 Unknown, always 0x640. Maybe a version number?

RKCO

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:

Offset Type Description
0x00 String Section magic. 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 Padding
0x12 UInt16 Padding
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 Int16[11] 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, 0x00: no intro video
0x35 Byte Padding
0x36 UInt16 Unknown, either 0x4650 for tracks with laps, or 0x8CA0 for tracks with a score.
Not used by the game
0x38 UInt16 Padding
0x3A UInt16 This seems to be a checksum

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 Spikey Topmen
0x05 Coins
0x06 Star gates
0x0B Battle. No Position tracker, single KTPT (player first), CPUs, MSPT
0x0C Battle. Position tracker, single KTPT (player first), CPUs, MSPT

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 the 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: