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 find boolean values?

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

Joined: 17 Sep 2013
Posts: 273
Location: Israel!

PostPosted: Fri Jun 13, 2014 1:51 pm    Post subject: How to find boolean values? Reply with quote

The question in the subject, nothing to explain.
Just tried inputing 1's, 0's in different value types, but with no scceed. Sad
Back to top
View user's profile Send private message
cashd
Cheater
Reputation: 0

Joined: 25 Nov 2012
Posts: 25

PostPosted: Fri Jun 13, 2014 3:31 pm    Post subject: Reply with quote

I think I got an idea what you can do if you want search for boolean types
try search in ollydbg (or cheat engine)
those AoB's
80 3D ? ? ? ? 01 (in assembly the opcodes are, cmp byte ptr [unkByte],1)
or
80 3D ? ? ? ? 00
and bp(break point) on all of them
Back to top
View user's profile Send private message
Rissorr
Master Cheater
Reputation: 3

Joined: 17 Sep 2013
Posts: 273
Location: Israel!

PostPosted: Fri Jun 13, 2014 3:44 pm    Post subject: Reply with quote

what it would give me? O.o how the "cmp byte ptr [unkByte],1" will help me to find the bool?

EDIT:
Ok so i tried it but thats not exactly helps me... Sad
Its the same if i will search for byte value type the 1 or the 0


Last edited by Rissorr on Fri Jun 13, 2014 3:48 pm; edited 1 time in total
Back to top
View user's profile Send private message
cashd
Cheater
Reputation: 0

Joined: 25 Nov 2012
Posts: 25

PostPosted: Fri Jun 13, 2014 3:47 pm    Post subject: Reply with quote

it would give you all the places on the code
where it compare (any boolean type) in order to check true or false
so you will find your value at the end.
Back to top
View user's profile Send private message
Gniarf
Grandmaster Cheater Supreme
Reputation: 43

Joined: 12 Mar 2012
Posts: 1285

PostPosted: Sun Jun 15, 2014 10:32 am    Post subject: Reply with quote

@mixmax35: Programs compiled with visual studio 5 (released in 1997) or later or gcc use 1 byte integers to store booleans, earlier VS versions used 4 byte integers. Of course some developpers might enforce using 32bits to store a boolean, but in any both cases you should be able to find your boolean by scanning for 1/0 using the "byte" datatype.

Note that some developers pack 32 booleans on a 32bit integer and use them that way (in C++):
Code:
#define MYPROPERTY1 0x1
#define MYPROPERTY2 0x2
#define MYPROPERTY3 0x4
#define MYPROPERTY4 0x8
#define MYPROPERTY5 0x10

int Flags=0; //initialization
Flags=Flags | MYPROPERTY4; //set MYPROPERTY4 to true
Flags=Flags & ~(MYPROPERTY4); //set MYPROPERTY4 to false
if (Flags & MYPROPERTY5) //test if MYPROPERTY5 is true, in asm it would be "test RegisterThatContainsFlags,0x10"
In that case you should use CE's binary datatype to find your bool:
tip: CE especially dislikes scanning for 0 as binary, so you'd better wait until your bool is true and scan for 1.

_________________
DO NOT PM me if you want help on making/fixing/using a hack.


Last edited by Gniarf on Mon Jun 16, 2014 12:19 pm; edited 1 time in total
Back to top
View user's profile Send private message
Redouane
Master Cheater
Reputation: 3

Joined: 05 Sep 2013
Posts: 363
Location: Algeria

PostPosted: Sun Jun 15, 2014 12:51 pm    Post subject: Reply with quote

Gniarf wrote:
@mixmax35: Programs compiled with visual studio 5 (released in 1997) or later or gcc use 1 byte integers to store booleans, earlier VS versions used 4 byte integers. Of course some developpers might enforce using 32bits to store a boolean, but in any both cases you should be able to find your boolean by scanning for 1/0 using the "byte" datatype.

Note that some developers pack 32 booleans on a 32bit integer and use them that way (in C++):
Code:
#define MYPROPERTY1 0x1
#define MYPROPERTY2 0x2
#define MYPROPERTY3 0x4
#define MYPROPERTY4 0x8
#define MYPROPERTY5 0x10

int Flags=0; //initialization
Flags=Flags | MYPROPERTY4; //set MYPROPERTY4 to true
Flags=Flags & ~(MYPROPERTY4); //set MYPROPERTY4 to false
if (Flags & MYPROPERTY5) //test if MYPROPERTY5 is true, in asm it would be "test RegisterThatContainsFlags,0x10"
In that case you should use CE's binary datatype to find your bool:
tip: CE especially dislikes canning for 0 as binary, so you'd better wait until your bool is true and scan for 1.


If you did not find any result by scanning for 0 when false and 1 when true,then try scanning for 0 when false and bigger than 0 when true,In a game I have played some time ago (Brave Dwarves 2),I was looking for the boolean that affects the shops (sometimes they open and sometimes they close),to make them always open,I found that the value is not really a boolean,when the shop opens,it goes very fast from 0 to 7 (increased by 1 each time),if I freeze the value at 4 for example,the shop's door will be half opened (that is,in the open and close animation,it gets incremented/decremented till it gets to 7 or 0),the address I found was not even static,I used code injection to make the shops always opened (the fun part is that I found that it gets the system time by calling WINMM.TimeGetTime).
That depends on the value that you are looking for.

If you're looking for a boolean like 'has_Shotgun' or 'Game_complete' then this will not work.

Else,try the binary method (the one Gniarf told you about).
Back to top
View user's profile Send private message
Rissorr
Master Cheater
Reputation: 3

Joined: 17 Sep 2013
Posts: 273
Location: Israel!

PostPosted: Mon Jun 16, 2014 6:40 am    Post subject: Reply with quote

Thanks to everyone Very Happy vary helpful!
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