prevnext   » SZS: Wiimms SZS Toolset » wstrt: Wiimms StaticR Tool » wstrt patch

wstrt patch

Patch 'main.dol and 'StaticR.rel' files of Mario Kart Wii. No backup is made.

Contents

1.   Syntax

wstrt PATCH [file]...

2.   Options

Options
Option Param Description
-d --dest path Define a destination path (directory/file). The destination - means: write to standard output.

The path may contain escape sequences: %Q is replaced by the fully qualified source name. %P and %F are replaced by the source path or by the filename. %N and %E are replaced by source filename without extension or by the source extension. Finally, %T is replaced by the default extension of the destination format.

A '?' direct behind '%' in %E and %T conversions avoid that the same extension is used twice in row.

-D --DEST path Like --dest, but create the directory path automatically.
-E --esc char Define an alternative escape character for destination files. The default is '%'. For Windows batch files it is a good choice to set '-E$'.
-o --overwrite Overwrite already existing files without warning and ignore option --number.
--number If a file already exist, append a number directly before the file extension to make the filename unique. If other numbered files already exist (ignoring case), use the maximum existing index+1. --num is a short cut.
-r --remove-dest Remove already existing files before creating it. If set, --overwrite is ignored. --rm-dest is a short cut.
-u --update Create only files that do not exist. Already existing files are ignored without warning. If set, --overwrite and --remove-dest are ignored.
-p --preserve Preserve file times (atime+mtime) while converting or copying files.
-i --ignore Ignore non existing source files without warning.
-T --tracks tracks Define a new track order. A comma separated list in the format [a=]b or a:=b is expected. 'a' and 'b' are track names or slot numbers. 'a' is the destination slot and 'b' the assigned track. If 'a' is omitted, the next slot is used; this means [a=]b,c,d is possible.

Tracks will only be exchanged so that always all tracks are assigned. But if using ':=' the new slots are assigned without exchanging and the old values are lost.

-A --arenas arenas Define a new arena order. A comma separated list in the format [a=]b or a:=b is expected. 'a' and 'b' are arena names or slot numbers. 'a' is the destination slot and 'b' the assigned arena. If 'a' is omitted, the next slot is used; this means [a=]b,c,d is possible.

Arenas will only be exchanged so that always all arenas are assigned. But if using ':=' the new slots are assigned without exchanging and the old values are lost.

-R --region region If 'region' is an unsigned number, the region for online versus races and for battles is patched to the entered number. If the number is prefixed by the letter 't', a test mode is enabled and the places are patched with ascending numbers.

Otherwise a keyword is expected. Official regions are: JAPAN(0), AMERICA(1), EUROPE(2), AUSTRALIA(OCEANIA,3), KOREA(4), TAIWAN(5) and CHINA(6). RESTORE restores the original Nintendo values and NONE disables region patching (default).

See http://wiimm.de/r/ctw/Custom_Track_Regions for other regions.

--vs-region region Same as --region, but only for online versus races.
--bt-region region Same as --region, but only for online battles.
--all-ranks [=mode] If set to ON (default without parameter), the server query to Nintendos servers is manipulated, so that the player will find all players in online races independent of their ranking points. Value RESTORE disables this feature and restores Nintendos original query. Value NONE disables this kind of patching (default).
--https mode Patch the https strings of REL and DOL files. 'mode' is one of the following keywords:

RESTORE restores the original URLs and domains.

HTTP replaces HTTPS requests by HTTP and sub-domain 'naswii.' by 'nas.'.

DOMAIN replace HTTPS requests by HTTP and the domain 'nintendowifi.net' by a domain specified by option --domain.

SAKE0 same as DOMAIN, but don't replace URLs with SAKE domain.

SAKE1 same as SAKE0, but replace HTTPS of SAKE domains.

--domain dom Define a domain for option --https. The default is 'wiimmfi.de'.
--wiimmfi Patch the files for the new custom server. It is a short cut for »--https domain --domain wiimmfi.de«.
--vs char Reset (str is empty) or replace the second character of 'vs' to create an own online world for versus races. The file StaticR.rel will be patched at 4 places.
--bt char Reset (str is empty) or replace the second character of 'bt' to create an own online world for battles. The file StaticR.rel will be patched at 4 places.
--meno Patch some 'MenuSingle' and 'MenuMulti' strings of file StaticR.rel for online usage to 'MenO*' (MenuOnline) to distinguish between offline and online races.
--add-ctcode If source is an original main.dol file of MKWii, then append 2 sections (usually T2 and D8) with CT-CODE. The CTCODE is inserted after sections defined by --add-section and then only, if there are no address collisions.

