Coding Questions and other Quandaries
Monster Mayhem: Build and Battle Wii (U)

Speed Boost x4/Walk Through Walls (Press C) [Use K Pad Read Hook Type]

C2037858 00000007
3D808062 A16C54BA
2C0B4000 40820020
3D608066 616B994C
7C045800 40820010
3D8040F8 618C1480
91840000 C0040000
60000000 00000000

0x806254BA Button activator half-word Address
0x8066994C Max Speed value loaded from this address on the stack (r4)
0x80C2CD24 Speed modifier address (r3)

Insert address 0x80037858 (also showing store code directly following):

0x80037858  lfs f0, 0x0 (r4)
0x8003785C stfs f0, 0x0 (r3)

***I was basing all my codes that worked in Dolphin, but not on the Wii, on the store portion of this routine.
Once I focused on the load portion (and changed the hook type to K Pad Read), the code worked flawlessly on the Wii.

Source:


lis r12, 0x8062            #ASM Load upper half word of button activator address
lhz r11, 0x54BA(r12)    #ASM Load r11 with value at button activator address
cmpwi r11, 0x4000      #ASM Check to see if the C button is pressed. If not, default_load
bne- default_load

lis r11, 0x8066            #ASM Load upper half word of address max speed value is to be loaded from
ori r11, r11, 0x994C    #ASM Load lower half word of address max speed value is to be loaded from
cmpw r4, r11              #ASM Check to see if that address is being held in r4. If not, default_load
bne- default_load

lis r12, 0x40F8              #ASM Load upper half word of max speed modifier value into r12
ori r12, r12, 0x1480      #ASM Load lower half word of max speed modifier value into r12
stw r12, 0(r4)              #ASM Store speed modifier value at address in r4, which is to be loaded into f0

default_load:
lfs f0, 0(r4)                  #ASM Load speed modifier value into f0

This is then directly followed by:

0x8003785C stfs f0, 0x0 (r3)
Reply


Messages In This Thread
RE: Coding Questions and other Quandaries - by Hackwiz - 05-31-2022, 10:59 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)