Change Mii Names In Between Online Races [Vega]
#1
Change Mii Names In Between Online Races [Vega]

This code will allow you to set two custom Mii Names and switch back & forth between the two whenever you want on a per-race basis. Everyone can see the effects.

Recommended times to activate your Mii names:
In Idle Room before HOST initates the 1st race/battle
At the VR or BR Screen in a public race/battle
At current point standings right after end of race/battle in a private room

Activating at other times may cause the code to not take effect til the after the next upcoming race.

XXXX = Controller Address
ZZZZ = Button to activate first name
zzzz = Button to activate second name

Do NOT press/hold-down other buttons while pressing your activators.

STUV = Mii Name character for first Mii name. If full Mii name isn't used, fill in rest of values with 0000.
WXYZ = Mii Name character for second Mii name. If full Mii name isn't used, fill in rest of values with 0000.

NOTE: This code uses memory addresses 0x800007D0 thru 0x800007FF. Make sure no other codes in your GCT/Cheat-Manager are using those addresses.

NTSC-U
060007D8 00000028
STUVSTUV STUVSTUV
STUVSTUV STUVSTUV
STUVSTUV WXYZWXYZ
WXYZWXYZ WXYZWXYZ
WXYZWXYZ WXYZWXYZ
C2661094 00000002
3FC08000 93FE07D0
83E1001C 00000000
C25DA7B0 00000003
3C808000 38030068
900407D4 8003006C
60000000 00000000
C0000000 00000013
3D808000 818C07D0
2C0C0000 4D820020
7D8802A6 9421FF80
BC610008 3D808034
618CXXXX A18C0000
3CA08000 2C0CZZZZ
388007D8 41820010
2C0Czzzz 388007EC
40A20048 7C832B78
BB630000 806507D4
BF630000 806507D0
38630012 7F63A5AA
3863FFFE 7C7F1B78
3880004C 38000000
B003004A 3D80800C
618C7830 7D8803A6
4E800021 B07F004A
B8610008 38210080
7D8803A6 4E800020

PAL
060007D8 00000028
STUVSTUV STUVSTUV
STUVSTUV STUVSTUV
STUVSTUV WXYZWXYZ
WXYZWXYZ WXYZWXYZ
WXYZWXYZ WXYZWXYZ
C2663178 00000002
3FC08000 93FE07D0
83E1001C 00000000
C25FB094 00000003
3C808000 38030068
900407D4 8003006C
60000000 00000000
C0000000 00000013
3D808000 818C07D0
2C0C0000 4D820020
7D8802A6 9421FF80
BC610008 3D808034
618CXXXX A18C0000
3CA08000 2C0CZZZZ
388007D8 41820010
2C0Czzzz 388007EC
40A20048 7C832B78
BB630000 806507D4
BF630000 806507D0
38630012 7F63A5AA
3863FFFE 7C7F1B78
3880004C 38000000
B003004A 3D80800C
618C78D0 7D8803A6
4E800021 B07F004A
B8610008 38210080
7D8803A6 4E800020

NTSC-J
060007D8 00000028
STUVSTUV STUVSTUV
STUVSTUV STUVSTUV
STUVSTUV WXYZWXYZ
WXYZWXYZ WXYZWXYZ
WXYZWXYZ WXYZWXYZ
C26627E4 00000002
3FC08000 93FE07D0
83E1001C 00000000
C25FA970 00000003
3C808000 38030068
900407D4 8003006C
60000000 00000000
C0000000 00000013
3D808000 818C07D0
2C0C0000 4D820020
7D8802A6 9421FF80
BC610008 3D808034
618CXXXX A18C0000
3CA08000 2C0CZZZZ
388007D8 41820010
2C0Czzzz 388007EC
40A20048 7C832B78
BB630000 806507D4
BF630000 806507D0
38630012 7F63A5AA
3863FFFE 7C7F1B78
3880004C 38000000
B003004A 3D80800C
618C77F0 7D8803A6
4E800021 B07F004A
B8610008 38210080
7D8803A6 4E800020

NTSC-K
060007D8 00000028
STUVSTUV STUVSTUV
STUVSTUV STUVSTUV
STUVSTUV WXYZWXYZ
WXYZWXYZ WXYZWXYZ
WXYZWXYZ WXYZWXYZ
C2651490 00000002
3FC08000 93FE07D0
83E1001C 00000000
C25E94B4 00000003
3C808000 38030068
900407D4 8003006C
60000000 00000000
C0000000 00000013
3D808000 818C07D0
2C0C0000 4D820020
7D8802A6 9421FF80
BC610008 3D808033
618CXXXX A18C0000
3CA08000 2C0CZZZZ
388007D8 41820010
2C0Czzzz 388007EC
40A20048 7C832B78
BB630000 806507D4
BF630000 806507D0
38630012 7F63A5AA
3863FFFE 7C7F1B78
3880004C 38000000
B003004A 3D80800C
618C7930 7D8803A6
4E800021 B07F004A
B8610008 38210080
7D8803A6 4E800020



