Filesystem/rel/StaticR.rel

From Custom Mario Kart
< Filesystem‎ | rel(Redirected from StaticR.rel)
Jump to: navigation, search

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, 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 players for online gaming

If MKWii searches players worldwide or in regions for online gaming, 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 color of region line

In online races, every player has a colored line under his name, pointing to his kart/bike. The color of this line is region-dependant and can be changed at the following offsets:

Region line color
PAL NTSC/USA NTSC/JAP KOREA
0x399B13 0x39856C 0x3992F3 0x399F50

The definition is 48 bytes long, each group of 4 bytes describes the color for one region in RGBA format. The usage and the original colors are the following:

Offset Usage Default Color
0x00 Unknown 3F333333 : grey, transparent
0x04 Player 1, red team E61414FF : red
0x08 Player 2, blue team 0078DCFF : blue
0x0c Japan FF0000FF : red
0x10 North America 0000FFFF : blue
0x14 Europe 00FF00FF : green
0x18 Australia FFFF00FF : yellow
0x1c Korea FF00FFFF : magenta
0x20 Nintendo 000000FF : black
0x24 CPU's? FFFFFFFF : white
0x28 Unknown 3F000000 : dark red, invisible
0x2c Unknown 00000000 : black, invisible

Change the points a player gets for winning a race

In offline and friend room races, players get 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/USA NTSC/JAP KOREA
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 behaviour modifier

You can change the behaviour of items - for example, letting three bananas circling around your kart like in Mario Kart 8. (Confirmed working in PAL, NTSC-U, and NTSC-J. NTSC-K untested.)

Modifier values:

00 00 00 00: Use Item (e. g. Bullet Bill)
00 00 00 01: Fire Item (e.g. Red shel)
00 00 00 02: Trailing Kart (e. g. triple Banana)
00 00 00 03: Circling Kart (e. g. triple shell)
File offsets of the item behaviour
Item File Offsets Standard
value
PAL NTSC/USA NTSC/JAP KOREA
Banana 0x395084 0x394A44 0x394864 (unknown) 01
Triple Banana 0x3950A0 0x394A60 0x394880 (unknown) 02
Bob-omb 0x39519C 0x394B5C 0x39497C (unknown) 01
Fake Item Box 0x3953FC 0x394DBC 0x394BDC (unknown) 01
Mushroom 0x395670 0x394F50 0x394E50 (unknown) 00
Triple Mushroom 0x39568C 0x394F6C 0x394E6C (unknown) 00
Golden Mushroom 0x3956F8 0x394FA0 0x394ED8 (unknown) 00
Red Shell 0x395734 0x394FDC 0x394F14 (unknown) 01
Triple Red Shell 0x395750 0x394FF8 0x394F30 (unknown) 03
Blue Shell 0x39584C 0x3950F4 0x39502C (unknown) 01
Green Shell 0x395A3F 0x3952E4 0x39521C (unknown) 01
Triple Green Shell 0x395A58 0x395300 0x395238 (unknown) 03
Star 0x395ED8 0x395528 0x3956B8 (unknown) 00
Lightning 0x395F88 0x3955D8 0x395768 (unknown) 00
Blooper 0x3955B0 0x396E10 0x394D90 (unknown) 00
Mega Mushroom 0x3956C0 0x396ED0 0x394EA0 (unknown) 00
Bullet Bill 0x395628 0x396E88 0x394E08 (unknown) 00
Thundercloud 0x395B2C 0x396F0C 0x39530C (unknown) 00
POW Block 0x395CBC 0x39709C 0x39549C (unknown) 00

Fake Item Box color modifier

Fake boxes look like normal items. (untested)

File offsets of the Fake Box color modifier
Info File Offsets Values
PAL NTSC/USA NTSC/JAP KOREA Old value New value
First patch (unknown) 0x394da0 (unknown) (unknown) 0x00000000 0x4bc00000
Second patch (unknown) 0x395540 (unknown) (unknown) 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

References

  1. Wiimms SZS Tools: Option --tracks
  2. Wiimms SZS Tools: Option --arenas
  3. Wiimms SZS Tools: Option --all-ranks