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 


Hotkey for code list

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials
View previous topic :: View next topic  
Author Message
Wronschien
How do I cheat?
Reputation: 0

Joined: 30 Nov 2015
Posts: 8

PostPosted: Thu Dec 17, 2015 8:02 am    Post subject: Hotkey for code list Reply with quote

Hello, I'm new to Cheat Engine and there's a small trainer I'd like to make for Ethan Meteor Hunter.
After following the tutorial I was able to find the value to freeze in the game via a code replaced with 'nop' because the address changes each time.
This works very well but I'd like to add a keyboard shortcut to perform the code replacement. I can't see any way to do that in the code list, and there's nothing in the cheat table to allow for a hotkey to be created.

How could I do ?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4291

PostPosted: Thu Dec 17, 2015 10:26 am    Post subject: Reply with quote

If you're just NOPing an instruction, then you can make a script that'll do it for you. Then, assign the script to your cheat table, right click on it, and select "Set Hotkeys". CE will explain what to do from there.

Making a script to just NOP an instruction is relatively easy. Go to Memory View -> Tools -> Auto Assemble, then Template -> Cheat Table framework code. If the address of the instruction is inside a module (anything of the form asdf.exe+X, where X is some offset), then you can just type it out like that using this:
Code:
// instruction is:
// asdf.exe+777 - 89 5C 24 18 - mov [esp+18],ebx
[ENABLE]
asdf.exe+777:
  nop
  nop
  nop
  nop
  // nop 4 times because the instruction is 4 bytes long
  // alt: db 90 90 90 90
[DISABLE]
asdf.exe+777:
  mov [esp+18],ebx
  // replace with original bytes on disable
  // alt: db 89 5C 24 18


If that instruction isn't inside a module, then it's being dynamically allocated, meaning the code won't be in the same position if you restart the process. In that case, you'll need to do an AoB scan to get the address:
Code:
// instruction is:
// 01931142 - 89 5C 24 18           - mov [esp+18],ebx   <--the one we want to NOP
// 0193113F - 8B 7E 1C              - mov edi,[esi+1C]
// 01931149 - 89 7C 24 20           - mov [esp+20],edi

[ENABLE]
// scans for this AoB, stores address of first byte into addyOfInstruction
aobscan(addyOfInstruction,89 5C 24 18 8B 7E 1C 89 7C 24 20) // must be unique
registersymbol(addyOfInstruction)

addyOfInstruction:
  nop
  nop
  nop
  nop

[DISABLE]
addyOfInstruction:
  db 89 5C 24 18

unregistersymbol(addyOfInstruction)

Note that the signature for the AoB scan must be unique. To check that, set the "writable" and "executable" checkboxes to grey in the main CE window, and scan for that AoB. If only one result comes up, you're good. If more than one comes up, get more bytes in your AoB signature.

This topic has more information on creating scripts:
http://forum.cheatengine.org/viewtopic.php?t=570083

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Wronschien
How do I cheat?
Reputation: 0

Joined: 30 Nov 2015
Posts: 8

PostPosted: Thu Dec 17, 2015 1:30 pm    Post subject: Reply with quote

This works !
thank you
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials 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