Code creator: Vega
Code credits: Star (Mii Name Pointer for self view), WhatIsLoaf (Provided CRC16 Function addresses)



#FIRST ASM

#Address Ports
#NTSC-U = 80661094
#PAL = 80663178
#NTSC-J = 806627E4
#NTSC-K = 80651490

#Store USER Packet Pointer to Exception Vector
lis r30, 0x8000 #r30 safe for use
stw r31, 0x07D0 (r30) #Store the pointer
lwz r31, 0x001C (sp) #Default Instruction

-----------------

#SECOND ASM

#Address Ports
#NTSC-U = 805DA7B0
#PAL = 805FB094
#NTSC-J = 805FA970
#NTSC-K = 805E94B4

#Store self-Mii Name pointer to Exception Vector
lis r4, 0x8000 #r4 safe for use
addi r0, r3, 0x68 #Make r0 point right to start of name
stw r0, 0x07D4 (r4) #Store the pointer
lwz r0, 0x006C (r3) #Default Instruction

-----------------

#THIRD ASM

#START ASSEMBLY (C0)

#Special Compilation Notes
#Obviously use C0 option on PyiiASMH, if you're not on PyiiASMH, you're on your own
#Once compiled

#Address Notes
#0x800007D0 = USER Packet Pointer
#0x800007D4 = self-Mii Name Pointer
#0x800007D8 thru 0x800007EB = First Mii Name
#0x800007EC thru 0x800007FF = Second Mii Name

#Compilation Region Setting, you MUST fill this in before compiling
.set region, '' #e p j or k

#Macros and Statements
.macro call_link address
lis r12, \address@h
ori r12, r12, \address@l
mtlr r12
blrl
.endm

.if (region == 'E' || region == 'e') # RMCE
.set CRC16, 0x800C7830
.set ControllerAddress1stHalf, 0x8034
.elseif (region == 'P' || region == 'p') # RMCP
.set CRC16, 0x800C78D0
.set ControllerAddress1stHalf, 0x8034
.elseif (region == 'J' || region == 'j') # RMCJ
.set CRC16, 0x800C77F0
.set ControllerAddress1stHalf, 0x8034
.elseif (region == 'K' || region == 'k') # RMCK
.set CRC16, 0x800C7930
.set ControllerAddress1stHalf, 0x8033
.else # Invalid Region
.err
.endif

#Start Code, if there's no USER Packet Pointer, don't allow execution of code
lis r12, 0x8000
lwz r12, 0x07D0 (r12)
cmpwi r12, 0
beqlr- #Make code handler return from C0 subroutine

#Backup LR, push Stack Frame
mflr r12
stwu sp, -0x80 (sp)
stmw r3, 0x8 (sp)

#Set Controller Address, load buttons-being-pressed value
lis r12, ControllerAddress1stHalf
ori r12, r12, 0x8200 #GCN PAL used so source can compile
lhz r12, 0 (r12)

#Setup r5 for Vector loading
lis r5, 0x8000

#Check if desired Buttons were pressed
cmpwi r12, 0x0880 #GCN Y button used so source can compile
li r4, 0x07D8 #Set Loading offset beforehand to save source length
beq- activate

cmpwi r12, 0x0480 #GCN X button used so source can compile
li r4, 0x07EC #Set Loading offset beforehand to save source length
bne+ the_end

#Code ACTIVATED. Complete the exception vector address that points to selected Mii name
activate:
or r3, r4, r5

#Load Mii Name into r27 thru r31
lmw r27, 0 (r3)

#Load self-Mii Data Pointer, store Mii Name to self Data
lwz r3, 0x07D4 (r5)
stmw r27, 0 (r3) #r3 is word aligned, safe to do

#Load USER Packet Pointer, write Mii name, adjust r3 for stswi instruction since it won't be word aligned
lwz r3, 0x07D0 (r5)
addi r3, r3, 0x12
stswi r27, r3, 20

#New Checksum must be writen now. Adjust r3 to point to start of entire Mii Data for upcoming CRC16 function call
addi r3, r3, -2

#Backup r3 into r31 for later use
mr r31, r3

#Second Argument for CRC16 function call (size of Mii Data)
li r4, 0x4C

#The game always clears the previous checksum before a new checksum is generated and appended to the Mii Data, so clear it
li r0, 0
sth r0, 0x4A (r3)

#Call CRC16 Function; r3 will return new checksum
call_link CRC16

#Write new checksum, end code
sth r3, 0x4A (r31)

#End Code, Pop Stack Frame, Restore LR
the_end:
lmw r3, 0x8 (sp)
addi sp, sp, 0x80
mtlr r12

#blr #Uncomment if NOT compiling with PyiiASMH via C0 option. ASM Coders will know how to adjust the compiled code to be a proper C0 code.

#END ASSEMBLY

Smile
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)