Lap & Speed Modifier

From Custom Mario Kart
Jump to: navigation, search

Lap & Speed Modifier is a Mario Kart Wii extension that modifies the number of laps and the basic speed of a race. It was developed by MrBean35000vr for CTGP Revolution v1.03 with help from Geeh and MrEvil and is also available as a pair of cheat codes.

Media

Speed Modifier
Max Lap Count Modifier

How it works (STGI)

The Lap & Speed Modifier reads some values of KMP/STGI:

  • The byte at offset 0 is used for the number of laps, if it is between 1 and 9.
  • The 2 bytes at offsets 0x0A and 0x0B are interpreted as the 2 most significant bytes of the floating point speed factor. The least significant two bytes of the speed factor are always 0. If the speed modifier equals 0.0 a value of 1.0 is used instead (for backwards compatibility with tracks not using a Speed modifier). The usual range is 0.5 (0x3F00) to 2.0 (0x4000).

Speed Factor Discussion

The tracks are generally designed for speed factor 1.0. With it, a player can increment its position up to 120 game units if using a mushroom or Bullet Bill. If using a speed factor of 2.0, the increment can be 2*120 = 240 game units. So it's possible to miss walls, items or opponents, if in one calculation the vehicle was complete before the object and with the next calculation complete behind. While testing speed factor 3, Wiimm and Leseratte slipped through item and fake boxes.

Another relevant factor is the blow factor of the cubes if creating a KCL. For optimization, the world is generally divided into cubes of 512*512*512 units and only the triangle list for the current cube is used to find collisions. It is important, that near triangles of the neighbor cubes are also included into the triangle list for the cube. Nintendo blows up the cubes by factor ~3.35 (KCL_BLOW=600 or --kcl=CHARY for Wiimms SZS Tools) to find neighbored triangles. If using option --kcl=SMALL, then only 200 units are used. This value is enough for speed factor 1.0, but maybe to small for factor 2.0.

Another point are check points. If they are placed to near, you can miss some points. And if you miss a mandatory check point, the result is a lap not count bug.

So the best is to use never speed factors >2.0!

Cheat Codes

Cheat codes are available for 4 regions:

Lap Modifier, PAL


Speed Modifier, PAL


Lap Modifier, NTSC/USA


Speed Modifier, NTSC/USA


Lap Modifier, NTSC/Japan


Speed Modifier, NTSC/Japan


Lap Modifier, NTSC/Korea


Speed Modifier, NTSC/Korea


Wiimms SZS Tools

Patching Track Files

The values of the STGI section can easily be patched by the tool wszst:

  • wszst patch --speed-mod=factor ... will change the speed factor.
  • wszst patch --kmp=3laps ... will patch the lap number. Values between 1lap and 9laps are possible (however, 9 laps don't work correctly in the game for some reason, it will display 8 laps but actually drive for 9 laps).
  • wszst patch --kmp=MODE ... will patch the pole position (modes left or right) and/or the narrow mode (modes wide or narrow).

Patching main.dol to enable LS-Mod support

wstrt patch supports the option --add-section=file to add a section to file main.dol. The section can be a gecko code interpreter together with some cheat codes.