Today I'll will teach you how to make your own hooks.
Example:
- - - - - - - - - - - - - - - - - - - -
addiu sp, sp, $fff0 // decrease the stack pointer by 10
sw ra, $0000(sp) // store ra to stack pointer
nop // hook 0
nop // delay slot
nop // hook 1
nop // delay slot
nop // hook 2
nop // delay slot
nop // hook 3
nop // delay slot
nop // hook 4
nop // delay slot
nop // hook 5
nop // delay slot
nop // hook 6
nop // delay slot
nop // hook 7
nop // delay slot
nop // hook 8
nop // delay slot
nop // hook 9
nop // delay slot
lw ra, $0000(sp) // load ra to stack pointer for the next area
jr ra // jump to ra
addiu sp, sp, $0010 // increase the stack pointer by 10 becomes normal again for the next area
Note: delay slots of Jal command can be use on the area where it will jump.
- - - - - - - - - - - - - - - - - - - -
#Create Hooks (Enable)
#Brian-1337-
0x00000098 0x0A200300
0x00000C00 0x27BDFFF0
0x00000C04 0xAFBF0000
0x00000C58 0x8FBF0000
0x00000C5c 0x03E00008
0x00000C60 0x27BD0010
#Hook 0
0x00000C08 0x0E200000
#Hook 1
0x00000C10 0x0E200000
#Hook 2
0x00000C18 0x0E200000
#Hook 3
0x00000C20 0x0E200000
#Hook 4
0x00000C28 0x0E200000
#Hook 5
0x00000C30 0x0E200000
#Hook 6
0x00000C38 0x0E200000
#Hook 7
0x00000C40 0x0E200000
#Hook 8
0x00000C48 0x0E200000
#Hook 9
0x00000C50 0x0E200000
- - - - - - - - - - - - - - - - - - - -
Instead using "0x0AXXXXXX = J Command" we will use "0x0EXXXXXX = Jal Command".
- - - - - - - - - - - - - - - - - - - -
Example:
lui t0, $0880
addiu t0, t0, $3ffc
sw t0, $0000(t0)
jr ra
nop
- - - - -
#Code 0
;Brian-1337-
0x00000C08 0x0E200400 ;Hook 0
0x00001000 0x3C080880
0x00001004 0x25083ffc
0x00001008 0xad080000
0x0000100c 0x03e00008
0x00001010 0x00000000
- - - - - - - - - - - - - - - - - - - -
Done! :D
Example:
- - - - - - - - - - - - - - - - - - - -
addiu sp, sp, $fff0 // decrease the stack pointer by 10
sw ra, $0000(sp) // store ra to stack pointer
nop // hook 0
nop // delay slot
nop // hook 1
nop // delay slot
nop // hook 2
nop // delay slot
nop // hook 3
nop // delay slot
nop // hook 4
nop // delay slot
nop // hook 5
nop // delay slot
nop // hook 6
nop // delay slot
nop // hook 7
nop // delay slot
nop // hook 8
nop // delay slot
nop // hook 9
nop // delay slot
lw ra, $0000(sp) // load ra to stack pointer for the next area
jr ra // jump to ra
addiu sp, sp, $0010 // increase the stack pointer by 10 becomes normal again for the next area
Note: delay slots of Jal command can be use on the area where it will jump.
- - - - - - - - - - - - - - - - - - - -
#Create Hooks (Enable)
#Brian-1337-
0x00000098 0x0A200300
0x00000C00 0x27BDFFF0
0x00000C04 0xAFBF0000
0x00000C58 0x8FBF0000
0x00000C5c 0x03E00008
0x00000C60 0x27BD0010
#Hook 0
0x00000C08 0x0E200000
#Hook 1
0x00000C10 0x0E200000
#Hook 2
0x00000C18 0x0E200000
#Hook 3
0x00000C20 0x0E200000
#Hook 4
0x00000C28 0x0E200000
#Hook 5
0x00000C30 0x0E200000
#Hook 6
0x00000C38 0x0E200000
#Hook 7
0x00000C40 0x0E200000
#Hook 8
0x00000C48 0x0E200000
#Hook 9
0x00000C50 0x0E200000
- - - - - - - - - - - - - - - - - - - -
Instead using "0x0AXXXXXX = J Command" we will use "0x0EXXXXXX = Jal Command".
- - - - - - - - - - - - - - - - - - - -
Example:
lui t0, $0880
addiu t0, t0, $3ffc
sw t0, $0000(t0)
jr ra
nop
- - - - -
#Code 0
;Brian-1337-
0x00000C08 0x0E200400 ;Hook 0
0x00001000 0x3C080880
0x00001004 0x25083ffc
0x00001008 0xad080000
0x0000100c 0x03e00008
0x00001010 0x00000000
- - - - - - - - - - - - - - - - - - - -
Done! :D