Coding Questions and other Quandaries
#55
My wife and I, to this day, still love playing Wii Sports Resort Bowling.
I, more than she, enjoyed the training modes in the original Wii sports.
But I thought one type of training mode is missing. Splits Practice.

So using my elementary knowledge of button activators, I came up with a code that through
the pressing of various button combinations and such, allowed you to practice the hardest split combinations
noted by USA Bowling.

You should have seen the look on my wife's face when she rolled her first ball and all of a sudden the
7 - 10 splits appeared. Priceless!!!! She knows I hack, so she immediately turned to me and said, "what did you do?"

The problem though, is that once you enter my splits mode, you can't go back to a standard game
unless you totally reboot the game, which with USBLoader can be a drag.

So I sat down for the last couple of mornings and came up with a good working code.
It definitely needs some tweaking though.

I tried doing this with strictly Gecko codes for the activation button press cycling part, but just ended up tying my brain in knots.
So I attacked it from the ASM angle.
Deactivation is simple enough with ASM/Gecko.

For reference, I found a nice piece of RAM not being used, (at least from boot up to the bowling games).
I used 0x80AF6000 for storing the (-) button presses, to step through the different splits configurations, via conditionals.

It's a bit "wordy" lol.

See you at the bottom Smile Smile Smile

C201D30C 00000005
A0050000 2C071000
40820018 3D6080AF
616B6000 818B0000
398C1000 918B0000
60000000 00000000
E0000000 80000000
28AF6000 00000001
01269C35 00000000
0126A1B1 00000000
0126A72D 00000000
0126ACA9 00000000
0126B225 00000000
0126B7A1 00000000
0126BD1D 00000001
0126C299 00000000
0126C815 00000000
0126CD91 00000001
E0000000 80000000
28AF6000 00000002
01269C35 00000000
0126A1B1 00000000
0126A72D 00000000
0126ACA9 00000001
0126B225 00000000
0126B7A1 00000001
0126BD1D 00000001
0126C299 00000000
0126C815 00000000
0126CD91 00000001
E0000000 80000000
28AF6000 00000003
01269C35 00000001
0126A1B1 00000001
0126A72D 00000001
0126ACA9 00000001
0126B225 00000001
0126B7A1 00000001
0126BD1D 00000001
0126C299 00000001
0126C815 00000001
0126CD91 00000001
E0000000 80000000
28AF6000 00000004
01269C35 00000000
0126A1B1 00000000
0126A72D 00000000
0126ACA9 00000001
0126B225 00000000
0126B7A1 00000001
0126BD1D 00000001
0126C299 00000001
0126C815 00000000
0126CD91 00000001
E0000000 80000000
28AF6000 00000005
01269C35 00000000
0126A1B1 00000000
0126A72D 00000000
0126ACA9 00000001
0126B225 00000000
0126B7A1 00000001
0126BD1D 00000000
0126C299 00000000
0126C815 00000000
0126CD91 00000001
E0000000 80000000
28AF6000 00000006
01269C35 00000000
0126A1B1 00000000
0126A72D 00000000
0126ACA9 00000001
0126B225 00000000
0126B7A1 00000001
0126BD1D 00000001
0126C299 00000000
0126C815 00000000
0126CD91 00000000
E0000000 80000000
28AF6000 00000007
01269C35 00000000
0126A1B1 00000000
0126A72D 00000000
0126ACA9 00000001
0126B225 00000000
0126B7A1 00000001
0126BD1D 00000000
0126C299 00000000
0126C815 00000000
0126CD91 00000000
E0000000 80000000
28AF6000 00000008
01269C35 00000000
0126A1B1 00000000
0126A72D 00000000
0126ACA9 00000000
0126B225 00000000
0126B7A1 00000000
0126BD1D 00000001
0126C299 00000000
0126C815 00000001
0126CD91 00000000
E0000000 80000000
28AF6000 00000009
01269C35 00000000
0126A1B1 00000000
0126A72D 00000001
0126ACA9 00000000
0126B225 00000000
0126B7A1 00000000
0126BD1D 00000001
0126C299 00000000
0126C815 00000001
0126CD91 00000000
E0000000 80000000
28AF6000 0000000A
01269C35 00000000
0126A1B1 00000001
0126A72D 00000000
0126ACA9 00000000
0126B225 00000000
0126B7A1 00000000
0126BD1D 00000000
0126C299 00000001
0126C815 00000000
0126CD91 00000001
E0000000 80000000
28AF6000 0000000B
01269C35 00000001
0126A1B1 00000001
0126A72D 00000001
0126ACA9 00000001
0126B225 00000001
0126B7A1 00000001
0126BD1D 00000001
0126C299 00000001
0126C815 00000001
0126CD91 00000001
E0000000 80000000
28AF6000 0000000C
02AF6000 00000001
E0000000 00000000
28708D40 00000100
0401D30C A0050000
02AF6000 00000000
E0000000 80008000

Are you still with me???

Here's the ASM. I hijacked the control line read cycle at 0x8001D30C:

lhz r0, 0(r5) #ASM r7 holds value of button being pressed
cmpwi r7, 0x1000 #ASM if (-) button not being held, the_end:
bne- the_end
lis r11, 0x80AF #ASM Loads upper half-word of address being monitored 0x80AF6000
ori r11, r11, 0x6000 #ASM Loads lower half-word of address being monitored 0x80AF6000
lwz r12, 0(r11) #ASM Loads word currently held in monitor address
addi r12, r12, 0x1000 #If (-) button pressed, adds 0x1000 to value currently held in monitor address
stw r12, 0(r11) #ASM Stores increase in (-) button strokes
the _end:

The deactivation part is pretty simple. Pressing 2 writes the original word at the insert, and sets
the monitor address back to 0x0.

28708D40 00000100 #If button 2 pressed
0401D30C A0050000 #Writes original code at insert
02AF6000 00000000 #Resets monitor address so no splits configuration conditionals met until next (-) press

The rest of the code is Gecko conditionals and writes for the different split configurations.
And a conditional to reset the monitor address back to the first splits configuration.
Unfortunately there is an offset between the different pin addresses or this would have been
easy to do with a lot less code.

So the obvious question is, how to achieve all the writes in a more condensed way.

At some point, I'd like to do the same thing to the 100 pin game, but doing it this way would
result in a 900+ line code.

And also, how to make a gecko code for the (-) button press so it only adds 0x1000 to the monitor
address each time it is pressed.

The way my code is now, because I'm using the control line read cycle, as you press (-) the value increments very quickly by 0x1000 obviously. However, the game can't update the pins as quickly as the conditionals are met this way so it makes trying to cycle through the configurations haphazard and unpredictable.

I adjusted the split configuration conditionals to monitor bits 12 - 15 of the monitor address instead to make it more user friendly.
Still could use a little more tweaking to sink up with the pin updates.

[Gone bowling]
Reply


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

Forum Jump:


Users browsing this thread: 3 Guest(s)