03-16-2024, 06:00 AM
And now, just for fun, the conditional version!
C278894C 00000006
83E3008C 3D808000
39600001 2C1F0009
4082001C 807B0000
80630000 88630010
2C030000 41810008
996C165F 00000000
Source:
# NOTE this is meant for four player mode, edit the second cmpwi if in another mode
# Insertion Address: 8078894C
lwz r31, 0x008C (r3) # Default instruction, loads item to r31
lis r12, 0x8000 #Set the upper 16 bits of the EVA
li r11, 1 # Get our value ready in case a human uses a star
# Find out if a star was used
cmpwi r31, 9
bne end_code # If not, skip to the end
# Load the slot of player that just used an item
lwz r3, 0x0 (r27) # Slot loading code start, load mem address from r27 into r3
lwz r3, 0x0 (r3) # Load new word from a memory address based on the word we just loaded
lbz r3, 0x10 (r3) # Load new byte from a memory address based on the word we just loaded
cmpwi r3, 3 # EDIT SECOND NUMBER IF IN ANOTHER MODE, use 2 for 3 player, 1 for 2 player, 0 for 1 player.
bgt end_code # If the value in r3 is greater than 3, a non-human player used the star, cancel
stb r11, 0x165F (r12) #Store a 1 to the EVA at address 8000165F
end_code:
C278894C 00000006
83E3008C 3D808000
39600001 2C1F0009
4082001C 807B0000
80630000 88630010
2C030000 41810008
996C165F 00000000
Source:
# NOTE this is meant for four player mode, edit the second cmpwi if in another mode
# Insertion Address: 8078894C
lwz r31, 0x008C (r3) # Default instruction, loads item to r31
lis r12, 0x8000 #Set the upper 16 bits of the EVA
li r11, 1 # Get our value ready in case a human uses a star
# Find out if a star was used
cmpwi r31, 9
bne end_code # If not, skip to the end
# Load the slot of player that just used an item
lwz r3, 0x0 (r27) # Slot loading code start, load mem address from r27 into r3
lwz r3, 0x0 (r3) # Load new word from a memory address based on the word we just loaded
lbz r3, 0x10 (r3) # Load new byte from a memory address based on the word we just loaded
cmpwi r3, 3 # EDIT SECOND NUMBER IF IN ANOTHER MODE, use 2 for 3 player, 1 for 2 player, 0 for 1 player.
bgt end_code # If the value in r3 is greater than 3, a non-human player used the star, cancel
stb r11, 0x165F (r12) #Store a 1 to the EVA at address 8000165F
end_code: