[REQUEST] How to get the profile address of the current player?
#1
For a LE-CODE cheat code I need a function to get the address of the profile (save data) of the current player. Alternatively it is ok to get the index of the current player, because I know how to get the address by index:

ADDRESS := [809BD748] + INDEX * 0x93f0 (PAL)
Reply
#2
I think I got it (not verified)

Base addresses:
PAL: 0x809bd748
USA: 0x809B8F88
JAP: 0x809BC7A8
KOR: 0x809ABD88

Base_addresses is a pointer to a structure with at least 0x38 bytes. The short value at offset 0x36 gives you the index of the current player.
Reply
#3
EDIT: Disregard my post, I misread yours. Apologies and thank you Seeky.

Regarding save data, the game does the following to get the pointer to the save data once its loaded into memory

Code:
NTSC-U
lis r3, 0x809C
lwz r3, -0x7078 (r3)
lwz r3, 0x0014 (r3)

PAL
lis r3, 0x809C
lwz r3, -0x28B8 (r3)
lwz r3, 0x0014 (r3)

NTSC-J
lis r3, 0x809C
lwz r3, -0x3858 (r3)
lwz r3, 0x0014 (r3)
   
NTSC-K
lis r3, 0x809B
lwz r3, -0x4278 (r3)
lwz r3, 0x0014 (r3)

substitute r3 with w/e register you need to use.

For player index, stebler uses the following in his pretty speedometer~

PAL using r4
Code:
.set ptr_raceData, 0x809bd728
# get the player index from the first hud slot
lis r4, ptr_raceData@ha
lwz r4, ptr_raceData@l (r4)
lbz r4, 0xb84 (r4)
Reply
#4
I think Wiimm meant the save file index? The code you sent from stebler gives the race player index
Finally got a chance to check my old documentation and the address + offset Wiimm gave seems correct (for PAL, at least, didn't check the others)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)