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 


Can we toggle flags in a CE script w/out using instructions?

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

Joined: 27 Apr 2013
Posts: 306

PostPosted: Mon Aug 15, 2016 4:29 pm    Post subject: Can we toggle flags in a CE script w/out using instructions? Reply with quote

In the disassembler, you can right-click on an instruction's address and set a breakpoint to toggle a flag to whatever state you want upon execution of that instruction. Is there a way to mimic this behavior in a CE script?

To note, I consider myself advanced on the topic of using a plethora of instructions (PUSHF/POPF, LAHF/SAHF, CL*, ST*, etc.) to modify flag bits, so this question is purely in the scope of learning if CE has another way of doing it via scripting capabilities. (The question is probably more closely related to if CE can set breakpoints via a script, and if so, how would you do that and specify a flag to set upon execution of that instruction.)

Thanks!

_________________
Back to top
View user's profile Send private message Visit poster's website
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Mon Aug 15, 2016 4:39 pm    Post subject: Reply with quote

Yes, CE can set breakpoint using scripts.

With debug_setBreakpoint you can setup a breakpoint, and a custom function, or use the globally defined callback
Code:

function debugger_onBreakpoint()
--if you handled it, return 1, else return 0
end


in a breakpoint handler for a you then have access to the EFLAGS register (or RFLAGS in 64-bit)

using binary operations you can manipulate it.
https://en.wikipedia.org/wiki/FLAGS_register

e.g to set ZF: EFLAGS=EFLAGS | (1 << 6)

_________________
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
h3x1c
Master Cheater
Reputation: 17

Joined: 27 Apr 2013
Posts: 306

PostPosted: Mon Aug 15, 2016 4:44 pm    Post subject: Reply with quote

Neat. Thanks, DB! Very Happy
_________________
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 -> General Gamehacking 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