The following warnings occurred:
Warning [2] Undefined property: MyLanguage::$archive_pages - Line: 2 - File: printthread.php(287) : eval()'d code PHP 8.2.18 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/printthread.php(287) : eval()'d code 2 errorHandler->error_callback
/printthread.php 287 eval
/printthread.php 117 printthread_multipage



Mario Kart Wii Gecko Codes, Cheats, & Hacks
Track Randomizer [CLF78] - Printable Version

+- Mario Kart Wii Gecko Codes, Cheats, & Hacks (https://mariokartwii.com)
+-- Forum: Cheat Codes (https://mariokartwii.com/forumdisplay.php?fid=51)
+--- Forum: Misc/Other (https://mariokartwii.com/forumdisplay.php?fid=55)
+--- Thread: Track Randomizer [CLF78] (/showthread.php?tid=1659)

Pages: 1 2


Track Randomizer [CLF78] - CLF78 - 10-26-2020

This code will let you load a random track from a specific folder, based on the picked track. Usage notes below.

NTSC-U
0453B2BC 48000050
060002B0 00000040
01010101 01010101
01010101 01010101
01010101 01010101
01010101 01010101
01010101 01010101
01010000 52616365
2F436F75 7273652F
25732F25 64000000
C253B32C 0000000D
7CCB3378 7CAA2B78
540CF0BE 2C0C0029
41810050 3C608000
606302B0 7C8360AE
38840001 38600000
3CE0800F 60E72E40
7CE903A6 4E800421
2C030000 40A20010
7D455378 7D665B78
48000014 3CA08000
60A502DC 7D665B78
7C671B78 38610008
38800080 00000000
C253C680 0000000D
7CCB3378 7CAA2B78
540CF0BE 2C0C0029
41810050 3C608000
606302B0 7C8360AE
38840001 38600000
3CE0800F 60E72E40
7CE903A6 4E800421
2C030000 40A20010
7D455378 7D665B78
48000014 3CA08000
60A502DC 7D665B78
7C671B78 38610008
38800080 00000000

PAL
045407F8 48000050
060002B0 00000040
01010101 01010101
01010101 01010101
01010101 01010101
01010101 01010101
01010101 01010101
01010000 52616365
2F436F75 7273652F
25732F25 64000000
C2540868 0000000D
7CCB3378 7CAA2B78
540CF0BE 2C0C0029
41810050 3C608000
606302B0 7C8360AE
38840001 38600000
3CE0800F 60E72EE0
7CE903A6 4E800421
2C030000 40A20010
7D455378 7D665B78
48000014 3CA08000
60A502DC 7D665B78
7C671B78 38610008
38800080 00000000
C2541BBC 0000000D
7CCB3378 7CAA2B78
540CF0BE 2C0C0029
41810050 3C608000
606302B0 7C8360AE
38840001 38600000
3CE0800F 60E72EE0
7CE903A6 4E800421
2C030000 40A20010
7D455378 7D665B78
48000014 3CA08000
60A502DC 7D665B78
7C671B78 38610008
38800080 00000000

NTSC-J
04540178 48000050
060002B0 00000040
01010101 01010101
01010101 01010101
01010101 01010101
01010101 01010101
01010101 01010101
01010000 52616365
2F436F75 7273652F
25732F25 64000000
C25401E8 0000000D
7CCB3378 7CAA2B78
540CF0BE 2C0C0029
41810050 3C608000
606302B0 7C8360AE
38840001 38600000
3CE0800F 60E72E00
7CE903A6 4E800421
2C030000 40A20010
7D455378 7D665B78
48000014 3CA08000
60A502DC 7D665B78
7C671B78 38610008
38800080 00000000
C254153C 0000000D
7CCB3378 7CAA2B78
540CF0BE 2C0C0029
41810050 3C608000
606302B0 7C8360AE
38840001 38600000
3CE0800F 60E72E00
7CE903A6 4E800421
2C030000 40A20010
7D455378 7D665B78
48000014 3CA08000
60A502DC 7D665B78
7C671B78 38610008
38800080 00000000

NTSC-K
0452E850 48000050
060002B0 00000040
01010101 01010101
01010101 01010101
01010101 01010101
01010101 01010101
01010101 01010101
01010000 52616365
2F436F75 7273652F
25732F25 64000000
C252E8C0 0000000D
7CCB3378 7CAA2B78
540CF0BE 2C0C0029
41810050 3C608000
606302B0 7C8360AE
38840001 38600000
3CE0800F 60E72F58
7CE903A6 4E800421
2C030000 40A20010
7D455378 7D665B78
48000014 3CA08000
60A502DC 7D665B78
7C671B78 38610008
38800080 00000000
C252FC14 0000000D
7CCB3378 7CAA2B78
540CF0BE 2C0C0029
41810050 3C608000
606302B0 7C8360AE
38840001 38600000
3CE0800F 60E72F58
7CE903A6 4E800421
2C030000 40A20010
7D455378 7D665B78
48000014 3CA08000
60A502DC 7D665B78
7C671B78 38610008
38800080 00000000

Usage Notes:
  • Let's pretend you want to have 3 random tracks over Mario Circuit.
  • Find the correct byte in the first 06 code (see source below) and change it to the amount of tracks (in this case, 3)
  • Note down which entry in the byte list Mario Circuit is (in this case, it's 1)
  • Make a new folder named with the track's name in Race/Course
  • In that folder, place the tracks and rename them to 1.szs, 2.szs and so on (the game will pick a random number everytime)
  • The game can also pick value 0, which will load the original track
  • The end result will be a folder in Race/Course named castle_course, which will contain 1.szs, 2.szs and 3.szs
  • Enjoy!
Note: This code uses addresses 0x800002B0-0x800002F0 in the Exception Vector Area. Make sure no other codes are using these!

Source:
Code:
# Set mode here
.set mode, 0

# Mode 1, Multiplayer File Skip
.if (mode == 1)
    # @8053B2BC NTSC-U, 805407F8 PAL, 80540178 NTSC-J, 8052E850 NTSC-K
    b 80

# Mode 2, Track Amounts and Track String
.elseif (mode == 2)
    # @800002B0
    .byte 1, 1, 1, 1    # Mario Circuit, Moo Moo Meadows, Mushroom Gorge, Grumble Volcano
    .byte 1, 1, 1, 1    # Toad's Factory, Coconut Mall, DK Summit, Wario's Gold Mine
    .byte 1, 1, 1, 1    # Luigi Circuit, Daisy Circuit, Moonview Highway, Maple Treeway
    .byte 1, 1, 1, 1    # Bowser Castle, Rainbow Road, Dry Dry Ruins, Koopa Cape
    .byte 1, 1, 1, 1    # GCN Peach Beach, GCN Mario Circuit, GCN Waluigi Stadium, GCN DK Mountain
    .byte 1, 1, 1, 1    # DS Yoshi Falls, DS Desert Hills, DS Peach Gardens, DS Delfino Square
    .byte 1, 1, 1, 1    # SNES Mario Circuit 3, SNES Ghost Valley 2, N64 Mario Raceway, N64 Sherbet Land
    .byte 1, 1, 1, 1    # N64 Bowser's Castle, N64 DK's Jungle Parkway, GBA Bowser Castle 3, GBA Shy Guy Beach
    .byte 1, 1, 1, 1, 1 # Delfino Pier, Block Plaza, Chain Chomp Wheel, Funky Stadium, Thwomp Desert
    .byte 1, 1, 1, 1, 1 # GCN Cookie Land, DS Twilight House, SNES Battle Course 4, GBA Battle Course 3, N64 Skyscraper
    .align 2

# Do NOT touch this string
    .string "Race/Course/%s/%d"
    .align 2

# Mode 3, ASM
.elseif (mode == 3)

    # Injects
    # @8053B32C NTSC-U, 80540868 PAL, 805401E8 NTSC-J, 8052E8C0 NTSC-K
    # @8053C680 NTSC-U, 80541BBC PAL, 8054153C NTSC-J, 8052FC14 NTSC-K

    # Addresses
.set ByteAmounts, 0x800002B0
.set CharString, 0x800002DC
.set region, ''

.if (region == 'P' || region == 'p')
.set UtilRandom, 0x800F2EE0
.elseif (region == 'U' || region == 'u' || region == 'E' || region == 'e')
.set UtilRandom, 0x800F2E40
.elseif (region == 'J' || region == 'j')
.set UtilRandom, 0x800F2E00
.elseif (region == 'K' || region == 'k')
.set UtilRandom, 0x800F2F58
.else
.err
.endif

# Backup some registers for later use
mr r11, r6
mr r10, r5

# Divide slot index by 4
srwi r12, r0, 2

# Check if it's a track/battle arena
cmpwi r12, 41
bgt end

# Setup arguments for UtilRandom
lis r3, ByteAmounts@h
ori r3, r3, ByteAmounts@l
lbzx r4, r3, r12
addi r4, r4, 1
li r3, 0

# Call UtilRandom
lis r7, UtilRandom@h
ori r7, r7, UtilRandom@l
mtctr r7
bctrl

# Check if result is 0
cmpwi r3, 0
bne+ pickRandomTrack

# If so use the original arguments
mr r5, r10
mr r6, r11
b finishSetup

# Use custom arguments otherwise
pickRandomTrack:
lis r5, CharString@h
ori r5, r5, CharString@l
mr r6, r11
mr r7, r3

# Common argument
finishSetup:
addi r3, r1, 0x8

# Original instruction
end:
li r4, 0x80
.else
    .err
.endif

Code created by: CLF78


RE: Track Randomizer [CLF78] - Seeky - 10-26-2020

Awesome Smile


RE: Track Randomizer [CLF78] - 9Paran - 11-15-2020

the code works online?


RE: Track Randomizer [CLF78] - CLF78 - 11-16-2020

It should, it doesn't change the track slot but only the trackfile Tongue


RE: Track Randomizer [CLF78] - Yoshisaur - 01-25-2021

This code is incredible, you show great promise! It's unfortunate that I can't get to the results/end screen after completing a local GP or VS session with it though. Would you be able/willing to do something about that?


RE: Track Randomizer [CLF78] - CLF78 - 03-01-2021

Just updated the code, here's a small rundown of the changes:
- The randomizer can now pick value 0, which will load the original track, so if you want you can set the values in the array to 0 and not have random tracks for a specific slot
- The folder name is now the track's name instead of its slot number
- Slightly improved ASM

Enjoy!


RE: Track Randomizer [CLF78] - Yuri Bacon - 07-29-2021

Tried this on NTSC-U on Wii via Riivolution (patched codes into main.dol with wstrt), putting 1 and 2 tracks over Mario Circuit and 0 on everything else, and picking MC only ever crashed the game for me.


RE: Track Randomizer [CLF78] - CLF78 - 08-06-2021

Sounds like an XML issue. Can you send the XML file you use to apply track changes?


RE: Track Randomizer [CLF78] - Yuri Bacon - 08-07-2021

(08-06-2021, 05:34 PM)CLF78 Wrote: Sounds like an XML issue. Can you send the XML file you use to apply track changes?

Code:
<wiidisc version="1">
<id game="RMC" disc="0" version="0"></id>


<options>
  <section name="THE FUNNY">
    <option name="main.dol">
      <choice name="test"><patch id="dol"/></choice>
    </option>
   
    <option name="Tracks">
      <choice name="mc test"><patch id="mctest"/></choice>
    </option>

  </section>
</options>


<patch id="dol">
  <file disc="main.dol" external="/THEFUNNY/main.dol"/>
</patch>

<patch id="mctest">
  <file disc="/Race/Course/castle_course/1.szs" external="/THEFUNNY/Race/Course/castle_course/1.szs"/>
</patch>


</wiidisc>
I made the GCT with the GCT make on this site, and patched the code into main.dol with wstrt (2020-20-03 since that is the last time I bothered to download it). Its been a bit over a week so I don't remember if I had any other codes with it, but I'm pretty sure I had one alongside it, but I think it was just Auto A at Strap Screen. I can try again with just this only code if needed.

The 1.szs is in the right place on the SD card, and I just pulled Luigi Circuit and renamed it to 1.szs for the track as a test.

As far as I can tell it should have worked, or at the very least it should get MC sometimes and not crash but despite trying a good few times, I only ever got crashes.


RE: Track Randomizer [CLF78] - CLF78 - 08-07-2021

You need to specify
Code:
create="true"
in the file tags, because the files do not exist on the disc.