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 


Cheat Engine Forum Index
PostGo back to topic
h3x1c
Master Cheater
Reputation: 17
Joined: 27 Apr 2013
Posts: 306

PostPosted: Sun Jul 31, 2016 12:52 pm    Post subject: How to consolidate script logic with the CMOVcc instruction!



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

_________________
Cheat Engine Tutorial Series
Terraria: Funny, Unique, and Weird Cheats!
Let's Hack: 1001 Spikes (Cheats + Tutorial)
Let's Hack: Starbound (Cheats + Tutorial)
Back to top
View user's profile Send private message Visit poster's website
Post reviews:   Approve 1
Author Review
akumakuja28
Review: Approve
Post reference:
ReviewPosted: Thu Mar 16, 2017 3:16 pm

Thank you.
Back to top
View user's profile Send private message
Display:  
Cheat Engine Forum Index


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites