Filesystem/rel/StaticR.rel

From Custom Mario Kart
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

The file StaticR.rel is the only file in directory /rel and contains much data for the Mario Kart Wii. All 4 known versions (PAL, NTSC-U, NTSC-J and NTSC-K) differ in size and content. All data is stored as big endian values. It is very hard to find things in StaticR.rel, because it seems to be an exported data section of a dol: It has no structure but the related dol knows where the data is stored. See »REL (File Format)« for a general file format.



Track Order Tables

There are 5 copies of the track assigning tables in the file. The tables consists of 32 32-bit numbers. Each value from 0 to 31 (0x1f) is used exactly once.

File offsets of the 5 tables
Table File offsets Comments
PAL NTSC NTSC/J KOREA
1 0x37FCD0 0x37FBE0 0x37F9A0 0x3800B0 Used for Grand Prix.
2 0x384F58 0x3839E0 0x384C28 0x385348 Used for In Order and Random VS races and track highlighting after races.
3 0x397DA8 0x397450 0x397588 0x3981E8 Used for track selection and racing.
4 0x398130 0x3977D8 0x397910 0x398570 Used for cup selection.
5 0x39D040 0x39B300 0x39C820 0x39D480 ?
  • The comments are based on tests with the PAL version.
  • The standard setting is: 8,1,2,4 | 0,5,6,7 | 9,15,11,3 | 14,10,12,13 | 16,20,25,26 | 27,31,23,18 | 21,30,29,17 | 24,22,19,28
  • In the BMG message files the track names are stored beginning from message IDs (MID) 0x2454 and 0x2490. Add the slot value to find the specific messages.

The following table shows the native order (not reordered by the above tables) of all tracks and the corresponding file names:

      std  file name            sound standard      fast sound  track track
 idx slot  of track             slot  sound file name   f.name  abbr. name
----------------------------------------------------------------------------------------------
  8.  1.1  beginner_course      0x75  n_Circuit32_n         _f  LC    Luigi Circuit
  1.  1.2  farm_course          0x77  n_Farm_n              _F  MMM   Moo Moo Meadows
  2.  1.3  kinoko_course        0x79  n_Kinoko_n            _F  MG    Mushroom Gorge
  4.  1.4  factory_course       0x7b  STRM_N_FACTORY_N      _F  TF    Toad's Factory
----------------------------------------------------------------------------------------------
  0.  2.1  castle_course        0x7d  n_Circuit32_n         _f  MC    Mario Circuit
  5.  2.2  shopping_course      0x7f  n_Shopping32_n        _f  CM    Coconut Mall
  6.  2.3  boardcross_course    0x81  n_Snowboard32_n       _F  DKS   DK Summit
  7.  2.4  truck_course         0x83  STRM_N_TRUCK_N        _F  WGM   Wario's Gold Mine
----------------------------------------------------------------------------------------------
  9.  3.1  senior_course        0x87  n_Daisy32_n           _f  DC    Daisy Circuit
 15.  3.2  water_course         0x85  STRM_N_WATER_N        _F  KC    Koopa Cape
 11.  3.3  treehouse_course     0x8f  n_maple_n             _F  MT    Maple Treeway
  3.  3.4  volcano_course       0x8b  n_Volcano32_n         _f  GV    Grumble Volcano
----------------------------------------------------------------------------------------------
 14.  4.1  desert_course        0x89  STRM_N_DESERT_N       _F  DDR   Dry Dry Ruins
 10.  4.2  ridgehighway_course  0x8d  STRM_N_RIDGEHIGHWAY_N _F  MH    Moonview Highway
 12.  4.3  koopa_course         0x91  STRM_N_KOOPA_N        _F  BC    Bowser's Castle
 13.  4.4  rainbow_course       0x93  n_Rainbow32_n         _f  RR    Rainbow Road
----------------------------------------------------------------------------------------------
 16.  5.1  old_peach_gc         0xa5  r_GC_Beach32_n        _f  gPB   GCN Peach Beach
 20.  5.2  old_falls_ds         0xad  r_DS_Jungle32_n       _f  dYF   DS Yoshi Falls
 25.  5.3  old_obake_sfc        0x97  r_SFC_Obake32_n       _f  sGV2  SNES Ghost Valley 2
 26.  5.4  old_mario_64         0x9f  r_64_Circuit32_n      _f  nMR   N64 Mario Raceway
----------------------------------------------------------------------------------------------
 27.  6.1  old_sherbet_64       0x9d  r_64_Sherbet32_n      _f  nSL   N64 Sherbet Land
 31.  6.2  old_heyho_gba        0x95  r_AGB_Beach32_n       _f  gSGB  GBA Shy Guy Beach
 23.  6.3  old_town_ds          0xaf  r_DS_Town32_n         _f  dDS   DS Delfino Square
 18.  6.4  old_waluigi_gc       0xa9  r_GC_Stadium32_n      _f  gWS   GCN Waluigi Stadium
----------------------------------------------------------------------------------------------
 21.  7.1  old_desert_ds        0xb1  r_DS_Desert32_n       _f  dDH   DS Desert Hills
 30.  7.2  old_koopa_gba        0x9b  r_AGB_Kuppa32_n       _f  gBC3  GBA Bowser Castle 3
 29.  7.3  old_donkey_64        0xa1  r_64_Jungle32_n       _f  nDKJP N64 DK's Jungle Parkway
 17.  7.4  old_mario_gc         0xa7  r_GC_Circuit32_n      _f  gMC   GCN Mario Circuit
----------------------------------------------------------------------------------------------
 24.  8.1  old_mario_sfc        0x99  r_SFC_Circuit32_n     _f  sMC3  SNES Mario Circuit 3
 22.  8.2  old_garden_ds        0xb3  r_DS_Garden32_n       _f  dPG   DS Peach Gardens
 19.  8.3  old_donkey_gc        0xab  r_GC_Mountain32_n     _f  gDKM  GCN DK Mountain
 28.  8.4  old_koopa_64         0xa3  r_64_Kuppa32_n        _f  nBC   N64 Bowser's Castle
----------------------------------------------------------------------------------------------

Changing the order allows to move Special Slots to other places. The following command of Wiimms SZS Tools may change the track order:

wstrt patch StaticR.rel --tracks=LIST[1]

Arena Order Tables

There are 4 copies of the track assigning tables in the file. The tables consists of 10 32-bit numbers. Each value from 32 (0x20) to 41 (0x29) is used exactly once.

File offsets of the 4 tables
Table file offsets Comments
PAL NTSC NTSC/J KOREA
1 0x384FD8 0x383A60 0x384CA8 0x3853C8 ?
2 0x3974F8 0x39D130 0x396CD8 0x397938 Used for cup selection.
3 0x397780 0x39D3B8 0x396F60 0x397BC0 Used for track selection and racing.
4 0x39C8E0 0x39E988 0x39C0C0 0x39CD20 Used for track highlighting after races.
  • The comments are based on tests with the PAL version.
  • The standard setting is: 0x21,0x20,0x23,0x22,0x24 | 0x27,0x28,0x29,0x25,0x26
  • In the BMG message files the arena names are stored beginning from message IDs (MID) 0x24b8 and 0x24cc. Add the slot value and subtract 0x20 to find the specific messages.

The following table shows the native order (not reordered by the above tables) of all arenas and the corresponding file names. Add 0x20 to the index to find the value for the assigning tables:

      std  file name          sound standard    + fast  arena arena
 idx slot  of arena           slot  sound file name     abbr. name
-----------------------------------------------------------------------------------
  1.  1.1  block_battle       0xb7  n_block_n       _F  aBP   Block Plaza
  0.  1.2  venice_battle      0xb5  n_venice_n      _F  aDP   Delfino Pier
  3.  1.3  skate_battle       0xb9  n_skate_n       _F  aFS   Funky Stadium
  2.  1.4  casino_battle      0xbb  n_casino_n      _F  aCCW  Chain Chomp Wheel
  4.  1.5  sand_battle        0xbd  n_ryuusa_n      _F  aTD   Thwomp Desert
