Logging game events to text file
#15
That was a typo my part.

lwz r31, 0x008C (r3) will load a word value into r31

You will need to write some ASM code to check whats at r3 + 0x008C.

You can have the original instruction execute for you first. That way you can simply run a check/comparison on what contents on in r31.

Then you write some code to write some flag/bool at a desired EVA Address. From there Dolphin logs can take care of that via a Memory BP log.

The reason why you aren't seeing item values in r31 is because you need to step thru the lwz instruction to see what gets loaded into r31. Whatever is there beforehand may be some previous pointer or junk value.

Regarding the slot stuff, I went and checked Unnamed's code myself, there are zero non-volatile registers that contain the slot.

Basically r27 or r29 may be a "base/master" pointer of sorts. If so, you can use r27 or r29 to do a series of pointer-level loading to get the slot. Stebler does this in the classic version of his pretty speedometer code. Basically various important information can always be grabbed if you have this pointer at your disposal.

Portion of code from Stebler's source:
# get the player index of the player on which the hooked function is working
lwz r3, 0x0 (r29)
lwz r3, 0x0 (r3)
lbz r3, 0x10 (r3)

I do this is my Hop Anywhere code - https://mariokartwii.com/showthread.php?tid=1966
#Get Slot function is hooked on
lwz r12, 0x0 (r29)
lwz r12, 0x0 (r12)
lbz r12, 0x10 (r12)

I'm not sure of the technical/proper name of this pointer or how to tell if this is the pointer in question, But you can try something like this...
lwz r3, 0x0 (r27)
lwz r3, 0x0 (r3)
lbz r3, 0x10 (r3)
or..
lwz r3, 0x0 (r29)
lwz r3, 0x0 (r3)
lbz r3, 0x10 (r3)

Maybe somebody can chime in on a diff/easier way.

By the way, r3 is safe to modify as long as you have the original instruction first in your source.

In conclusion your ASM source will this..
1. Original instruction
2. Check for Star, if item not Star, end code (write 0 flag to EVA)
3. Slot loading code
4. Is slot value 0 thru 3?
5. If yes, write 1 flag to EVA. if not write 0 flag to EVA
Reply


Messages In This Thread
Logging game events to text file - by seanmcnally - 03-02-2024, 09:56 PM
RE: Logging game events to text file - by Vega - 03-04-2024, 01:38 AM
RE: Logging game events to text file - by Vega - 03-04-2024, 09:37 PM
RE: Logging game events to text file - by Vega - 03-07-2024, 01:02 AM
RE: Logging game events to text file - by Vega - 03-08-2024, 12:25 AM
RE: Logging game events to text file - by Vega - 03-08-2024, 06:44 PM
RE: Logging game events to text file - by Vega - 03-12-2024, 09:13 PM
RE: Logging game events to text file - by Vega - 03-13-2024, 11:36 PM
RE: Logging game events to text file - by Vega - 03-14-2024, 06:28 PM
RE: Logging game events to text file - by Vega - 03-16-2024, 02:23 AM
RE: Logging game events to text file - by Vega - 03-16-2024, 04:54 PM
RE: Logging game events to text file - by Vega - 03-16-2024, 11:13 PM
RE: Logging game events to text file - by Vega - 03-18-2024, 05:20 PM

Forum Jump:


Users browsing this thread: 3 Guest(s)