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

From Custom Mario Kart
Jump to navigation Jump to search
(new table layout & more track infos)
Line 8: Line 8:
 
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.
 
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.
  
{| class="wikitable"
+
{| class="textbox grid"
 
|+ File offsets of the 5 tables
 
|+ File offsets of the 5 tables
 
! rowspan=2 | Table !! colspan=4 | file offsets !! rowspan=2 | Comments
 
! rowspan=2 | Table !! colspan=4 | file offsets !! rowspan=2 | Comments
Line 36: Line 36:
 
The following table shows the ''natural'' order (not reordered by the above tables) of all tracks and the corresponding file names:
 
The following table shows the ''natural'' order (not reordered by the above tables) of all tracks and the corresponding file names:
 
<pre>
 
<pre>
        std  file name            standard      fast sound  track
+
      std  file name            sound standard      fast sound  track track
  idx hex slot  of track            sound file name  f.name  name
+
  idx slot  of track            slot  sound file name  f.name  abbr. name
----------------------------------------------------------------------------------
+
----------------------------------------------------------------------------------------------
   000 2.1  castle_course        n_Circuit32_n        _f  Mario Circuit
+
   81.1  beginner_course      0x7d  n_Circuit32_n        _f  LC    Luigi Circuit
   1.  01 1.2  farm_course          n_Farm_n              _F  Moo Moo Meadows
+
   1.  1.2  farm_course          0x77  n_Farm_n              _F  MMM  Moo Moo Meadows
   2.  02 1.3  kinoko_course        n_Kinoko_n            _F  Mushroom Gorge
+
   2.  1.3  kinoko_course        0x79  n_Kinoko_n            _F  MG    Mushroom Gorge
   303 3.4  volcano_course       n_Volcano32_n        _f Grumble Volcano
+
   41.4  factory_course       0x7b  STRM_N_FACTORY_N      _F TF    Toad's Factory
----------------------------------------------------------------------------------
+
----------------------------------------------------------------------------------------------
   404 1.4 factory_course      STRM_N_FACTORY_N      _F Toad's Factory
+
   02.castle_course        0x7d  n_Circuit32_n        _f MC    Mario Circuit
   5.  05 2.2  shopping_course      n_Shopping32_n        _f  Coconut Mall
+
   5.  2.2  shopping_course      0x7f  n_Shopping32_n        _f  CM    Coconut Mall
   6.  06 2.3  boardcross_course    n_Snowboard32_n      _F  DK Summit
+
   6.  2.3  boardcross_course    0x81  n_Snowboard32_n      _F  DKS  DK Summit
   7.  07 2.4  truck_course        STRM_N_TRUCK_N        _F  Wario's Gold Mine
+
   7.  2.4  truck_course        0x83  STRM_N_TRUCK_N        _F  WGM  Wario's Gold Mine
----------------------------------------------------------------------------------
+
----------------------------------------------------------------------------------------------
  8.  08 1.1  beginner_course      n_Circuit32_n        _f  Luigi Circuit
+
   9.  3.1  senior_course        0x87  n_Daisy32_n          _f  DC    Daisy Circuit
   9.  09 3.1  senior_course        n_Daisy32_n          _f  Daisy Circuit
+
  153.2  water_course        0x85 STRM_N_WATER_N        _F  KC    Koopa Cape
  100A 4.2  ridgehighway_course STRM_N_RIDGEHIGHWAY_N _F  Moonview Highway
+
  11.  3.3  treehouse_course    0x8f  n_maple_n            _F  MT    Maple Treeway
  11.  0B 3.3  treehouse_course    n_maple_n            _F  Maple Treeway
+
  3.  3.4  volcano_course      0x8b  n_Volcano32_n        _f  GV    Grumble Volcano
----------------------------------------------------------------------------------
+
----------------------------------------------------------------------------------------------
  12.  0C 4.3  koopa_course        STRM_N_KOOPA_N        _F  Bowser's Castle
+
14.  4.1  desert_course        0x89  STRM_N_DESERT_N      _F  DDR  Dry Dry Ruins
  13.  0D 4.4  rainbow_course      n_Rainbow32_n        _f  Rainbow Road
+
10.  4.2  ridgehighway_course  0x8d  STRM_N_RIDGEHIGHWAY_N _F  MH    Moonview Highway
14.  0E 4.1  desert_course        STRM_N_DESERT_N      _F  Dry Dry Ruins
+
  12.  4.3  koopa_course        0x91  STRM_N_KOOPA_N        _F  BC    Bowser's Castle
15.  0F 3.2  water_course        STRM_N_WATER_N        _F  Koopa Cape
+
  13.  4.4  rainbow_course      0x93  n_Rainbow32_n        _f  RR    Rainbow Road
----------------------------------------------------------------------------------
+
----------------------------------------------------------------------------------------------
  16.  10 5.1  old_peach_gc        r_GC_Beach32_n        _f  GCN Peach Beach
+
  16.  5.1  old_peach_gc        0xa5  r_GC_Beach32_n        _f  gPB  GCN Peach Beach
  1711 7.4 old_mario_gc         r_GC_Circuit32_n      _f  GCN Mario Circuit
+
  205.2 old_falls_ds         0xad  r_DS_Jungle32_n      _f  dYF  DS Yoshi Falls
  1812 6.4 old_waluigi_gc       r_GC_Stadium32_n      _f  GCN Waluigi Stadium
+
  255.3  old_obake_sfc        0x97 r_SFC_Obake32_n       _f  sGV2  SNES Ghost Valley 2
  1913 8.3 old_donkey_gc        r_GC_Mountain32_n    _f  GCN DK Mountain
+
  265.4  old_mario_64        0x9f r_64_Circuit32_n      _f  nMR  N64 Mario Raceway
----------------------------------------------------------------------------------
+
----------------------------------------------------------------------------------------------
  2014 5.2 old_falls_ds        r_DS_Jungle32_n       _f DS Yoshi Falls
+
  276.1 old_sherbet_64       0x9d r_64_Sherbet32_n      _f  nSL  N64 Sherbet Land
21.  15 7.1  old_desert_ds        r_DS_Desert32_n      _f  DS Desert Hills
+
  316.2  old_heyho_gba       0x95  r_AGB_Beach32_n       _f  gSGB  GBA Shy Guy Beach
  2216 8.2  old_garden_ds       r_DS_Garden32_n       _f  DS Peach Gardens
+
  23.  6.3  old_town_ds          0xaf  r_DS_Town32_n        _f  dDS  DS Delfino Square
  23.  17 6.3  old_town_ds          r_DS_Town32_n        _f  DS Delfino Square
+
18.  6.4  old_waluigi_gc      0xa9  r_GC_Stadium32_n      _f  gWS  GCN Waluigi Stadium
----------------------------------------------------------------------------------
+
----------------------------------------------------------------------------------------------
  2418 8.1  old_mario_sfc       r_SFC_Circuit32_n    _f  SNES Mario Circuit 3
+
  217.1  old_desert_ds       0xb1  r_DS_Desert32_n      _f  dDH  DS Desert Hills
  2519 5.3 old_obake_sfc       r_SFC_Obake32_n       _f  SNES Ghost Valley 2
+
  307.2 old_koopa_gba       0x9b  r_AGB_Kuppa32_n       _f  gBC3  GBA Bowser Castle 3
  261A 5.4 old_mario_64        r_64_Circuit32_n      _f  N64 Mario Raceway
+
  297.3  old_donkey_64        0xa1 r_64_Jungle32_n      _f  nDKJP N64 DK's Jungle Parkway
  271B 6.1 old_sherbet_64      r_64_Sherbet32_n     _f  N64 Sherbet Land
+
  177.4  old_mario_gc        0xa7 r_GC_Circuit32_n     _f  gMC  GCN Mario Circuit
----------------------------------------------------------------------------------
+
----------------------------------------------------------------------------------------------
  281C 8.4 old_koopa_64        r_64_Kuppa32_n       _f  N64 Bowser's Castle
+
  24.  8.1 old_mario_sfc       0x99  r_SFC_Circuit32_n    _f  sMC3  SNES Mario Circuit 3
  291D 7.3 old_donkey_64       r_64_Jungle32_n       _f  N64 DK's Jungle Parkway
+
  228.2 old_garden_ds       0xb3  r_DS_Garden32_n       _f  dPG  DS Peach Gardens
  301E 7.2 old_koopa_gba       r_AGB_Kuppa32_n      _f  GBA Bowser Castle 3
+
  198.3 old_donkey_gc       0xab  r_GC_Mountain32_n    _f  gDKM  GCN DK Mountain
  311F 6.2 old_heyho_gba       r_AGB_Beach32_n      _f  GBA Shy Guy Beach
+
  288.4  old_koopa_64        0xa3 r_64_Kuppa32_n       _f  nBC  N64 Bowser's Castle
----------------------------------------------------------------------------------
+
----------------------------------------------------------------------------------------------
 
</pre>
 
</pre>
  
Line 88: Line 88:
 
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.
 
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.
  
{| class="wikitable"
+
{| class="textbox grid"
 
|+ File offsets of the 4 tables
 
|+ File offsets of the 4 tables
 
! rowspan=2 | Table !! colspan=4 | file offsets !! rowspan=2 | Comments
 
! rowspan=2 | Table !! colspan=4 | file offsets !! rowspan=2 | Comments
Line 114: Line 114:
  
 
<pre>
 
<pre>
       std  file name          standard    + fast  arena
+
       std  file name          sound standard    + fast  arena arena
  idx slot  of arena          sound file name    name
+
  idx slot  of arena          slot  sound file name    abbr. name
-----------------------------------------------------------------------
+
-----------------------------------------------------------------------------------
   0.  1.2  venice_battle      n_venice_n      _F  Delfino Pier
+
  1.  1.1  block_battle      0xb7  n_block_n      _F  aBP  Block Plaza
   1.  1.1 block_battle       n_block_n       _F  Block Plaza
+
   0.  1.2  venice_battle      0xb5  n_venice_n      _F  aDP  Delfino Pier
   2.  1.4  casino_battle      n_casino_n      _F  Chain Chomp Wheel
+
   3.  1.3 skate_battle       0xb9  n_skate_n       _F  aFS  Funky Stadium
  3.  1.3  skate_battle      n_skate_n      _F  Funky Stadium
+
   2.  1.4  casino_battle      0xbb  n_casino_n      _F aCCW Chain Chomp Wheel
   4.  1.5  sand_battle        n_ryuusa_n      _F  Thwomp Desert
+
   4.  1.5  sand_battle        0xbd  n_ryuusa_n      _F  aTD  Thwomp Desert
-----------------------------------------------------------------------
+
-----------------------------------------------------------------------------------
  5.  2.4  old_CookieLand_gc  r_GC_Battle32_n _F  GCN Cookie Land
+
   7.  2.1  old_battle4_sfc    0xc3  r_sfc_battle_n  _F  asBC4 SNES Battle Course 4
  6.  2.5  old_House_ds      r_ds_battle_n  _F  DS Twilight House
+
   8.  2.2  old_battle3_gba    0xc5  r_agb_battle_n  _F  agBC3 GBA Battle Course 3
   7.  2.1  old_battle4_sfc    r_sfc_battle_n  _F  SNES Battle Course 4
+
   9.  2.3  old_matenro_64    0xc7  r_64_battle_n  _F anSS N64 Skyscraper
   8.  2.2  old_battle3_gba    r_agb_battle_n  _F  GBA Battle Course 3
+
  5.  2.4  old_CookieLand_gc  0xbf  r_GC_Battle32_n _F  agCL  GCN Cookie Land
   9.  2.3  old_matenro_64    r_64_battle_n  _F  N64 Skyscraper
+
  6.  2.5  old_House_ds      0xc1  r_ds_battle_n  _F  adTH  DS Twilight House
-----------------------------------------------------------------------
+
-----------------------------------------------------------------------------------
 
</pre>
 
</pre>
  

Revision as of 23:19, 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            sound standard      fast sound  track track
 idx slot  of track             slot  sound file name   f.name  abbr. name
----------------------------------------------------------------------------------------------
  8.  1.1  beginner_course      0x7d  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 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          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 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 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[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