-----------------------------------------------------------------------------------
  7.  2.1  old_battle4_sfc    0xc3  r_sfc_battle_n  _F  asBC4 SNES Battle Course 4
  8.  2.2  old_battle3_gba    0xc5  r_agb_battle_n  _F  agBC3 GBA Battle Course 3
  9.  2.3  old_matenro_64     0xc7  r_64_battle_n   _F  anSS  N64 Skyscraper
  5.  2.4  old_CookieLand_gc  0xbf  r_GC_Battle32_n _F  agCL  GCN Cookie Land
  6.  2.5  old_House_ds       0xc1  r_ds_battle_n   _F  adTH  DS Twilight House
-----------------------------------------------------------------------------------

The following command of Wiimms SZS Tools may change the track order:

wstrt patch StaticR.rel --arenas=LIST[2]

Searching for Players for Online Racing

If Mario Kart Wii searches players worldwide or in regions for online racing, it creates some text queries. These queries looks like a WHERE clause of SQL queries.

If analyzing the online communication, you can find for example the following condition string:

... and (rk = 'vs_21' and ev >= 5215 and ev <= 8215 and p = 0)
  • vs_21 is the region name (playing in region 21).
  • At this point I had 6715 points. The Wii builds a range from 6715-1500 up to 6715+1500 and search players within this range.

In StaticR.rel you can find the following string twice (1 for racing, 1 for battle):

%s >= %d and %s <= %d

If replacing the string by another one with the same number of characters ...

(%s > %d or %s <= %d)

... the above query becomes:

... and (rk = 'vs_21' and (ev > 5215 or ev <= 8215) and p = 0)

And now the inner part of the condition is always true, so that all players independent of their ranking points will be found.

The following command of Wiimms SZS Tools will exactly patch a StaticR.rel file in the described way:

wstrt patch StaticR.rel --all-ranks[3]
File offsets of the query strings
Info File Offsets
PAL NTSC/USA NTSC/JAP KOREA
First string 0x389F36 0x389BE6 0x389716 0x38A34E
Second string 0x389F52 0x389C02 0x389732 0x38A36A

Change Color of HUD

The color of the Head-up display in races can be changed at the following offsets:

File offsets of the HUD-data
PAL NTSC/USA NTSC/JAP KOREA
0x399346 0x397F9E 0x398B26 0x399786

There are 4 floating point numbers here, one for each player. If the number is invalid, it defaults to white.

Change the Number of Points a Player Receives for Winning a Race

In offline and friend room races, players receive a specific amount of points between 15 and 0 depending on their position and how many players are participating. This point amount can be changed at the following offsets:

Race points
PAL NTSC-U NTSC-J NTSC-K
0x37FD50 0x37FC60 0x37FA20 0x380130

The definition is 144 bytes long, each group of 12 bytes describes the points for one player count.

Offset Player count Default value
0x00 1 Player 15
0x0C 2 Players 15, 7
0x18 3 Players 15, 8, 2
0x24 4 Players 15, 9, 4, 1
0x30 5 Players 15, 9, 5, 2, 1
0x3C 6 Players 15, 10, 6, 3, 1, 0
0x48 7 Players 15, 10, 7, 5, 3, 1, 0
0x54 8 Players 15, 11, 8, 6, 4, 2, 1, 0
0x60 9 Players 15, 11, 8, 6, 4, 3, 2, 1, 0
0x6C 10 Players 15, 12, 10, 8, 6, 4, 3, 2, 1, 0
0x78 11 Players 15, 12, 10, 8, 6, 5, 4, 3, 2, 1, 0
0x84 12 Players 15, 12, 10, 8, 7, 6, 5, 4, 3, 2, 1, 0

Item Behavior Modifier

