Inject into 0x8006AD28
(yes it gets run multiple times, but that's not the point here)
start:
subi r1,r1,4
stw r3,0(r1)
goto_main:
bl main
cleanup:
lwz r3,0(r1)
addi r1,r1,4
b exit
set_tag_p1:
stwu 1,-48(1)
stw 31,44(1)
mr 31,1
stw 3,24(31)
stw 4,28(31)
lwz 9,28(31)
cmpwi 7,9,4
ble 7,.L2
li 9,4
stw 9,28(31)
.L2:
lwz 9,28(31)
cmpwi 7,9,0
bgt 7,.L3
li 9,1
stw 9,28(31)
.L3:
lis 9,0x80bd
ori 9,9,23904
stw 9,12(31)
li 9,0
stw 9,8(31)
b .L4
.L7:
lwz 9,8(31)
lwz 10,24(31)
add 9,10,9
lbz 9,0(9)
rlwinm 10,9,0,0xff
lwz 9,12(31)
stb 10,0(9)
lwz 9,28(31)
addi 10,9,-1
lwz 9,8(31)
cmpw 7,10,9
beq 7,.L5
lwz 9,12(31)
addi 9,9,1
li 10,11
stb 10,0(9)
lwz 9,12(31)
addi 9,9,2
li 10,32
stb 10,0(9)
b .L6
.L5:
lwz 9,12(31)
addi 9,9,1
li 10,15
stb 10,0(9)
lwz 9,12(31)
addi 9,9,2
li 10,13
stb 10,0(9)
.L6:
lwz 9,12(31)
addi 9,9,3
stw 9,12(31)
lwz 9,8(31)
addi 9,9,1
stw 9,8(31)
.L4:
lwz 10,8(31)
lwz 9,28(31)
cmpw 7,10,9
blt 7,.L7
addi 11,31,48
lwz 31,-4(11)
mr 1,11
blr
stale_move_index:
stwu 1,-48(1)
stw 31,44(1)
mr 31,1
stw 3,24(31)
lis 9,0x8045
ori 9,9,12604
stw 9,8(31)
lwz 9,24(31)
mulli 9,9,3728
srwi 9,9,2
stw 9,12(31)
lwz 9,12(31)
slwi 9,9,2
lwz 10,8(31)
add 9,10,9
lwz 9,0(9)
mr 3,9
addi 11,31,48
lwz 31,-4(11)
mr 1,11
blr
main:
stwu 1,-48(1)
mflr 0
stw 0,52(1)
stw 31,44(1)
mr 31,1
lis 9,0x8016
ori 9,9,46424
stw 9,12(31)
lwz 9,12(31)
mtctr 9
bctrl
mr 9,3
stw 9,16(31)
li 9,0
stw 9,8(31)
b .L11
.L12:
lwz 3,8(31)
bl stale_move_index
stw 3,20(31)
lwz 9,20(31)
stb 9,24(31)
addi 10,31,28
lwz 9,8(31)
add 9,10,9
lbz 10,24(31)
stb 10,0(9)
lwz 9,8(31)
addi 9,9,1
stw 9,8(31)
.L11:
lwz 10,8(31)
lwz 9,16(31)
cmpw 7,10,9
blt 7,.L12
addi 9,31,28
mr 3,9
lwz 4,16(31)
bl set_tag_p1
li 9,0
mr 3,9
addi 11,31,48
lwz 0,4(11)
mtlr 0
lwz 31,-4(11)
mr 1,11
blr
exit:
replaced:
mr r30, r3