Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Help? Code doesn't turn back into original

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
vng21092
Grandmaster Cheater
Reputation: 15

Joined: 05 Apr 2013
Posts: 644

PostPosted: Wed Sep 24, 2014 5:17 pm    Post subject: Help? Code doesn't turn back into original Reply with quote

The instructions on the left side is how it normally is, but for some reason when I toggle the code, after turning it on and off the instructions change (the red ones)... why? How can I fix this? The left script is the default, the right script it what I wrote.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25807
Location: The netherlands

PostPosted: Wed Sep 24, 2014 5:30 pm    Post subject: Reply with quote

With the way you alloc memory your jmp is going to take 16 bytes, so restore those as well(right now you only restore 7)

You could also try alloc(newmem_1, 128, metro.exe)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
vng21092
Grandmaster Cheater
Reputation: 15

Joined: 05 Apr 2013
Posts: 644

PostPosted: Wed Sep 24, 2014 5:54 pm    Post subject: Reply with quote

How would I restore those? Also, if you don't mind, can you explain what the third parameter in the alloc statement does, thanks.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25807
Location: The netherlands

PostPosted: Wed Sep 24, 2014 7:08 pm    Post subject: Reply with quote

Actually, it's just 14 bytes

You save and restore them like you always do when a jmp instruction is going to overwrite more than one instruction
E.g the originalcode needs to contain 4 instructions, and the return needs some padding for extra nops, or hardcode the return

Or you can just use the 3th parameter of alloc.
The third parameter specifies the general region the allocated memory will go.
By specifying that it should be nearby where metro.exe is located you can make sure that the distance is less then 2GB, and thus no "stupidly long jmp"(14 byte) instruction will be used, but instead the "long jmp" (5 bytes)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
vng21092
Grandmaster Cheater
Reputation: 15

Joined: 05 Apr 2013
Posts: 644

PostPosted: Wed Sep 24, 2014 7:29 pm    Post subject: Reply with quote

well I added the metro.exe as a third parameter and that worked out well. Still not so clear on the whole padding for nops thing, gotta read up on that. but nonetheless, thanks.
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Thu Sep 25, 2014 7:08 am    Post subject: Reply with quote

You can always try other built-in templates:

- "AOB Injection"
- "Full Injection"


The first one will produce AA script with unique signature (array of byte). Unique at that runtime. It means that autogenerated script could work with newer versions of game. More advanced users adjust signature a little more - longer signature with wildcards on appropriate places.
Note: symbol name must be simple word without spaces and other weird characters, just use English chars a-zA-Z.



The second will work only for that one version. It won't work in newer game version (if module has changed, EXE or DLL).

_________________
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites