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 


compare immediate dword

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

Joined: 25 Jul 2016
Posts: 252

PostPosted: Mon Aug 08, 2016 11:39 pm    Post subject: compare immediate dword Reply with quote

Can any registers be used for this, maybe it's not possible. CE either wants to treat it like a pointer or refuse to compile it.
So just as a hypothetical example:

cmp [edx+8],int(12345678)

Is there any way to do the immediate compare or do I first have to assign the value to a location and use a pointer?
Back to top
View user's profile Send private message
cooleko
Grandmaster Cheater
Reputation: 11

Joined: 04 May 2016
Posts: 717

PostPosted: Tue Aug 09, 2016 1:31 am    Post subject: Reply with quote

Integer:
cmp [edx+8], (int)12345678
cmp [edx+8], #12345678

Float:
cmp [edx+8], (float)12345678

Double:
cmp [edx+6], ebx
jne fail
cmp [edx+10], ebx+4
jne fail
Success:

cmp word ptr [],2 bytes
cmp byte ptr [], byte
Back to top
View user's profile Send private message
sbryzl
Master Cheater
Reputation: 6

Joined: 25 Jul 2016
Posts: 252

PostPosted: Tue Aug 09, 2016 2:33 am    Post subject: Reply with quote

First one gives a cannot compile error.
[img]s10.postimg.org/wv589sva1/cmperror.png[/img]
*edit* I see I typed it wrong to get the error. It will compile but becomes a pointer instead of immediate value.

Second one compiles but shows as a pointer rather than an immediate value.

Float compare actually did work but I'm not using float values.
Back to top
View user's profile Send private message
hhhuut
Grandmaster Cheater
Reputation: 6

Joined: 08 Feb 2015
Posts: 607

PostPosted: Tue Aug 09, 2016 3:11 am    Post subject: Reply with quote

The first one doesn't work because you didn't look closely what cooleko wrote.

In your script, you seem to have written "cmp [edx+8], int(12345678)", as shown in the error message, but you have to write "cmp [edx+8], (int)12345678" instead (like a type-cast in C)!
Back to top
View user's profile Send private message
sbryzl
Master Cheater
Reputation: 6

Joined: 25 Jul 2016
Posts: 252

PostPosted: Tue Aug 09, 2016 11:21 am    Post subject: Reply with quote

I edited right after I posted saying that i noticed I typed it in wrong and after correction it would compile, but an issue still remains.

Both
cmp [edx+8], (int)12345678
cmp [edx+8], #12345678
will not use the number as an immediate value but rather as a pointer.

*edit*
But wait a moment. This looks like a bug in the disassembler display.

[img]s9.postimg.org/q24euad9r/asmdisplay.png[/img]

The disassembler will show the compare to a pointer
cmp [edx+08],daorigins.exe+7C614E
cmp [edx+08],daorigins.exe+7C614E

, but when I click on it, it shows up as an immediate compare and I see now it is using the correct opcode too.
Back to top
View user's profile Send private message
hhhuut
Grandmaster Cheater
Reputation: 6

Joined: 08 Feb 2015
Posts: 607

PostPosted: Tue Aug 09, 2016 11:30 am    Post subject: Reply with quote

No, everything is just as it is supposed to be.

First, the "issue" with CE's disassembler is always that you get displayed some address name (i.e. also with mono names) and when you doubleclick the assembler line to put a new one there, it just shows an absolute value.

Which also leads to the second point: Your compare value is just fine, CE only displays it as a static address, because the "daorigins.exe" happens to be located at some spot in the memory your compare value accidentally matches.

Goto View -> Show module addresses and untick the box and you'll see that your immediate value is there.
Back to top
View user's profile Send private message
sbryzl
Master Cheater
Reputation: 6

Joined: 25 Jul 2016
Posts: 252

PostPosted: Tue Aug 09, 2016 11:44 am    Post subject: Reply with quote

This explains it so it will no longer cause me confusion, thanks.
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