How Do I Merge Code In Cheat Engine

Anything Cheat Engine related, bugs, suggestions, helping others, etc..
Post Reply
nativedavid33
What is cheating?
What is cheating?
Posts: 2
Joined: Thu Oct 12, 2017 11:24 am
Reputation: 0

How Do I Merge Code In Cheat Engine

Post by nativedavid33 »

So I saw a few topics on how I could merge code in Cheat Engine. I tried what it told me, yet it only causes a crash. The first script does what I need it to do with no issues, but the second script I attempted to merge it with, causes the game to crash. Any idea what it could be? I feel like it is obscenely obvious and I'm just stupid

Code: Select all

[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat

 
 
aobscanmodule(INJECT,eurotrucks2.exe,89 43 30 EB 69) // should be unique
alloc(newmem,$1000,"eurotrucks2.exe"+5ACEC6)

label(code)
label(return)

newmem:

code:
  nop
  jmp eurotrucks2.exe+5ACF34
  jmp return

INJECT:
  jmp newmem
return:
registersymbol(INJECT)

aobscanmodule(INJECT2,eurotrucks2.exe,F3 0F 11 41 30 C3 CC) // should be unique
alloc(newmem,$1000,"eurotrucks2.exe"+5EE81B)

label(code2)
label(return2)

newmem2:

code2:
  nop
  jmp return2

INJECT2:
  jmp newmem2
return2:
registersymbol(INJECT2)

[DISABLE]
//code from here till the end of the code will be used to disable the cheat
INJECT:
  db 89 43 30 EB 69

unregistersymbol(INJECT)
dealloc(newmem)

INJECT2:
  db F3 0F 11 41 30 C3 CC

unregistersymbol(INJECT2)
dealloc(newmem2)

User avatar
seikur0
Code Alchemist
Code Alchemist
Posts: 440
Joined: Sat Aug 26, 2017 10:48 am
Reputation: 339

Re: How Do I Merge Code In Cheat Engine

Post by seikur0 »

You never allocate newmem2, that is one issue here...

There's more though, first of all you're just nopping stuff, you don't need memory for that.

Then in the first injection the "jump below"-code will change and lead to a crash, that's the reasons why you use aob in the first place :P If you wanted to put the jmp in there, use "db EB 69", also the "jmp return" below would be obsolete then.

In the second injection you have a "ret" in the code, that is replaced by the injection, which will also lead to a crash :D

So in total you have a crash issue for each of the individual scripts and also an issue for both of them together.


Try this:

Code: Select all

[ENABLE]
aobscanmodule(INJECT,eurotrucks2.exe,89 43 30 EB 69) // should be unique
aobscanmodule(INJECT2,eurotrucks2.exe,F3 0F 11 41 30 C3 CC) // should be unique


INJECT:
  db 90 90 90
registersymbol(INJECT)

INJECT2:
  db 90 90 90 90 90
registersymbol(INJECT2)

[DISABLE]
INJECT:
  db 89 43 30

unregistersymbol(INJECT)

INJECT2:
  db F3 0F 11 41 30

unregistersymbol(INJECT2)

nativedavid33
What is cheating?
What is cheating?
Posts: 2
Joined: Thu Oct 12, 2017 11:24 am
Reputation: 0

Re: How Do I Merge Code In Cheat Engine

Post by nativedavid33 »

seikur0 wrote:
Thu Oct 12, 2017 10:41 pm
You never allocate newmem2, that is one issue here...

There's more though, first of all you're just nopping stuff, you don't need memory for that.

Then in the first injection the "jump below"-code will change and lead to a crash, that's the reasons why you use aob in the first place :P If you wanted to put the jmp in there, use "db EB 69", also the "jmp return" below would be obsolete then.

In the second injection you have a "ret" in the code, that is replaced by the injection, which will also lead to a crash :D

So in total you have a crash issue for each of the individual scripts and also an issue for both of them together.


Try this:

Code: Select all

[ENABLE]
aobscanmodule(INJECT,eurotrucks2.exe,89 43 30 EB 69) // should be unique
aobscanmodule(INJECT2,eurotrucks2.exe,F3 0F 11 41 30 C3 CC) // should be unique


INJECT:
  db 90 90 90
registersymbol(INJECT)

INJECT2:
  db 90 90 90 90 90
registersymbol(INJECT2)

[DISABLE]
INJECT:
  db 89 43 30

unregistersymbol(INJECT)

INJECT2:
  db F3 0F 11 41 30

unregistersymbol(INJECT2)
I'll definitely do this, thank you! The code seemed to work before the merge, but the other info is definitely helpful! Thank you!

Post Reply

Who is online

Users browsing this forum: No registered users