Logging game events to text file
#22
Good work. You will need some code to be included that will reset the flag (to 0) if the conditions are NOT met.

Code:
#Default instruction, load item value
lwz r31, 0x008C (r3)

#Set EVA Upper
lis r12, 0x8000

#Check for Star
cmpwi r31, 9
bne+ reset_flag

#Load Slot code is hooked on
lwz r3, 0x0 (r27)
lwz r3, 0x0 (r3)
lbz r3, 0x10 (r3)

#Check if slot is P1 thru P4 (0 thru 3)
cmplwi r3, 3
bgt+ reset_flag

#All conditions met, set flag
li r11, 1
b write_flag_value

#Reset flag
reset_flag:
li r11, 0

#Write Flag Value
write_flag_value:
stb r11, 0x165F (r12)

Some notes:
  • The bne has a plus appended because it's more likely the item will NOT be a star
  • The bgt has a plus appended because it's more likely the loaded slot value will be higher than 3
  • The comparison for the slot value is done logically because slot values are never negative values. And whenever you are doing a comparison with a later bge/bgt/ble/blt branch, you should choose a logical comparison unless you know negative numbers are possible.
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: 5 Guest(s)