Coding Questions and other Quandaries
The call stack starts at the top and works its way down. You should be looking for functions starting at the top first.

Your code fails for 3 reasons
- You're effecting the main parent function (bottom of call stack) which is responsible for a crap ton of things, guaranteed to crash
- You are calling a function without a re-link (will eventually crash or end up in a infinite loop somewhere).
- You've provided no args and odds are that the function does requires arg(s)

--

Regarding your game, afaik save data for Wii games are stored in the /title directory of the NAND. The string you have provided does not include the title directory, which is odd. Be sure you are actually looking at the true save data file path.

If it is, I would start looking at what is at 0x80182E54. Should be a prologue there.

To get an idea of what register args are used for a function, observe the prologue.

If it does something like this in its prologue...

Code:
stwu sp, -0x0010 (sp)
mflr r0
stw r0, 0x14 (sp)
stmw r30, 0x8 (sp) #Backup old r30 and r31 values
mr r31, r3 #Place r3 into r31 for later processing
mr r30, r4 #Place r4 into r30 for later processing

Then it appears only process r3 and r4 as args. The game will usually place the args starting at r31 and working down from there. This is because r14 thru r31 are global variable registers and are preserved thru function calls. The game will use the new r30 and r31 values as elements for other/new child functions that it calls. I suggest re-reading the Guide to Function Calls in Codes guide again.

Anyway, check the address that called the 0x80182E54 function. See if there are instructions after the bl instruction. Something like this...

Code:
cmpwi r3, 0
beq- XXXX

Look for any instructions that deal with verifying r3. This would be the CPU doing a r3 return value check of the function that was just called.

Args (non floats; stuff in r3 thru r10) will be pointers (memory addresses) or integers. It can be very difficult to figure out what exactly the args represent.

This kind of PPC coding is quite the jump from beginner stuff. It may be best for you to take existing known functions from other games (like the ISFS functions on Brawl or mkwii) and port them using RAM Dumps to your game. Then twiddle with ISFS to get a hang of function calls and also working with files on the NAND.
Reply


Messages In This Thread
RE: Coding Questions and other Quandaries - by Vega - 03-06-2022, 12:39 AM

Forum Jump:


Users browsing this thread: 33 Guest(s)