Coding Questions and other Quandaries
Yogi Bear - Wii (US) "Jump In Midair"


The magic happens in the first few lines of the function "IsOnGround."

8018fe60 IsOnGround__25eSimulatedBipedC lhz r0, 0x01A0 (r3) [0x87 on the ground; 0x80 not on the ground]
8018fe64 IsOnGround__25eSimulatedBipedC li r4, 0
8018fe68 IsOnGround__25eSimulatedBipedC rlwinm. r0, r0, 0, 31, 31 (00000001) [0x1 on the ground; 0x0 not on the ground]
8018fe6c IsOnGround__25eSimulatedBipedC beq- ->0x8018FEBC

** r3 changes to a different address about every three to five seconds. Originally I tried storing r3 to EVA, and doing a 32 bit write (0x87) to the address of the moment, but that didn't work.

So I went brute force and just replaced the [lhz r0, 0x01A0 (r3)] with [li r0, 0x87].

Worked fine in dolphin, but cause the Wii to crash a little ways into the first stage.

Fixed using constant write of the default instruction if the jump button (2) and/or the D-pad buttons are NOT being pressed.

Played through a few levels on the Wii, and the code worked like a champ.

0418FE60 A00301A0 #ASM 32 bit write of the default instruction at 0x8018FE60 [lha r0, 0x1A0 (r3)]
28675572 00000100 #ASM Button conditional; if 2 is pressed next line
0418FE60 38000087 #ASM 32 bit write of the modified instruction at 0x8018FE60 [li r0, 0x87]
E0000000 00000000 #ASM Half way terminator
28675572 00000102 #ASM Button conditional; if 2 and D-pad Up is pressed next line
0418FE60 38000087 #ASM 32 bit write of the modified instruction at 0x8018FE60 [li r0, 0x87]
E0000000 00000000 #ASM Half way terminator
28675572 00000104 #ASM Button conditional; if 2 and D-pad Right is pressed next line
0418FE60 38000087 #ASM 32 bit write of the modified instruction at 0x8018FE60 [li r0, 0x87]
E0000000 00000000 #ASM Half way terminator
28675572 00000108 #ASM Button conditional; if 2 and D-pad Left is pressed next line
0418FE60 38000087 #ASM 32 bit write of the modified instruction at 0x8018FE60 [li r0, 0x87]
E0000000 80008000 #ASM Full terminator

(Note) The controller is held sideways
Reply


Messages In This Thread
RE: Coding Questions and other Quandaries - by Hackwiz - 11-14-2023, 12:21 PM

Forum Jump:


Users browsing this thread: 3 Guest(s)