If --ct-dir is used, then files named rmc[ejp]/boot_code.bin and boot_code.bin for T2, and rmc[ejp]/boot_data.bin and boot_data.bin for D8 are searched.

--ct-dir dir Define a search directory for CT-CODE parts and use the internal copies only, if no valid file is found. Each file is searched without and then with extension '.bz2'. For both cases bzip2 files are detected and decompressed. Only files with correct file type are accepted.

Use this option multiple times to define more than one search directory.

--add-section file Each option call adds the filename to an internal list. Each file must be of type GCT, GCH or WCH. All GCT files together are combined with an internal code handler to one section (like a GCH file). GCH and WCH define sections and patches. The defined sections are added and VBI hooks are optionally initialized. Use option --force to allow overlapped sections. Use option --verbose up to 2 times for a log.

The intention of this option is to add a Gecko Code Handler and cheat codes to a main.dol for automatic execution.

--gct-move If a section is of type gecko code handler + cheat code, and the space for the cheat codes is too small, then make the heap smaller and move the cheat codes before the FST section. If set twice, move the cheat codes always.
--gct-addr address If --gct-move is active, a text section is created to manage the code handling. This section is only needed at start and is placed by default at address 0c802c0000 (good address for all 4 regions) as part of BSS. This option changes the start address of the section. If address is 0 or invalid, then unused BSS space is searched.
--gct-space size Define the minimal space for the code part of --gct-move. This value is ignored, if it is smaller than the size of the cheat codes. This option was only implemented to test the memory allocation by --gct-move with large blocks.
--force Accept overlapped sections.

3.   Patching StaticR.rel

If this tools appeared, it can only analyze and patch the StaticR.rel files of Mario Kart Wii.

The following table shows the options to patch a StaticR.rel file:

Options
Option Param Description
-T --tracks tracks Define a new track order. A comma separated list in the format [a=]b or a:=b is expected. 'a' and 'b' are track names or slot numbers. 'a' is the destination slot and 'b' the assigned track. If 'a' is omitted, the next slot is used; this means [a=]b,c,d is possible.

Tracks will only be exchanged so that always all tracks are assigned. But if using ':=' the new slots are assigned without exchanging and the old values are lost.

-A --arenas arenas Define a new arena order. A comma separated list in the format [a=]b or a:=b is expected. 'a' and 'b' are arena names or slot numbers. 'a' is the destination slot and 'b' the assigned arena. If 'a' is omitted, the next slot is used; this means [a=]b,c,d is possible.

Arenas will only be exchanged so that always all arenas are assigned. But if using ':=' the new slots are assigned without exchanging and the old values are lost.

-R --region region If 'region' is an unsigned number, the region for online versus races and for battles is patched to the entered number. If the number is prefixed by the letter 't', a test mode is enabled and the places are patched with ascending numbers.

Otherwise a keyword is expected. Official regions are: JAPAN(0), AMERICA(1), EUROPE(2), AUSTRALIA(OCEANIA,3), KOREA(4), TAIWAN(5) and CHINA(6). RESTORE restores the original Nintendo values and NONE disables region patching (default).

See http://wiimm.de/r/ctw/Custom_Track_Regions for other regions.

--all-ranks [=mode] If set to ON (default without parameter), the server query to Nintendos servers is manipulated, so that the player will find all players in online races independent of their ranking points. Value RESTORE disables this feature and restores Nintendos original query. Value NONE disables this kind of patching (default).

4.   Patching main.dol

End 2013, analysing of DOL files and patching of main.dol of Mario Kart Wii were added.

The following table shows the option to patch a main.dol file:

Options
Option Param Description
--add-ctcode If source is an original main.dol file of MKWii, then append 2 sections (usually T2 and D8) with CT-CODE. The CTCODE is inserted after sections defined by --add-section and then only, if there are no address collisions.

If --ct-dir is used, then files named rmc[ejp]/boot_code.bin and boot_code.bin for T2, and rmc[ejp]/boot_data.bin and boot_data.bin for D8 are searched.

--ct-dir dir Define a search directory for CT-CODE parts and use the internal copies only, if no valid file is found. Each file is searched without and then with extension '.bz2'. For both cases bzip2 files are detected and decompressed. Only files with correct file type are accepted.

Use this option multiple times to define more than one search directory.

--add-section file Each option call adds the filename to an internal list. Each file must be of type GCT, GCH or WCH. All GCT files together are combined with an internal code handler to one section (like a GCH file). GCH and WCH define sections and patches. The defined sections are added and VBI hooks are optionally initialized. Use option --force to allow overlapped sections. Use option --verbose up to 2 times for a log.

The intention of this option is to add a Gecko Code Handler and cheat codes to a main.dol for automatic execution.