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 


How to consolidate script logic with the CMOVcc instruction!

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials
View previous topic :: View next topic  
Author Message
h3x1c
Master Cheater
Reputation: 17

Joined: 27 Apr 2013
Posts: 303

PostPosted: Sun Jul 31, 2016 12:52 pm    Post subject: How to consolidate script logic with the CMOVcc instruction! This post has 1 review(s) Reply with quote



Click above to watch the video!

I was recently hacking a game and noticed a whole bunch of instructions I had never seen before, one of which being CMOVB, which is a conditional move--of which there are many, as detailed here.

These instructions give you the opportunity to directly move values based on the state of flags, so where you might have otherwise branched and written a number of instructions just to move a value, you can avoid that altogether in the right scenario!

In the video above, I outline a case where I immediately found this instruction useful. CMOVcc has its quirks, like only being able to move from a memory address or register to a register (so, no moving immediate values or moving into memory addresses), but I think it's a very handy instruction to be aware of and put to good use. Very Happy

Here's a quick look at the example from the video, for those who only need to see it:

Code:
newcode:
  cmp [rcx+B0],0  //Compare offset to check if enemy or player
  cmove eax,[rcx+A0]  //If equal, move max health into eax
  cmovne eax,[rcx+64]  //If not equal, move 0 into eax (one-hit kill)
  jmp originalcode

originalcode:
  mov [rcx+000000A4],eax  //Original instruction writing to health
  jmp exit

_________________
Back to top
View user's profile Send private message Visit poster's website
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