Coding Questions and other Quandaries
#3
(12-06-2021, 12:47 AM)Vega Wrote: EDIT

The address for the stw instruction changes too? That's odd. I'm guessing the game uses some relocatable module of some sort. Still try out what I crossed below just in case as the way you are writing your source out is incorrect.

Code:
80E9AA08 stw r3, 0x0014 (r29)

This instruction is storing the Health (what's in r3) to its designated spot in dynamic memory. That spot is at r29 + 0x0014. Thus the value of r29 itself is a dynamic memory address. This is why you are having different mem91 addresses.

What's good though is that r29+0x0014 will always point to where the Health is at. Regardless of what r29 is at the time. What you need to do is modify what's in r3 before it gets stored to dynamic memory.

So like this...


Code:
li r3, 0xC8 #Set custom Health amount
stw r3, 0x0014 (r29) #Default Instruction, Health gets stored to Dynamic Memory

li r3, 0xc8
stw r3, 0x0014 (r29)

Was how I wrote the code originally. However, this also gives enemies you attack infinite health.
Again, thanks to the guides on the site and some thinking what had to be logically done, I came up with the code I listed.

stw r3, 0x0014 (r29) #Store decreased health amount
li r11, 0xC8 #Set custom Health amount #Set custom Health amount  #Set custom Health amount
lis r12, 0x91D3 #Load upper half-word of address in r29 into r12
stw r11, 0x1454 (r12) #Store r11 at address in r12 + offset [r29 + 0x0014]. 

Celia can take a beating and still slay enemies.
It dawned on me this morning that I just figured out how to get around a problem which has stymied me on a quite a few games.

Here's another question. Is it possible to run a trace log in Dolphin?
Would be nice to see what is going on when her new health address is generated.
I see options for RAM dumps, but it seems to me that's not the same thing.

li r3, 0xC8 #Set custom Health amount

stw r3, 0x0014 (r29) #Default Instruction, Health gets stored to Dynamic Memory


li r3, 0xC8 #Set custom Health amount

stw r3, 0x0014 (r29) #Default Instruction, Health gets stored to Dynamic Memory
Reply


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

Forum Jump:


Users browsing this thread: 3 Guest(s)