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 


Value that makes no sense (is it double? float?)

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions
View previous topic :: View next topic  
Author Message
Golokopitenko
Newbie cheater
Reputation: 0

Joined: 29 Jan 2018
Posts: 18

PostPosted: Wed Feb 21, 2018 3:51 pm    Post subject: Value that makes no sense (is it double? float?) Reply with quote

I have found the value for a soldier's speed in the game, but I don't really understand how it works.

If double, when this unit increases its speed by 20% (via in-game upgrade), the value will go from 2.00000047394633 to 2.00000047377944.

If I check the changes in the memory in float, the same address' value changes from 1.223999977 to 1.179200053.

However, the in-game speed display goes from 29 to 36, yet for the love of me I just can't find these values in the memory, at all.

If I check the memory region in byte, 7 values change, in 2 byte 4 addresses change, in 4 byte 2 values, and in 8 byte two values as well.

And the last thing, is that the changes in these values change the in-game speed non-linearly and a smaller value means a higher speed in-game.

I just... it makes no sense Confused
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Wed Feb 21, 2018 4:05 pm    Post subject: Reply with quote

check what code reads/writes to the value. If it uses it as an int, then it's probably an int (add, mov, sub, etc.), if it does it as a double (fadd qword (fpu) / addsd (sse)) then it's a double.

Of course regardless of the datatype the value it represents could be encoded or encrypted, health could be stored as a 4 byte value of 0 to 1000 and shown on screen as 5 hearts that lose a bit of color as you're hurt or before it's used it's divided by 10 or xored by 0xF358AB etc.

_________________
https://github.com/FreeER/ has a few CE related repos


Last edited by FreeER on Wed Feb 21, 2018 4:11 pm; edited 1 time in total
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Wed Feb 21, 2018 4:05 pm    Post subject: Reply with quote

It's a float.

1.1792 = (1.224 - 1) * (1 - 0.2) + 1

_________________
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
Golokopitenko
Newbie cheater
Reputation: 0

Joined: 29 Jan 2018
Posts: 18

PostPosted: Wed Feb 21, 2018 4:24 pm    Post subject: Reply with quote

ParkourPenguin wrote:
It's a float.

1.1792 = (1.224 - 1) * (1 - 0.2) + 1


