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 


Weird health values

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
dopeness
How do I cheat?
Reputation: 0

Joined: 28 Jun 2021
Posts: 2

PostPosted: Mon Jun 28, 2021 12:55 am    Post subject: Weird health values Reply with quote

Hi, I found my health in a game I'm playing, but it's represented as some weird value.

I found a thread that was similar to my problem:
cheatengineDOTorg/forum/viewtopic.php?t=563878&sid=d3a74afc916ae560323c8051f16811d5

(new acc, i can't post links, so i put DOT in the link, replace with '.')

But my values are a bit different.

Me at 969 health:

4 bytes: 127008768
8 bytes: 12389691845365596160
float: 2.196763843E-34
double: -4.98238486090369E-97

Now, me at 775 health:

4 bytes: 101580800
8 bytes: 12389691845340168192
float: 2.670723165E-35
double: -4.98238483447028E-97


I don't see how I can convert these values to the correct HP I see on the screen. Anyone have any ideas (owner of this site? Very Happy)

Also, is there a discord or something??

Thanks guys, hope someone has some ideas/insight.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4710

PostPosted: Mon Jun 28, 2021 1:34 am    Post subject: Reply with quote

It's the upper half of the 4-byte value bit shifted left once.
Code:
127008768  (dec)
07920000   (hex)
0792       (upper word)
03c9       (shift right)
969        (decimal)

This would be an easy custom type to make even in assembly. (simple integer, 2-byte value, custom behaviour is a bit shift)

_________________
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
dopeness
How do I cheat?
Reputation: 0

Joined: 28 Jun 2021
Posts: 2

PostPosted: Mon Jun 28, 2021 1:53 am    Post subject: Reply with quote

Wow, can you direct me to a link where I can learn more about how you figured that out? IE: what do these keywords mean?

'upper word'
'shift right'


Thanks by the way.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4710

PostPosted: Mon Jun 28, 2021 11:28 am    Post subject: Reply with quote

A 4-byte integer value consists of 4 bytes. These bytes are typically stored with the least significant byte first (aka little endian). e.g.:
Code:
1234        (decimal - base 10)
4D2         (hexadecimal - base 16)
D2 04 00 00 (array of bytes)

A word is a unit of measurement indicating how many bytes some primitive data consists of. Decades ago when 16-bit code was commonplace, the base unit "word" (or "single word") was defined to 2 bytes (16 bits). A doubleword (aka dword) is 4 bytes, quadword (aka qword) 8 bytes, doublequadword (dqword) 16 bytes...

A dword can be broken down into two words: the less significant half is the lower word, and the more significant half is the upper word. i.e.:
Code:
127008768    (decimal - base 10)
07920000     (hexadecimal - base 16)
00 00 92 07  (array of bytes)
92 07        (more significant half)
792          (upper word - base 16)
1938         (upper word - base 10)

A shift is just shifting the bits of some value left or right by a certain amount.
Code:
1938             (word, base 10)
0000011110010010 (base 2)
0000001111001001 (shift right 1)
969              (word, base 10)

Due to how binary works, shifting can be seen as floor division or multiplication by some integer power of 2.

Edit: in hindsight you could also just shift it right 17 times and get the same result (i.e. 127008768 >> 17 == 969). Which way is "correct" depends on how the game accesses that data.

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