UnclePunch
Smash Ace
- Joined
- Nov 9, 2014
- Messages
- 673
Code:
$DPad Down In-Game = Random Puff Bow Color [UnclePunch]
C206CB90 00000016
89D806CB 2C0E0004
4082009C 3BD80060
89DE000C 39E00E90
7DEE79D6 3DC08045
61CE3080 7DCE7A14
89EE0007 2C0F000F
40820074 89EE0044
2C0F0002 40820068
81CE00B0 81CE0168
3DE00002 61EFDBF0
7DCE7A14 3821FFFC
7C0802A6 90010000
386000FF 3DE08038
61EF0580 7DE903A6
4E800421 9861FFFC
386000FF 3DE08038
61EF0580 7DE903A6
4E800421 9861FFFD
A061FFFC B06E0000
80010000 7C0803A6
38210004 4E800020
60000000 00000000
Inject @8006cb90 (end of PlayerThink)
Original Codeline = blr
lbz r14,0x6cb(r24) #get instant inputs
cmpwi r14,0x4 #check if dpad down
bne done
addi r30,r24,0x60
lbz r14,0xc(r30) #get player slot (0-3)
li r15,0xe90 #static player block length
mullw r15,r14,r15 #multiply block length by player number
lis r14,0x8045 #load in static player block base address
ori r14,r14,0x3080 #load in static player block base address
add r14,r14,r15 #add length to base address to get current player's block
lbz r15,0x7(r14) #get player ID
cmpwi r15,0xF #check if puff
bne done
lbz r15,0x44(r14) #get costume ID
cmpwi r15,0x2 #check if bow
bne done
getTextureAddress:
lwz r14,0xb0(r14)
lwz r14,0x168(r14)
lis r15,0x0002
ori r15,r15,0xdbf0
add r14,r14,r15 #get texture address in r14 (thanks Punkline)
randomizeColor:
backup #backup link register
li r3,0xff #set RNG limit
bl r15,0x80380580
stb r3,-0x4(sp) #store first half of RNG number onto stack
li r3,0xff #set RNG limit
bl r15,0x80380580
stb r3,-0x3(sp) #store second half of RNG number onto stack
lhz r3,-0x4(sp) #get the value in r3
sth r3,0x0(r14) #store it back to texture location
restore #restore link register
done:
blr
Original Codeline = blr
lbz r14,0x6cb(r24) #get instant inputs
cmpwi r14,0x4 #check if dpad down
bne done
addi r30,r24,0x60
lbz r14,0xc(r30) #get player slot (0-3)
li r15,0xe90 #static player block length
mullw r15,r14,r15 #multiply block length by player number
lis r14,0x8045 #load in static player block base address
ori r14,r14,0x3080 #load in static player block base address
add r14,r14,r15 #add length to base address to get current player's block
lbz r15,0x7(r14) #get player ID
cmpwi r15,0xF #check if puff
bne done
lbz r15,0x44(r14) #get costume ID
cmpwi r15,0x2 #check if bow
bne done
getTextureAddress:
lwz r14,0xb0(r14)
lwz r14,0x168(r14)
lis r15,0x0002
ori r15,r15,0xdbf0
add r14,r14,r15 #get texture address in r14 (thanks Punkline)
randomizeColor:
backup #backup link register
li r3,0xff #set RNG limit
bl r15,0x80380580
stb r3,-0x4(sp) #store first half of RNG number onto stack
li r3,0xff #set RNG limit
bl r15,0x80380580
stb r3,-0x3(sp) #store second half of RNG number onto stack
lhz r3,-0x4(sp) #get the value in r3
sth r3,0x0(r14) #store it back to texture location
restore #restore link register
done:
blr
Last edited: