How to merge two scripts in one? (Code Injection)

Anything Cheat Engine related, bugs, suggestions, helping others, etc..
Post Reply
marek1957
Expert Cheater
Expert Cheater
Posts: 283
Joined: Sat Dec 16, 2017 4:46 pm
Reputation: 4

How to merge two scripts in one? (Code Injection)

Post by marek1957 » Thu Dec 28, 2017 10:25 pm

Hello Again!
I made a two scripts which I must activated two of them in one moment to get to work in game. I don't know how to merge these two scripts - I tried to rename some functions like: newmem, originalcode, exit... etc. to newmem2, originalcode2... etc. but when I activate my merged script, the game is crashed - but when I activate one script and then another, all it is working perfectly.

How to merge two scripts correctly (code injection scripts) ?? Or maybe there is an easier method to do that, for example maybe with aob injection??

If you have tutorials about that, I will be very happy if someone can share this :-)

My scripts:

First Script:

Code: Select all

[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)

newmem: //this is allocated memory, you have read,write,execute access
//place your code here

originalcode:
mov [eax],edx
je Asphalt8.exe+11BA46
add eax,28

exit:
jmp returnhere

"Asphalt8.exe"+11BA33:
jmp newmem
nop
nop
returnhere:


 
 
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
"Asphalt8.exe"+11BA33:
cmp [eax],edx
je Asphalt8.exe+11BA46
add eax,28
//Alt: db 39 10 74 0F 83 C0 28
Second Script:

Code: Select all

[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)

newmem: //this is allocated memory, you have read,write,execute access
//place your code here

originalcode:
mov [ecx],eax
je Asphalt8.exe+3A05EC

exit:
jmp returnhere

"Asphalt8.exe"+3A0542:
jmp newmem
nop
nop
nop
returnhere:


 
 
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
"Asphalt8.exe"+3A0542:
cmp [ecx],eax
je Asphalt8.exe+3A05EC
//Alt: db 39 01 0F 84 A2 00 00 00
My merged script (crashing the game):

Code: Select all

[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)

newmem: //this is allocated memory, you have read,write,execute access
//place your code here

originalcode:
mov [eax],edx
je Asphalt8.exe+11BA46
add eax,28

exit:
jmp returnhere

"Asphalt8.exe"+11BA33:
jmp newmem
nop
nop
returnhere:


alloc(newmem2,2048)
label(returnhere2)
label(originalcode2)
label(exit2)

newmem2: //this is allocated memory, you have read,write,execute access
//place your code here

originalcode2:
mov [ecx],eax
je Asphalt8.exe+3A05EC

exit2:
jmp returnhere

"Asphalt8.exe"+3A0542:
jmp newmem
nop
nop
nop
returnhere2:




[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
"Asphalt8.exe"+11BA33:
cmp [eax],edx
je Asphalt8.exe+11BA46
add eax,28

dealloc(newmem2)
"Asphalt8.exe"+3A0542:
cmp [ecx],eax
je Asphalt8.exe+3A05EC
//Alt: db 39 10 74 0F 83 C0 28

User avatar
TheyCallMeTim13
Administration
Administration
Posts: 984
Joined: Fri Mar 03, 2017 12:31 am
Reputation: 154
Contact:

Re: How to merge two scripts in one? (Code Injection)

Post by TheyCallMeTim13 » Thu Dec 28, 2017 10:37 pm

Code: Select all

[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)

newmem: //this is allocated memory, you have read,write,execute access
//place your code here

originalcode:
mov [eax],edx
je Asphalt8.exe+11BA46
add eax,28

exit:
jmp returnhere

"Asphalt8.exe"+11BA33:
jmp newmem
nop
nop
returnhere:


alloc(newmem2,2048)
label(returnhere2)
label(originalcode2)
label(exit2)

newmem2: //this is allocated memory, you have read,write,execute access
//place your code here

originalcode2:
mov [ecx],eax
je Asphalt8.exe+3A05EC

exit2:
jmp returnhere

"Asphalt8.exe"+3A0542:
jmp newmem  //<<<<<<<<<<<<<<<< Looks like it should be "newmem2"
nop
nop
nop
returnhere2:




[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
"Asphalt8.exe"+11BA33:
cmp [eax],edx
je Asphalt8.exe+11BA46
add eax,28

dealloc(newmem2)
"Asphalt8.exe"+3A0542:
cmp [ecx],eax
je Asphalt8.exe+3A05EC
//Alt: db 39 10 74 0F 83 C0 28
Line 42

Code: Select all

jmp newmem
Looks like it should be:

Code: Select all

jmp newmem2
EDIT:

use "dealloc" after writing back the bytes in the disable section, so you don't deallocate the memory with a thread that has already jumped to that memory region.

marek1957
Expert Cheater
Expert Cheater
Posts: 283
Joined: Sat Dec 16, 2017 4:46 pm
Reputation: 4

Re: How to merge two scripts in one? (Code Injection)

Post by marek1957 » Thu Dec 28, 2017 11:16 pm

Ahhhh thank you so much! God bless you :-)

Post Reply

Who is online

Users browsing this forum: No registered users