Riivolution does its magic according to XML files found in the folder /riivolution on an SD card or USB drive. The format is very extensive and flexible; many different kind of game modifications can be made this way. This page will attempt to explain how to write powerful XML files. The Riivolution Schema can also be used to verify that your XML is set up properly.
If you're just interested in getting Riivolution running, or want to see an example, look over at the Patch Templates page; this page is meant for power users and people planning on releasing packaged game mods.
Contents |
Riivolution patch XMLs are made up of three parts:
Each element attribute has a type of data that behaves in a certain way.
An integer type only accepts numbers, which must be in either decimal or hexadecimal form. Numbers will only be recognized as hexadecimal if preceeded by "0x".
A boolean type can only be true or false, yes or no.
A hex string is a string of hex characters, treated as data. It may or may not be preceeded by "0x", and the number of characters in it must be a multiple of two (it cannot have half a byte).
A string is just a string of one or more characters. There's nothing really special about them.
A path is special because they can be either absolute or relative to a root, which defaults to /riivolution. The root can be changed at either the wiidisc or patch level, and whenever a relative path is used, it is combined with the current root.
A param isn't an attribute type, but rather, a special node that can be used in many different places. They can be applied at the option, choice, or patch level under options. They assign a value to a name, which can be used for dynamic replacements within paths of patches.
For example, if I set a param to be the following...
<param name="slot" value="1" />
Then put this inside an option, any patches used in that option will be able to have their paths affected by it. The format to use in a path is "${name}", so I could set up a patch like so...
<file disc="/testfile{$slot}.arc" external="test{$slot}.arc" />
Which would replace {$slot} with "1" when applied. Note that if a param name isn't set, it will be blanked out. So if a different option were to use this file patch, it would try replacing "/testfile.arc" rather than "/testfile1.arc" as it would under the option with the param set.
Riivolution provides a few built-in params that you can use inside of your XMLs. They describe the disc currently in the drive and are as follows:
{$__gameid} contains the first three characters of the Game ID. For example, "RSB" for Super Smash Bros. Brawl
{$__region} contains the region character of the Game ID, usually "E", "P", or "J"
{$__maker} contains the maker code of the Game ID. For example, "01" is Nintendo.
Using these together can be used to get the full Game ID, "RSBE01", like so:
{$__gameid}{$__region}{$__maker}
All Riivolution XMLs are encompassed in a root wiidisc node, like so:
<wiidisc version="1" root="/riivolution">
...
</wiidisc>
The id tag is meant to make sure an XML is only applied to the game it was written for. If it is ommitted, the XML will be loaded for any game. There can not be more than one ID tag in one XML.
The id tag can specify the game ID, developer, disc number, version, and region(s). Any combination of these are allowed, and anything ommitted or empty will allow everything through. Here's an example:
<id game="SZA" developer="69" disc="0" version="0">
<region type="P" />
<region type="E" />
</id>
The previous example will make sure the XML works for both PAL and NTSC versions of Rock Band 2.
All sections of an XML must be encompassed by options tags:
<options>
...
</options>
There are no attributes that can be used here.
Macros can be used to clone an option multiple times, while giving it a different name and set of params for each clone.
<macro id="optionid" name="New Option Name">
<param name="paramname" value="value" />
</macro>
A section represents a page in the GUI, though they can be split up into multiple pages if they contain too many options. They contain options, and have no attribute but a name:
<section name="Levels">
...
</section>
An option represents something modifiable in the program. It contains choices, and only one can be active at any given time. It can hold params, and also can always be set to disabled.
<option id="optionid" name="My Option" default="1">
...
</option>
A choice represents one choice within an option. It can also hold params, and references patches to be applied; these patch subnodes can also have params applied to them.
<choice name="Choice Name">
<patch id="patchid" />
<patch id="anotherpatch />
</choice>
A patch is a set of commands that Riivolution will execute when the proper choice is selected. It can contain file, folder, and memory patches, and follows this format...
<patch id="patchid" root="/path">
...
</patch>
A file patch will replace the contents of one file on disc with one from an external device.
<file disc="/filename.arc" external="filename.arc" resize="true" create="false" offset="0x10" length="0x100" />
A folder patch replaces a number of files from an external device onto the disc.
<folder disc="/filename.arc" external="filename.arc" resize="true" create="false" recursive="true" length="0x1000" />
A savegame patch will redirect a game's savegame to the external path specified. It can be used to store a save on SD/USB/Wifi without corrupting a player's original save when playing a game hack with different stages. Check out the Savegame Template for a universal savegame XML.
<savegame external="/riivolution/save" clone="true" />
There are a few different kinds of memory patches, and they all deal with patching the Wii's memory right before a game loads. They can be used to apply various different ASM hacks to games.
NOTE: The valuefile attribute is a path, and params can be used in it as of Riivolution v1.04.
The default memory patch looks like the following, and is used to write values to a set address...
<memory offset="0x80001000" value="0F73AB3D" original="1337BAAD" /> <memory offset="0x80001000" valuefile="/file.bin" />
An Ocarina Patch will look in the dol for the value specified, and then find the next occurring blr and replace it with a branch to offset.
<memory offset="0x80001800" value="0F73AB3D" ocarina="true" />
A memory search patch can be used to replace a pattern in the main executable dynamically.
<memory original="1337BAAD" value="831378F2" align="4" search="true" />