You can change the behavior of items. For example, setting Triple Bananas to circle around your kart like in Mario Kart 8.

Modifier values:

00 00 00 00: Use Item (e.g. Bullet Bill)
00 00 00 01: Fire Item (e.g. Red Shell)
00 00 00 02: Trailing Kart (e.g. Triple Banana)
00 00 00 03: Circling Kart (e.g. Triple Shell)
Item Behavior File Offsets
Item File Offsets Standard
value
PAL NTSC/USA NTSC/JAP KOREA
Banana 0x395084 0x394A44 0x394864 0x3954C4 01
Triple Banana 0x3950A0 0x394A60 0x394880 0x3954E0 02
Bob-omb 0x39519C 0x394B5C 0x39497C 0x3955DC 01
Fake Item Box 0x3953FC 0x394DBC 0x394BDC 0x39583C 01
Mushroom 0x395670 0x394F50 0x394E50 0x395AB0 00
Triple Mushroom 0x39568C 0x394F6C 0x394E6C 0x395ACC 00
Golden Mushroom 0x3956F8 0x394FA0 0x394ED8 0x395B38 00
Red Shell 0x395734 0x394FDC 0x394F14 0x395B74 01
Triple Red Shell 0x395750 0x394FF8 0x394F30 0x395B90 03
Blue Shell 0x39584C 0x3950F4 0x39502C 0x395C8C 01
Green Shell 0x395A3C 0x3952E4 0x39521C 0x395E7C 01
Triple Green Shell 0x395A58 0x395300 0x395238 0x395E90 03
Star 0x395ED8 0x395528 0x3956B8 0x396318 00
Lightning 0x395F88 0x3955D8 0x395768 0x3963C8 00
Blooper 0x3955B0 0x396E10 0x394D90 0x3959F0 00
Mega Mushroom 0x3956C0 0x396ED0 0x394EA0 0x395B00 00
Bullet Bill 0x395628 0x396E88 0x394E08 0x395A68 00
Thunder Cloud 0x395B2C 0x396F0C 0x39530C 0x395F6C 00
POW Block 0x395CBC 0x39709C 0x39549C 0x3960FC 00

Fake Item Box Color Modifier

Fake Item Boxes look like normal items boxes.

File offsets of the Fake Box color modifier
Info File Offsets Values
PAL NTSC/USA NTSC/JAP KOREA Old Value New Value
First patch 0x3953E0 0x394DA0 0x394BC0 0x395820 0x00000000 0x4BC00000
Second patch 0x395EF0 0x395540 0x3956D0 0x396330 0x00000000 0x40000000

Engine Class Modifier

File offsets of the Engine Classes
Info File offsets Default
value
PAL NTSC/USA NTSC/JAP KOREA
50cc 0x3A59F4 0x3A54B4 0x3A51D4 0x3A5E4C 0.8
100cc 0x3A59F8 0x3A54B8 0x3A51D8 0x3A5E50 0.9
150cc / Mirror / Time Trials 0x3A59FC 0x3A54BC 0x3A51DC 0x3A5E54 1.0
Battle 0x3A5A00 0x3A54C0 0x3A51E0 0x3A5E58 0.7

Character Order Table

There's a table that defines the character in each slot of the character select screen. The table is 0x60 bytes long.

Offsets of the character slot table
PAL NTSC/USA NTSC/JAP KOREA
0x397B00 0x3971A8 0x3972E0 0x397F40

Each character is the 32-bit value of their assigned identifier. As you unlock characters, the character slots on the right start appearing.

Menu Character Display Position

This is where the game places the character display on the menu.

Offsets of the character position
PAL NTSC/USA NTSC/JAP KOREA
0x385DC0 0x388728 0x349A90 0x3866C8

The first value is the horizontal position from the center of the screen (default is -190), the second is the vertical position from the center (default is 0), the third is Scale (default is 1). Note: Scaling the character bigger will not increase the resolution, so they will still be as pixelated as they would normally. All values are float.

References