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 do i make a conditional breakpoint for a byte?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
LongBeardedLion
Expert Cheater
Reputation: 0

Joined: 10 Apr 2020
Posts: 174

PostPosted: Tue Jun 16, 2020 11:32 pm    Post subject: How do i make a conditional breakpoint for a byte? Reply with quote

So im trying to set a breakpoint that breaks if the 2nd byte stored in the address in ebp is 03.

So lets say my address in EBP points to a value of 12 03 00 1C.

The 2nd byte is 03 so its true.

I asked this sometime ago and the answer at the time was:

readBytes([EBP+2], 1, false) == 3

But it does not break.

Also i saw that for x64dbg the expression is:

ReadByte,Byte,byte(addr)

But still i could not figure it out.

Pls help.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Wed Jun 17, 2020 12:22 am    Post subject: Reply with quote

readBytes(EBP+2,1)==3
_________________
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
LongBeardedLion
Expert Cheater
Reputation: 0

Joined: 10 Apr 2020
Posts: 174

PostPosted: Wed Jun 17, 2020 2:15 am    Post subject: Reply with quote

Thank you.

So what was that ",false" doing there?

Also what if its not the value inside the address, but the address itself.

For example if ECX == 12304050

And i need it to break if the 4th byte is 50 ^.

But not the byte written as a value inside the address. But the address itself.

Shocked

Does the same apply to ESP?

Wont i need to use brackets ? [] For example:

[ESP+4]

I have an address 10204050 in ESP+4. And this 10204050 yet points to another value that is AA BB CC DD.

How do i make a breakpoint that detects that ESP + 4 has DD in the value inside its address?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4722

PostPosted: Wed Jun 17, 2020 10:09 am    Post subject: This post has 1 review(s) Reply with quote

The third parameter determines if the bytes are returned in a table or just some value(s). Refer to celua.txt for documentation.
LongBeardedLion wrote:
For example if ECX == 12304050

And i need it to break if the 4th byte is 50 ^.
Given that should be 0x12304050, 0x50 would be the first byte and 0x12 would be the fourth byte (see "little endian").
Code:
local byte1 = ecx & 0xff
local byte2 = ecx >> 8 & 0xff
local byte3 = ecx >> 16 & 0xff
local byte4 = ecx >> 24

-- or:
local byte1, byte2, byte3, byte4 = table.unpack(dwordToByteTable(ecx))

LongBeardedLion wrote:
Does the same apply to ESP?
...
How do i make a breakpoint that detects that ESP + 4 has DD in the value inside its address?

Code:
readBytes(readPointer(ESP+4)+3, 1) == 0xdd

_________________
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
LongBeardedLion
Expert Cheater
Reputation: 0

Joined: 10 Apr 2020
Posts: 174

PostPosted: Thu Jun 18, 2020 2:07 am    Post subject: Reply with quote

Thank you so much. I wrote it down.

I had no way before to break the stack values.

Do you know where i can see more info about conditional breakpoints? More examples, and complex problems?

For x64dbg there is almost nothing online. So i will make everything that requires breakpoints on cheat engine.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4722

PostPosted: Thu Jun 18, 2020 10:25 am    Post subject: Reply with quote

Conditional breakpoints are just Lua code. There are a few eccentricities involved (see celua.txt "debugging" section, particularly "debug variables" / "debug_getContext"), but it's mostly CE Lua. Learn Lua first (CE uses Lua 5.3), then learn the stuff CE adds to Lua by reading celua.txt.
_________________
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
LongBeardedLion
Expert Cheater
Reputation: 0

Joined: 10 Apr 2020
Posts: 174

PostPosted: Mon Jun 22, 2020 6:41 am    Post subject: Reply with quote

Thank you ParkourPenguin.

Im trying not to learn lua. Im trying to learn use c++, and practice it with this. So for example injections / calling functions etc i do all in c++.

Dont get me wrong. PErhaps im being ignorant. But i see no purpose in learning lua. I learned a few commands. And it seems a very simple and nice language to work with. But it has no other function. Afaik. I could be wrong. You tell me Smile . I want to learn c++. So all the stuff that is supposed to be done in lua in cheat engine im doing in c++. Injections, calling functions, reading and writting to memory. I know it is harder but it is worthy it in the long run. And c++ is useful for everything as far as i was told.

Perhaps something is escaping me on lua. But from what i have seen its a language that is going a bit with less use as of late. But i can be wrong.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4722

PostPosted: Mon Jun 22, 2020 10:45 am    Post subject: Reply with quote

I don't think you're wrong. The only reason I know Lua is because CE uses it. Other people do use it for stuff like games and other software, but it's uncommon.

I suggested you learn Lua because you asked how conditional breakpoints worked in CE. If you want to write your own debugger in C++, good luck.

_________________
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
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