Coding Questions and other Quandaries
#4
That instruction (when executed by the CPU) is being used for each enemy's health as well. Usually when something like that happens, there's an 'index byte' in one of the Global Variable Registers (r14 thru r31). In the majority of Wii games, they like to use '0' to represent Player, and '1' for CPU #1, '2' for CPU #2, etc etc.

You could keep the Memory Write Breakpoint active while constantly unpausing the emulation after every hit while looking at what's in r14 thru r31. Screenshots are recommended to keep record. If you notice a pattern to where let's say r17 is always 0 when its your health but always non-zero on an enemy's health, then that Register could be the 'index byte'. Then you can write a basic check like this...

Code:
cmpwi r17, 0 #Pretend the index byte register is r17
bne+ dont_execute #Index is not zero, don't set the Health

li r3, 0xC8 #Set the Health

dont_execute:
stw r3, 0x0014 (r29) #Default instruction, store health

Sometimes these indices won't be used and a more 'hacky' method will be required.

--

In regards to the changing instruction address, a 'hacky' way to solve this problem is using the F6 Gecko Codetype - https://mariokartwii.com/showthread.php?tid=545

You can use your instruction (compiled form) with a string of instructions after/before so you have a unique string to search for. The F6 code will search for this unique string. Once found, it can hook your ASM code at that address.

However this may need more Gecko codetypes on top of it, because F6 code's are executed immediate upon boot. So if the string isn't found right away, it simply won't hook. Relocatable modules are loaded up by the game some time later after the main executable file is loaded (main.dol)
Reply


Messages In This Thread
RE: Coding Questions and other Quandaries - by Vega - 12-06-2021, 01:20 AM

Forum Jump:


Users browsing this thread: 39 Guest(s)