Difference between revisions of "RKC (File Format)"

From Custom Mario Kart
Jump to navigation Jump to search
m
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 [[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.  
+
'''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.  
  
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.  
+
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.  
  
= File Format =
+
Known editors:
 +
* [[RKC Editor]] by Leseratte
 +
<br/>
  
The RKC files contain multiple headers, they are all explained here.
+
== Header ==
 
+
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 !! Type !! Description
+
! Offset
 +
! Type
 +
! Description
 
|-
 
|-
| 0x00 || String || '''File magic'''. RKCT in ASCII
+
| 0x00
 +
| char[4]
 +
| {{yes|'RKCT' in ASCII; File identifier}}
 
|-
 
|-
| 0x04 || UInt32 || '''Length of the data''' in bytes
+
| 0x04
 +
| int
 +
| {{yes|Length of the data in bytes.}}
 
|-
 
|-
| 0x08 || UInt32 || '''Length of all file headers''' (offset to the beginning of the [[SZS (File Format)|YAZ0]] file)
+
| 0x08
 +
| int
 +
| {{yes|Length of all file headers. (offset to the beginning of the [[SZS (File Format)|Yaz0]] file)}}
 
|-
 
|-
| 0x0C || UInt32 || '''Unknown''', always 0x640. Maybe a version number?
+
| 0x0C
 +
| 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.
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:
+
This header is 0x3C in length
 
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Offset !! Type !! Description
+
! Offset
 +
! Type
 +
! Description
 
|-
 
|-
| 0x00 || String || '''Section magic'''. RKCO in ASCII
+
| 0x00
 +
| char[4]
 +
| {{yes|'RKCO' in ASCII; File identifier}}
 
|-
 
|-
| 0x04 || UInt16 || [[#Game Modes|Game mode]]
+
| 0x04
 +
| 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: Spiky Topmen, 5: Coins, 6: Stargates}}
 
|-
 
|-
| 0x06 || Byte || Course ID
+
| 0x06
 +
| byte
 +
| {{yes|'''Course ID'''}}
 
|-
 
|-
| 0x07 || Byte || '''Engine class'''. 0: 50cc, 1: 100cc, 2: 150cc, 3: battle
+
| 0x07
 +
| byte
 +
| {{yes|'''Engine class'''. 0: 50cc, 1: 100cc, 2: 150cc, 3: battle}}
 
|-
 
|-
| 0x08 || Byte || '''Amount of laps''' (laps, so triggered with checkpoints, not scores)
+
| 0x08
 +
| byte
 +
| {{yes|'''Amount of laps''' (laps, so triggered with checkpoints, not scores)}}
 
|-
 
|-
| 0x09 || Byte || Padding
+
| 0x09
 +
| byte
 +
| {{yes|''(always empty, unused)''}}
 
|-
 
|-
| 0x0A || UInt16 || '''Vehicle restriction'''. 0: karts only, 1: bikes only, 2: no restriction
+
| 0x0A
 +
| short
 +
| {{yes|'''Vehicle restriction''' (0: karts only, 1: bikes only, 2: no restriction)}}
 
|-
 
|-
| 0x0C || UInt16 || '''Camera angle'''. 3: normal camera, 7: camera from above
+
| 0x0C
 +
| short
 +
| {{yes|'''Camera angle''' (3: normal camera, 7: camera from above)}}
 
|-
 
|-
| 0x0E || UInt16 || '''Minimap object'''. Defines an object to be shown on the minimap
+
| 0x0E
 +
| short
 +
| {{yes|'''Minimap object'''. Defines an object to be shown on the minimap}}
 
|-
 
|-
| 0x10 || UInt32 || Padding
+
| 0x10
 +
| short
 +
| {{maybe|''(always empty)''}}
 
|-
 
|-
| 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
+
| 0x12
 +
| short
 +
| {{maybe|''(always empty)''}}
 
|-
 
|-
| 0x16 || UInt16 || Amount of CPU players
+
| 0x14
 +
| 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.}}
 
|-
 
|-
| 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
+
| 0x16
 +
| short
 +
| {{yes|'''Amount of CPU players'''}}
 
|-
 
|-
| 0x2E || Byte || '''Controller'''. 0x00 for ''free choice'', 0x01 for ''Wii-Wheel only''
+
| 0x18
 +
| 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}}
 
|-
 
|-
| 0x2F || Byte || Padding
+
| 0x2E
 +
| byte
 +
| {{yes|'''Controller'''. 0x00 for "free choice", 0x01 for "Wii-Wheel-only" }}
 
|-
 
|-
| 0x30 || UInt16 || '''Common object files''' to load. Bit field for the different files.
+
| 0x2F
 +
| byte
 +
| {{yes|''(always empty, unused)''}}
 
|-
 
|-
| 0x32 || UInt16 || '''Score''' (amount of gates, amount of coins, etc)
+
| 0x30
 +
| short
 +
| {{yes|'''Common object files''' to load. Bit field for the different files. }}
 
|-
 
|-
| 0x34 || Byte || '''Intro settings'''. Between 0x00 and 0x03, 0x00: no intro video
+
| 0x32
 +
| short
 +
| {{yes|'''Score''' (amount of gates, amount of coins, ...)}}
 
|-
 
|-
| 0x35 || Byte || Padding
+
| 0x34
 +
| byte
 +
| {{yes|'''Intro settings'''. Between 0x00 and 0x03, 0x00: no intro video}}
 
|-
 
|-
| 0x36 || UInt16 || '''Unknown''', either 0x4650 for tracks with laps, or 0x8CA0 for tracks with a score. <br/>Not used by the game
+
| 0x35
 +
| byte
 +
| {{yes|''(always empty, unused)''}}
 
|-
 
|-
| 0x38 || UInt16 || Padding
+
| 0x36
 +
| short
 +
| {{maybe|Unknown, either 18,000 for tracks with laps, or 36,000 for tracks with a score. <br/>Not used by the game}}
 
|-
 
|-
| 0x3A || UInt16 || This seems to be a '''checksum'''
+
| 0x38
 +
| short
 +
| {{yes|''(always empty, unused)''}}
 +
|-
 +
| 0x3A
 +
| short
 +
| {{maybe|This seems to be a checksum. }}
 
|-
 
|-
 
|}
 
|}
  
=== Game Modes ===
+
Description of the "normal" game modes:  
 
 
Here are the known game modes:
 
  
{| class="wikitable"
+
0: Time Trial => No position tracker. 3 Mushrooms, multiple KTPT, MSPT<br/>
|-
+
1: VS Race => Position tracker, single KTPT (player last), CPUs, continuing racing after finish<br/>
! Value !! Description
+
11: Battle => No Position tracker, single KTPT (player first), CPUs, MSPT<br/>
|-
+
12: Battle => Position tracker, single KTPT (player first), CPUs, MSPT<br/>
| 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:
+
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:  
  
* {{obj-ref|basabasa|Bat}}
+
<ul>
* {{obj-ref|K_bomb_car|Bomb Car}}
+
<li>Goomba</li>
* {{obj-ref|poihana|Cataquack}}
+
<li>Crab</li>
* {{obj-ref|crab|Crab}}
+
<li>Cataquack</li>
* {{obj-ref|kuribo|Goomba}}
+
<li>Monty Mole</li>
* {{obj-ref|karehayama|Leaf Pile}}
+
<li>Leaf pile</li>
* {{obj-ref|choropu|Monty Mole}}
+
<li>woodbox</li>
* {{obj-ref|sanbo|Pokey}}
+
<li>The bats from Warios Gold Mine</li>
* {{obj-ref|woodbox|Woodbox}}
+
<li>Bomb cars (not normal cars!) from Moonview Highway</li>
and probably some more.
+
<li>Pokeys from DS Desert Hills / Dry Dry Ruins</li>
 +
<li>Some more unknown</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 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 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 [[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.
+
The KMP file of the competition has a few interesting things:
 +
* 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 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 when 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, but 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. ==
= Misc. =
+
* Custom tournaments are not a very popular thing, only Vulcanus2 succesfully made a custom tournament and probably only a few others have played it.
 
 
* 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.
 
+
* It is unknown if wc24dl.vff is a distributable file.
= Tools =
 
 
 
The following tools can handle RKC files:
 
* [[RKC Editor]], by [[Leseratte]]
 
  
 
[[Category:File Format]]
 
[[Category:File Format]]

Revision as of 19:11, 21 August 2016

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 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.

Known editors:


Header

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

RKCT

The RKCT, or main header, is 0x10 in length.

Offset Type Description
0x00 char[4] 'RKCT' in ASCII; File identifier
0x04 int Length of the data in bytes.
0x08 int Length of all file headers. (offset to the beginning of the Yaz0 file)
0x0C int Unknown (always 0x640 = 1600), 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. This header is 0x3C in length

Offset Type Description
0x00 char[4] 'RKCO' in ASCII; File identifier
0x04 short Game mode - laps or points. Possible values:
0, 1, 11, 12: Race, see below
3: many different objects, see the list below
4: Spiky Topmen, 5: Coins, 6: Stargates
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 (always empty, unused)
0x0A short Vehicle restriction (0: karts only, 1: bikes only, 2: no restriction)
0x0C short Camera angle (3: normal camera, 7: camera from above)
0x0E short Minimap object. Defines an object to be shown on the minimap
0x10 short (always empty)
0x12 short (always empty)
0x14 short 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 short Amount of CPU players
0x18 short[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 (always empty, unused)
0x30 short Common object files to load. Bit field for the different files.
0x32 short Score (amount of gates, amount of coins, ...)
0x34 byte Intro settings. Between 0x00 and 0x03, 0x00: no intro video
0x35 byte (always empty, unused)
0x36 short Unknown, either 18,000 for tracks with laps, or 36,000 for tracks with a score.
Not used by the game
0x38 short (always empty, unused)
0x3A short This seems to be a checksum.

Description of the "normal" game modes:

0: Time Trial => No position tracker. 3 Mushrooms, multiple KTPT, MSPT
1: VS Race => Position tracker, single KTPT (player last), CPUs, continuing racing after finish
11: Battle => No Position tracker, single KTPT (player first), CPUs, MSPT
12: Battle => Position tracker, single KTPT (player first), CPUs, MSPT

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:

  • Goomba
  • Crab
  • Cataquack
  • Monty Mole
  • Leaf pile
  • woodbox
  • The bats from Warios Gold Mine
  • Bomb cars (not normal cars!) from Moonview Highway
  • Pokeys from DS Desert Hills / Dry Dry Ruins
  • Some more 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

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.

The KMP file of the competition has a few interesting things:

  • 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

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.

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, but 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 not a very popular thing, only Vulcanus2 succesfully made a custom tournament and probably only a few others have played it.
  • All downloaded contents (competition and other players' ghost data) for Mario Kart Wii are saved in wc24dl.vff.
  • It is unknown if wc24dl.vff is a distributable file.