Custom Track Regions
Regions are a concept by Nintendo, to allow regional or continental races in Mario Kart Wii. Nintendo defined the region from 0 to 6. Regions ≥7 can be used for Custom Track Distributions to isolate the users of a distribution from all other players.
How region numbers are used internally
Mario Kart Wii uses an unknown algorithm to assigns itself a region number. The DVD type (PAL/NTSC/...) and the region of the Wii have influence to determination. The region is then stored to an internal numeric variable.
If connecting to a region, this region number is used to create an alpha numeric region name. For versus races the C format string "vs_%d" is used, and for battles the string "bt_%d". The "%d" is replaced by the signed decimal presentation of the region number. This combined prefix and region number is used by the game to search player in the online matchmaking database.
- Example: If region 12 is active, the versus race region name becomes "vs_12" and the battle race region name becomes "bt_12".
For worldwide races, the names "vs" and "bt" without a number extension are used. This means that worldwide races don't use regions (region 0 is Japan).
Patching for Wiimmfi
If you plan to patch a distribution for Wiimmfi and for a specific region (1234 in this example), then use the following command:
wstrt patch --wiimmfi --region 1234 StaticR.rel main.dol
It is important to have original versions of StaticR.rel and main.dol and to patch both files.
How the region patch works
The well known region patch replaces a 32-bit instruction of the code. The original instruction is: »load the content of variable region_number into the register«. This instruction is replaced by »load a constant value into the register«. Because the limit of 32 bit for the instruction, the value is a sign extended 16 bit value. So only values between 0x8000 – 0x7fff (-32768 – +32767) are possible.
If using a negative number, the region name becomes for example "vs_-12345". Tests confirmed, that this regions with 9 characters work at Nintendo's servers like all others. And Wiimmfi supports it too, but has limited the accepted range from 0 to 7999 plus some other regions.
With this practice, 65536 (0x10000) versus regions are possible. However, changing the prefix of the string from "vs_" to something else makes it possible to use billions of different regions. Prefix modifications except »vx« and »bx« are not allowed by Wiimmfi.
The old region patch has forgotten to patch the region in some parts:
- If player A plays in region 123 and the friend B meets A using the friends list, B is registered as player of its native region, e.g. 1 for USA. So as soon as player B gets host of the race (because the original host quits), other people from region 1 can join via the "Continental VS Race" button.
- The region patch does not work for battle.
Wiimms SZS Tools fixed it and will patch 8 different places in StaticR.rel. The tools can also patch main.dol to define a login region. This login region can be used to identify the distribution of a private room.
New patch version by Leseratte
Leseratte has created a new version of the patch, fixing the battle and friend list bug.
With a special cheat code, it is possible to use regions from -2,147,483,647 to +4,294,967,296 allowing 6,442,450,943 regions in total. But this patch currently can't be put into an ISO so it's unreleased for now. Wiimmfi does not support this extended range of regions.
Since August 2017, there is a new system for applying and managing custom regions for Wiimmfi. Other servers (for example based on AltWFC) may have an own system.
For Wiimmfi, visit the page »List of free custom regions«, search a free region and then use the form at »Apply regions« to apply one or more regions. For the second page you have to be logged-on. Read the explanations of both pages.