Random Character but w/ Best Bike For Every Race Online [Vega]
#1
Random Character but w/ Best Bike For Every Race Online [Vega]

Online only. Does NOT work in battle.

A slight mod to my original random character+combo codeĀ HERE to suit users who want to race more competitively. You will get a random character to race as (except Mii) for every online race (except Battle), but you will always use the best bike for w/e weight class of character you get. This means if you get a random lightweight, you are using bullet bike. If you get a random middleweight, you will be using machbike. And you will use flame runner for the random heavyweight chracter.

NOTE: This code makes use of memory address 0x800004C0. Make sure no other codes in your GCT/Cheat-Manager are using that address.

Region-Free
C0000000 00000026
7CA802A6 3D808000
896C04C0 396B0001
280B0018 41A00008
39600000 996C04C0
38000015 2C0B0001
41820084 2C0B0004
4182007C 2C0B0005
41820074 2C0B0006
4182006C 2C0B0008
41820064 2C0B000C
4182005C 2C0B000D
41820054 2C0B000E
4182004C 38000016
2C0B0000 41820040
2C0B0007 41820038
2C0B000A 41820030
2C0B000F 41820028
2C0B0010 41820020
2C0B0011 41820018
2C0B0012 41820010
2C0B0014 41820008
38000017 898C5F27
2C0C00EC 41820020
2C0C0010 41820024
2C0C0054 41820028
3D808061 618C2328
48000024 3D808064
618C374C 48000018
3D808064 618C2DB4
4800000C 3D808063
618C1A60 3D403880
7D4A5B78 914C0000
48000019 3D4038A0
7D4A0378 398C0004
914C0000 7CA803A6
7C00606C 7C0004AC
7C0067AC 4C00012C
4E800020 00000000

#~~~~~~~~~~~~~~~~~~~~~~~~#
# START ASSEMBLY C0 Code #
#~~~~~~~~~~~~~~~~~~~~~~~~#

#######################
#NOTES ABOUT COMPILING#
#######################

#(Even if you use PyiiASMH), compile this as a C2 (no address), then change C2 to C0.
#If you compile as a C0 in PyiiASMH, there will be an extra unnecessary blr at the very end
#Makes no difference, just an fyi

#~~~~~~~~~~~~~~#
# Memory Notes #
#~~~~~~~~~~~~~~#

#0x800004C0 = Byte cycle character

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Backup C0 LR, Setup Vector Address, Increment Character Value #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

mflr r5
lis r12, 0x8000
lbz r11, 0x04C0 (r12)

addi r11, r11, 1

cmplwi r11, 0x18 #range 0 thru 0x17
blt+ store_char_byte

li r11, 0 #Reset cycle

store_char_byte:
stb r11, 0x04C0 (r12)

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Set r9 for leightweight lbzx load offst #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

li r0, 0x15

cmpwi r11, 1
beq- check_region
cmpwi r11, 4
beq- check_region
cmpwi r11, 5
beq- check_region
cmpwi r11, 6
beq- check_region
cmpwi r11, 8
beq- check_region
cmpwi r11, 0xC
beq- check_region
cmpwi r11, 0xD
beq- check_region
cmpwi r11, 0xE
beq- check_region

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Set r9 to 1 add middleweight pattern add. Check for middleweight #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

li r0, 0x16

cmpwi r11, 0
beq- check_region
cmpwi r11, 7
beq- check_region
cmpwi r11, 0xA
beq- check_region
cmpwi r11, 0xF
beq- check_region
cmpwi r11, 0x10
beq- check_region
cmpwi r11, 0x11
beq- check_region
cmpwi r11, 0x12
beq- check_region
cmpwi r11, 0x14
beq- check_region

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Character is heavyweight. Set r9 to add 2 for pattern #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

li r0, 0x17

check_region:
lbz r12, 0x5F27 (r12) #Instruction here is vital. Virtually impossible for this to be modded by something unrelated

cmpwi r12, 0xEC
beq- pal
cmpwi r12, 0x10
beq- japan
cmpwi r12, 0x54
beq- korea

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Apply Character Address Based on Game Region #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

#usa
lis r12, 0x8061
ori r12, r12, 0x2328
b write_values

pal:
lis r12, 0x8064
ori r12, r12, 0x374C
b write_values

japan:
lis r12, 0x8064
ori r12, r12, 0x2DB4
b write_values

korea:
lis r12, 0x8063
ori r12, r12, 0x1A60

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Write New Instructions to Static Memory #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

write_values:
lis r10, 0x3880
or r10, r10, r11
stw r10, 0 (r12) #Store Character Value

bl clear_cache

lis r10, 0x38A0
or r10, r10, r0
addi r12, r12, 4 #Needed for upcoming cache flush
stw r10, 0 (r12) #Store Vehicle Value

#~~~~~~~~~~~~~~~#
# Restore C0 LR #
#~~~~~~~~~~~~~~~#

mtlr r5

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Clear Cache, so Instructions always update #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

clear_cache:
dcbst 0, r12
sync
icbi 0, r12
isync
blr #When called 2nd time, this will be the C0 LR

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


Forum Jump:


Users browsing this thread: 1 Guest(s)