Riivolution Memory Patch + PowerPC + Gecko Code Generators
Quick and simple Riivoution Memory Patch, PowerPC and Gecko Code generators (this description is a work in progress)
Enter the hex value of the instructions that you want to patch in (hex values, without spaces)
Enter the hex value of at least 5 consecutive instructions (hex values, without spaces)
Output:
Regular Riivolution memory patches work by directly replacing an instruction
in the game's code (although they won't work if the game writes a value to the
address they replace the value of after boot. You'll need a 04 RAM Write code
to keep that from happening).
The thing with memory patches is that you have to enter a memory address specific
to the region of the game you're working with. This means that if you made a patch
to replace the value at an address in the NTSC version of a game, it won't work on
the PAL version since the addresses are different.
Riivolution memory patches have a "search" feature. A "search patch" scans the game's
memory for a specific set of bytes and replaces them with custom bytes if found.
It can search for any sequence of bytes. This includes the bytes that make up the hex
values of instructions in the game's code. This generator takes full advantage of that.
The generator creates a search patch for you. You need to enter the exact sequence of bytes
corresponding to the instructions surrounding the target instruction ("target instruction" refers
to the memory address you want to alter the value of, so start by entering the original hex
value of that). The generated search patch will search the game's memory for the specific
sequence of bytes you entered to locate the correct function containing the target instruction.
Once found, the patch replaces the instruction(s) with the custom bytes provided.
This allows the memory patch to be "universal" and work across all regions.
It works because the game's actual code is pretty much unchanged between
regions, which means that the byte sequences that make up its code are too.
The only issue with this type of patch is that it sometimes has trouble finding the byte
values of instructions that load specific addresses into registers. It also doesn't work
with function callers ("bl" instructions), but apart from that, it works perfectly!
EXAMPLE:
In Wii Sports Resort there's a function at (NTSC) 0x8063358C that updates the time of day
in Swordplay Showdown after you complete a stage. This is what it looks like in the code (I explained how this function works in the "developer's commentary" of The Swordplay
Showdown: Service and Shenanigans Packso I'm going to refrain from doing so here):NTSC_0x8063358C: 8063358c: lwz r3, -0x20E0(r13) 80633590:addi r0, r3, 0x1 80633594: stw r0, -0x20E0(r13) 80633598: cmpwi r0, 0x3 8063359c: bltlr- 806335a0: li r0, 0 806335a4:stw r0, -0x20E0(r13) 806335a8:blr
Let's say I wanted to replace the "bltlr-" instruction with "nop" (no operation)
and the "li r0, 0" instruction with "li r0, 1"
The hex value for "nop" is "60000000"
The hex value for "li r0, 1" is "38000001"
So normally, I'd just make a memory patch to replace the instructions. Like this:
This would work perfectly fine on the NTSC version of the game, but not the
PAL version since the memory addresses are different between them.
With a search patch, you can't search for one specific instruction since there's no
way to narrow things down. However, you CAN use it to search for a specific function.
Here's how:
The function I mentioned earlier that updates the time of day... let's have a closer look at it.
The values on the left are hex values. On the right are the instructions that value translates to:
At this point, addresses don't matter, as the game will only be patching in
the "new" bytes after it finds the original.
The highlighted lines above are the new instructions I want to patch in. The same process of
copying all the hex values and arranging them in sequence without spaces has to be repeated,
which will then give me the following bytes:
What this patch does is search the game's memory for a specific set of bytes, which in this case is "806DDF2038030001900DDF202C0000034D80002038000000900DDF204E800020." Once those bytes are found, they're immediately replaced with "806DDF2038030001900DDF202C00000360000038000001900DDF204E800020." This patches my new instructions into the game's code.
This memory patch works on both NTSC and PAL because the
original source code in the function I modified is exactly the same
across both regions, meaning that the exact set of bytes this patch
searches for and replaces exists in both the NTSC and PAL version
of the game. Hopefully, all of that made sense to you!
Enter the Address that holds the value you want to replace:
Enter the value you want to insert at said Address:
Enter an empty register for said Address:
Enter another empty register for the value you want to insert at said Address: REMOVE THE BLR INSTRUCTION IF YOU EXPERIENCE CRASHING WITH THE CODE
ASM Output:
EXAMPLE:
Enter the Address that holds the value you want to replace: 802c9210
Enter the value you want to insert at said Address: 2C1811FF
Enter an empty register for said Address: r14
Enter another empty register for the value you want to replace at said Address: r15