Coding Questions and other Quandaries
Mario Sports Mix (U) RMKE01

Custom Character Selection Modding (See Note)

c36035b0 00000004
3d608000 818b03d0
2c0c0000 4082000c
399b0010 918b03d0
881b0010 00000000
c0000000 00000008
3d608000 a18b03b2
a0ab03b0 398c0001
2c0c0038 40a2001c
39800000 38a50001
2c050012 41a00008
38a00000 b0ab03b0
b18b03b2 4e800020
60000000 00000000
c0000000 0000000e
3d808000 816c03d0
88ac03b1 3d80804c
618cc000 a18c0f12
2c0c2001 38600000
41820040 2c0c2008
38600028 41820034
2c0c2002 38600050
41820028 2c0c4001
38600078 4182001c
2c0c4008 386000a0
41820010 2c0c4002
386000c8 4ca20020
7d6b1a14 98ab0000
4e800020 00000000
284ccf12 00006000
040003d0 00000000
e0000000 80008000

(Note)
Press and release C + Z at the "2 on 2," or "3 on 3" selection screen to reset the character mod pointer. This must be done every time!!!

In the character selection screen, after choosing all the characters, the select difficulty pop up will appear.
Press and hold one of the following button combinations to change the character you wish to mod. When the desired character is displayed
release the buttons. Choose difficulty level. Play the game.

Z + D-pad L (P1)
Z + D-pad U (AI 1)
Z + D-pad R (AI 2)
C + D-pad L (P2 or (AI 3)
C + D-pad U (AI 4)
C + D-pad R (AI 5)

Here's the source:

###This is setting up a pointer in EVA to P1’s character mod byte address.

c36035b0 00000004
3d608000 818b03d0
2c0c0000 4082000c
399b0010 918b03d0
881b0010 00000000

lis r11, 0x8000 #ASM Load upper half-word of EVA address
lwz r12, 0x3D0 (r11) #ASM Load lower half-word of EVA address
cmpwi r12, 0x0 #ASM Check to see if there’s an address already stored.
bne- def_code
addi r12, r27, 0x10 #ASM If no address is held in r12, add offset of 0x10
stw r12, 0X3D0 (r11) #ASM Then store true address in EVA

def_code:
lbz r0, 0X10 (r27) #ASM default code

###This is setting up the character mod value rotation in EVA

C0000000 00000008
3D608000 A18B03B2
A0AB03B0 398C0001
2C0C0040 40A2001C
39800000 38A50001
2C050012 41A00008
38A00000 B0AB03B0
B18B03B2 4E800020
60000000 00000000

lis r11, 0x8000 #ASM Load upper half-word of EVA address
lhz r12, 0x3b2 (r11) #ASM Load lower half-word of EVA address for interval timer.
lhz r5, 0x3b0 (r11) #ASM Load lower half-word of EVA address for character mod value cycling
addi r12, r12, 0x1 #ASM Add 0x1 to interval timer
cmpwi r12, 0x38 #ASM See if upper limit of interval timer has been reached; Adjust this for cycling speed
bne+ store_interval_timer #ASM if not reached, store the incremented value
li r12, 0x0 #ASM If it has been reached, load r12 to reset value to 0x0
addi r5, r5, 0x1 #ASM Load r5 to increment character mod value by 0x1
cmpwi r5, 0x12 #ASM See if upper limit of character mod value has been reached 0x11 (Black Mage)
blt+ store_char #ASM If not, store the incremented character mod value
li r5, 0x0 #ASM If it has been reached, load r5 to reset value to 0x0 (Mario)
store_char:
sth r5, 0x3b0 (r11) #ASM Store character mod value
store_interval_timer:
sth r12, 0x3b2 (r11) #ASM Store interval timer value
blr

###This is the button activator portion of the code

c0000000 0000000e
3d808000 816c03d0
88ac03b1 3d80804c
618cc000 a18c0f12
2c0c2001 38600000
41820040 2c0c2008
38600028 41820034
2c0c2002 38600050
41820028 2c0c4001
38600078 4182001c
2c0c4008 386000a0
41820010 2c0c4002
386000c8 4ca20020
7d6b1a14 98ab0000
4e800020 00000000

lis r12, 0x8000 #ASM Load upper half-word of EVA address
lwz r11, 0x3D0 (r12) #ASM Load r11 with P1’s character mod value address (base pointer)
lbz r5, 0x3B1 (r12) #ASM Load r5 cycling character mod value
lis r12, 0x804C #ASM Load upper half-word of button activator address
ori r12, r12, 0xC000 #ASM Load lower half-word of button activator address
lhz r12, 3858(r12) #ASM Load r12 with button activator value
cmpwi r12, 0x2001 #ASM Check to see if Z + D-pad L are being pressed
li r3, 0x0 #ASM If so, load offset added to pointer held in r11 for character mod value store (P1)
beq- store_it #ASM Just like it says
cmpwi r12, 0x2008 #ASM Check to see if Z + D-pad U are being pressed
li r3, 0x28 #ASM If so, load offset added to pointer held in r11 for character mod value store (AI1)
beq- store_it #ASM Just like it says
cmpwi r12, 0x2002 #ASM Check to see if Z + D-pad R are being pressed
li r3, 0x50 #ASM If so, load offset added to pointer held in r11 for character mod value store (AI2)
beq- store_it #ASM Just like it says
cmpwi r12, 0x4001 #ASM Check to see if C + D-pad L are being pressed
li r3, 0x78 #ASM If so, load offset added to pointer held in r11 for character mod value store (P2/AI3)
beq- store_it #ASM Just like it says
cmpwi r12, 0x4008 #ASM Check to see if C + D-pad U are being pressed
li r3, 0xA0 #ASM If so, load offset added to pointer held in r11 for character mod value store (AI4)
beq- store_it #ASM Just like it says
cmpwi r12, 0x4002 #ASM Check to see if C + D-pad R are being pressed
li r3, 0xC8 #ASM If so, load offset added to pointer held in r11 for character mod value store (AI5)
bnelr+ #ASM If correct combo of buttons are not pushed, branch to link register

store_it:
add r11, r11, r3 #ASM Add offset to P1’s Character mod value address stored in EVA
stb r5, 0(r11) #ASM Store character mod value to appropriate player/AI
blr #ASM We outta here

###This resets the pointer in EVA

284ccf12 00006000 #ASM See if C + Z are being pressed
040003d0 00000000 #ASM If so, reset pointer in EVA to 0x0
e0000000 80008000 #ASM Full terminator
Reply


Messages In This Thread
RE: Coding Questions and other Quandaries - by Hackwiz - 05-05-2023, 12:35 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)