Difference between revisions of "Filesystem/rel/StaticR.rel"

From Custom Mario Kart
Jump to navigation Jump to search
(Searching players for online gaming)
m (typo)
Line 142: Line 142:
 
* 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.
 
* 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 found the follwoing strings 2 times (1 for racing, 1 for battle):
+
In StaticR.rel you can found the following strings 2 times (1 for racing, 1 for battle):
 
  %s >= %d and %s <= %d
 
  %s >= %d and %s <= %d
  

Revision as of 10:05, 6 January 2014

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 KOREA) 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.


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 Staff Ghost Data order (unsure)
2 0x384f58 0x3839e0 0x384c28 0x385348 ?
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 natural order (not reordered by the above tables) of all tracks and the corresponding file names:

         std  file name            standard      fast sound  track
 idx hex slot  of track             sound file name   f.name  name
----------------------------------------------------------------------------------
  0.  00 2.1  castle_course        n_Circuit32_n         _f  Mario Circuit
  1.  01 1.2  farm_course          n_Farm_n              _F  Moo Moo Meadows
  2.  02 1.3  kinoko_course        n_Kinoko_n            _F  Mushroom Gorge
  3.  03 3.4  volcano_course       n_Volcano32_n         _f  Grumble Volcano
----------------------------------------------------------------------------------
  4.  04 1.4  factory_course       STRM_N_FACTORY_N      _F  Toad's Factory
  5.  05 2.2  shopping_course      n_Shopping32_n        _f  Coconut Mall
  6.  06 2.3  boardcross_course    n_Snowboard32_n       _F  DK Summit
  7.  07 2.4  truck_course         STRM_N_TRUCK_N        _F  Wario's Gold Mine
----------------------------------------------------------------------------------
  8.  08 1.1  beginner_course      n_Circuit32_n         _f  Luigi Circuit
  9.  09 3.1  senior_course        n_Daisy32_n           _f  Daisy Circuit
 10.  0A 4.2  ridgehighway_course  STRM_N_RIDGEHIGHWAY_N _F  Moonview Highway
 11.  0B 3.3  treehouse_course     n_maple_n             _F  Maple Treeway
----------------------------------------------------------------------------------
 12.  0C 4.3  koopa_course         STRM_N_KOOPA_N        _F  Bowser's Castle
 13.  0D 4.4  rainbow_course       n_Rainbow32_n         _f  Rainbow Road
 14.  0E 4.1  desert_course        STRM_N_DESERT_N       _F  Dry Dry Ruins
 15.  0F 3.2  water_course         STRM_N_WATER_N        _F  Koopa Cape
----------------------------------------------------------------------------------
 16.  10 5.1  old_peach_gc         r_GC_Beach32_n        _f  GCN Peach Beach
 17.  11 7.4  old_mario_gc         r_GC_Circuit32_n      _f  GCN Mario Circuit
 18.  12 6.4  old_waluigi_gc       r_GC_Stadium32_n      _f  GCN Waluigi Stadium
 19.  13 8.3  old_donkey_gc        r_GC_Mountain32_n     _f  GCN DK Mountain
----------------------------------------------------------------------------------
 20.  14 5.2  old_falls_ds         r_DS_Jungle32_n       _f  DS Yoshi Falls
 21.  15 7.1  old_desert_ds        r_DS_Desert32_n       _f  DS Desert Hills
 22.  16 8.2  old_garden_ds        r_DS_Garden32_n       _f  DS Peach Gardens
 23.  17 6.3  old_town_ds          r_DS_Town32_n         _f  DS Delfino Square
----------------------------------------------------------------------------------
 24.  18 8.1  old_mario_sfc        r_SFC_Circuit32_n     _f  SNES Mario Circuit 3
 25.  19 5.3  old_obake_sfc        r_SFC_Obake32_n       _f  SNES Ghost Valley 2
 26.  1A 5.4  old_mario_64         r_64_Circuit32_n      _f  N64 Mario Raceway
 27.  1B 6.1  old_sherbet_64       r_64_Sherbet32_n      _f  N64 Sherbet Land
----------------------------------------------------------------------------------
 28.  1C 8.4  old_koopa_64         r_64_Kuppa32_n        _f  N64 Bowser's Castle
 29.  1D 7.3  old_donkey_64        r_64_Jungle32_n       _f  N64 DK's Jungle Parkway
 30.  1E 7.2  old_koopa_gba        r_AGB_Kuppa32_n       _f  GBA Bowser Castle 3
 31.  1F 6.2  old_heyho_gba        r_AGB_Beach32_n       _f  GBA Shy Guy Beach
----------------------------------------------------------------------------------

Changing the order allows to move Special Slots to other places. The new tool wstrt (see Wiimms SZS Tools) is able to patch these tables with a user friendly interface.

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 ?
  • 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 natural 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          standard    + fast  arena
 idx slot  of arena           sound file name     name
-----------------------------------------------------------------------
  0.  1.2  venice_battle      n_venice_n      _F  Delfino Pier
  1.  1.1  block_battle       n_block_n       _F  Block Plaza
  2.  1.4  casino_battle      n_casino_n      _F  Chain Chomp Wheel
  3.  1.3  skate_battle       n_skate_n       _F  Funky Stadium
  4.  1.5  sand_battle        n_ryuusa_n      _F  Thwomp Desert
-----------------------------------------------------------------------
  5.  2.4  old_CookieLand_gc  r_GC_Battle32_n _F  GCN Cookie Land
  6.  2.5  old_House_ds       r_ds_battle_n   _F  DS Twilight House
  7.  2.1  old_battle4_sfc    r_sfc_battle_n  _F  SNES Battle Course 4
  8.  2.2  old_battle3_gba    r_agb_battle_n  _F  GBA Battle Course 3
  9.  2.3  old_matenro_64     r_64_battle_n   _F  N64 Skyscraper
-----------------------------------------------------------------------

The new tool wstrt (see Wiimms SZS Tools) is able to patch these tables with a user friendly interface.

Searching players for online gaming

If MKWii searches players online worldwide or in regions, it creates some text queries. These queries looks like a WHERE clause of SQL queries.

If analysing the online communication, you can find for example:

... and (rk = 'vs_21' and ev >= 5215 and ev <= 8215 and p = 0)
  • vs_21 is the region name (dump comes from 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 found the following strings 2 times (1 for racing, 1 for battle):

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

If replacing the string 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 is always true, so that all players independent of their ranking points are found.

The following command (Wiimms SZS Tools) will exactly patch a StaticR.rel file in this way:

wstrt patch StaticR.rel --all-ranks[1]


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

References