MKWii.org
Random Track Selection For Offline - Printable Version

+- MKWii.org (https://mkwii.org)
+-- Forum: Hacks/Modding (https://mkwii.org/forumdisplay.php?fid=14)
+--- Forum: Cheat Codes (https://mkwii.org/forumdisplay.php?fid=15)
+--- Thread: Random Track Selection For Offline (/showthread.php?tid=1118)



Random Track Selection For Offline - zak - 04-14-2019

Random Track Selection For Offline

Offline only. Does not work in Grand Prix.

This code will give you the ability to have a "random" feature for track selection. Just select any track at the track selection screen. When the Race/TT/Battle begins, it will be a random track that is loaded. For TT's this also effects the loading of the ghost preview screen.

This code makes use of memory addresses 0x8000149E 0x8000149F. Make sure no other codes in your GCT/Cheat-Manager are using those addresses.

NTSC-U
C21A9CDC 00000009
3C808000 8864149E
2803001F 41A10008
3860001F 38630001
2803002A 41A00008
38600020 9864149E
8864149F 38630001
28030020 41A00008
38600000 9864149F
38800000 00000000
C2825F74 00000002
3FE08000 8BFF149F
93E31758 00000000
C28529C8 00000002
3F808000 8B9C149E
93861758 00000000

PAL
C21A9D7C 00000009
3C808000 8864149E
2803001F 41A10008
3860001F 38630001
2803002A 41A00008
38600020 9864149E
8864149F 38630001
28030020 41A00008
38600000 9864149F
38800000 00000000
C28409D4 00000002
3FE08000 8BFF149F
93E31758 00000000
C283D0E8 00000002
3F808000 8B9C149E
93861758 00000000

NTSC-J
C21A9C9C 00000009
3C808000 8864149E
2803001F 41A10008
3860001F 38630001
2803002A 41A00008
38600020 9864149E
8864149F 38630001
28030020 41A00008
38600000 9864149F
38800000 00000000
C2840040 00000002
3FE08000 8BFF149F
93E31758 00000000
C283C754 00000002
3F808000 8B9C149E
93861758 00000000

NTSC-K
C21AA0D8 00000009
3C808000 8864149E
2803001F 41A10008
3860001F 38630001
2803002A 41A00008
38600020 9864149E
8864149F 38630001
28030020 41A00008
38600000 9864149F
38800000 00000000
C282ED94 00000002
3FE08000 8BFF149F
93E31758 00000000
C282B4A8 00000002
3F808000 8B9C149E
93861758 00000000



List of Sources-

1st ASM (Track Byte Cycler);

#~~~~~~~~~~~~~~~~#
# START ASSEMBLY #
#~~~~~~~~~~~~~~~~#

#

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#  Memory Address & Value Notes  #
# 0x8000149E = Battle Track Byte #
#   0x8000148F = VS Track Byte   #
#   0x00 thru 0x1F = VS Tracks   #
# 0x20 thru 0x29 = Battle Tracks #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#                    Register Safey Notes                         #
#         r3 safe for use, gets overwritten next address          #
# r4 safe for use, gets overwritten by default instruction at end #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

#~~~~~~~~~~~~~~~~~~~~~~~~#
# Load Battle Track Byte #
#~~~~~~~~~~~~~~~~~~~~~~~~#

lis r4, 0x8000
lbz r3, 0x149E (r4)

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Battle Track Byte 1st Comparsion Check #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

cmplwi r3, 0x1F
bgt+ _skipinitial #If greater than 0x1F, the battle cycle has already started

li r3, 0x1F #If not greater than 0x1F, begin the start of byte cycle, set value to 0x1F since the next instruction adds 1 to itself, value 0x20 is lowest byte value out of the battle tracks

_skipinitial:
addi r3, r3, 1 #Increment the Battle Byte by 1

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#   Battle Track Byte 2nd Comparison Check   #
# If 0x2A, reset the cycle back down to 0x20 #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

cmplwi r3, 0x2A
blt+ _dontreset1

li r3, 0x20

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Store Updated Battle Byte to Exception Vector Area #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

_dontreset1:
stb r3, 0x149E (r4)

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Load VS Track Byte, Increment It #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

lbz r3, 0x149F (r4)
addi r3, r3, 1

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#  Compare VS Track Byte to 0x20 (first battle track)   #
#                If 0x20, reset the cycle               #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

cmplwi r3, 0x20
blt+ _dontreset2

li r3, 0

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Store Updated Track Byte, Default Instruction #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

_dontreset2:
stb r3, 0x149F (r4)
li r4, 0 #Default Instruction

#

#~~~~~~~~~~~~~~#
# END ASSEMBLY #
#~~~~~~~~~~~~~~#

====

2nd ASM (Load updated VS Track Byte to replace selected Track):

lis r31, 0x8000
lbz r31, 0x149F (r31) #Load Track Byte
stw r31, 0x1758 (r3) #Default Instruction, Store Track Word Value to Memory

====

3rd ASM (Load updated Battle Track Byte to replaced selected Track):

lis r28, 0x8000
lbz r28, 0x149E (r28) #Load Track Byte
stw r28, 0x1758 (r6) #Default Instruction, Store Track Word Value to Memory



Code creator: zak