Interesting. Why does it increment speed when decreasing it and why does it non-linearly? (for example, setting this value to 1 the speed turns into 102 km/h, and 0.5 makes it 26214 km/h, and why can't I find these km/h values in the memory?

Edit:
FreeER wrote:
check what code reads/writes to the value. If it uses it as an int, then it's probably an int (add, mov, sub, etc.), if it does it as a double (fadd qword (fpu) / addsd (sse)) then it's a double.


qword, so it must be double/float?

Quote:

Of course regardless of the datatype the value it represents could be encoded or encrypted, health could be stored as a 4 byte value of 0 to 1000 and shown on screen as 5 hearts that lose a bit of color as you're hurt or before it's used it's divided by 10 or xored by 0xF358AB etc.


How can I find out the way it's encrypted and find a way to modify that makes sense?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Wed Feb 21, 2018 5:36 pm    Post subject: Reply with quote

Actually, it's probably a double- you're just looking at it from the wrong address. If you search for a float and find what's actually a double, it's usually the more significant half of the double, meaning you'd have to adjust the address by -4.

Doing what FreeER said and looking at how the game is accessing the value should give you a good idea of the type of value stored at that address.

Regardless, I don't know why the game is storing it this way. It could be seen as a period (in seconds) between modifying the player's coordinates, but that's just a guess.

If you want to adjust actual speed to this value or vise versa, divide 0.8 by one to get the other. (e.g. 0.8/0.028 = 29, 0.8 / 36 = 0.0224, etc.)

_________________
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
Golokopitenko
Newbie cheater
Reputation: 0

Joined: 29 Jan 2018
Posts: 18

PostPosted: Fri Feb 23, 2018 1:28 pm    Post subject: Reply with quote

ParkourPenguin wrote:
Actually, it's probably a double- you're just looking at it from the wrong address. If you search for a float and find what's actually a double, it's usually the more significant half of the double, meaning you'd have to adjust the address by -4.

Doing what FreeER said and looking at how the game is accessing the value should give you a good idea of the type of value stored at that address.

Regardless, I don't know why the game is storing it this way. It could be seen as a period (in seconds) between modifying the player's coordinates, but that's just a guess.

If you want to adjust actual speed to this value or vise versa, divide 0.8 by one to get the other. (e.g. 0.8/0.028 = 29, 0.8 / 36 = 0.0224, etc.)


I am still utterly clueless and confused Confused

Let's try another value that stores the speed of another unit, it will hopefully tell you all you need to know in order to solve this mystery.


I assume this address has 8 byte values right? I can barely understand, this is so hard for me to explain.

it seems the 8th value does nothing to the unit's speed

the 7th value, if set to 64 or higher, the speed becomes 0. If set to 64 it becomes 1. If set to 63, the speed becomes 52429. If set higher than 63, the speed is so high that it's not even properly displayed.

The rest of values seem to affect the speed in a less impactful way (that is, changing them changes the speed very little or not at all)

The default values are: 0, 0, 224, 77, 98, 144, 63, which result into a speed of 100 in-game. If I decrease the 144 to 143, the speed becomes 104. If I decrease 98 to 1 the speed becomes 102. Changing the other values does not change the speed (or it changes it so little that is not displayed).

This is incredibly confusing to me. Either with float, double or byte, this makes no sense. What is going on here?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Fri Feb 23, 2018 2:45 pm    Post subject: Reply with quote

I don't understand why you're confused. As I said:
ParkourPenguin wrote:
If you want to adjust actual speed to this value or vise versa, divide 0.8 by one to get the other. (e.g. 0.8/0.028 = 29, 0.8 / 36 = 0.0224, etc.)

I don't know of a simpler way to explain this.
  • The value is stored as a double.
  • Its value is 0.8 divided by the value displayed on the screen.

If you don't understand why just changing float to double won't work, it's because those two data types have different sizes. A float takes up 4 bytes of memory while a double takes up 8 bytes of memory. The float you found is actually the second half of that double, so you need to adjust the address by -4 to get the real value.
Code:
// example
// memory viewed as 8 bytes:
06A30810:  79 E9 26 31 08 AC 9C 3F

// memory viewed as 2 floats:
06A30810:  2.43E-9  1.224

// memory viewed as 1 double:
06A30810:  0.028

// you found the float at address 06A30814. You want the double at the address 4 bytes before it.

_________________
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
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Fri Feb 23, 2018 3:11 pm    Post subject: Reply with quote

@Golokopitenko, I'm 100% sure what ParkourPenguin wrote.

regular speed



speed increased by 20%



So it went from 0.028 to 0.0224

0.028 - 20% = 0.0224


That 0.028 can be a delay from one step/unit to another.

You can convert it into frequency/speed:
1 / 0.028 ≈ 35 steps/units per second
1 / 0.0224 ≈ 44 steps/units per second

_________________
Back to top
View user's profile Send private message MSN Messenger
Golokopitenko
Newbie cheater
Reputation: 0

Joined: 29 Jan 2018
Posts: 18

PostPosted: Fri Feb 23, 2018 4:11 pm    Post subject: Reply with quote

First of all thank you for your thorough questions, I think I understand now!

But the problem is, I have no such values. I added the address as double, starting from the first value in byte and changing to double (so I can be sure it picks all the 8 values in the right frame). The value shown is not 0.027, it's 1.75580578191713E-307.
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sat Feb 24, 2018 5:58 am    Post subject: Reply with quote

Try this suggestion.
FreeER wrote:
check what code reads/writes to the value.

but, this time provide us screenshot of address in addresslist (bottom part of CE)
and window which appears when you choose "find out what accesses this address" feature, be sure to highlight one entry and resize that window, resize columns too, so we can see all information.

_________________
Back to top
View user's profile Send private message MSN Messenger
Golokopitenko
Newbie cheater
Reputation: 0

Joined: 29 Jan 2018
Posts: 18

PostPosted: Sat Feb 24, 2018 9:14 am    Post subject: Reply with quote

mgr.inz.Player wrote:
Try this suggestion.
FreeER wrote:
check what code reads/writes to the value.

but, this time provide us screenshot of address in addresslist (bottom part of CE)
and window which appears when you choose "find out what accesses this address" feature, be sure to highlight one entry and resize that window, resize columns too, so we can see all information.


Yes! I fixed it! The problem was that the addresses were indeed poorly added (that is, there was a byte misalignment)

The real problem is that for some reason cheat engine messes with the amount of bytes a double value has to take. Look at this:

[I can't post URLs yet. Imagine the memory viewer with the display mode set to double. There you can see a highlighted value that is 30]

The highlighted value is the unit's health, which is properly displayed as 30, and it's properly aligned because I used Ctrl+B for that address. But the speed, which is very close to the health, is not correctly shown as 0.028:

[Here you see the same region of the memory shown before, but instead, another value is highlighted and shown its numerical value which is 8.34402696940201E-309]

But if I use Ctrl+B in the speed value, it is displayed correctly as 0.028 (0.3 with the rounding).

I found the speed while changing random values near the health value and seeing if it affected the in-game speed, and because I opened the memory viewer from the health value the speed value was misaligned.

So the question is, how do I prevent this? How do I make the memory viewer show all the values properly?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Sat Feb 24, 2018 3:53 pm    Post subject: Reply with quote

turn of fast scan when scanning, in in the memory viewer just use the left/right cursor keys till the alignment is what you like
_________________
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
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions 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