#1 02-02-2018 17:22

Nahuel3d
Registered: 28-12-2016
Posts: 2

HEX Addition not working as expected?

Hello
So i'm trying to get a memory address in a CLEO script using this code:

0A8D: 16@ = read_memory 0xB7CD9C size 4 virtual_protect 0
16@ += 298

The first line reads the pointer and then the second line adds the offset (298)
But i'm getting the wrong result, for example, if the pointer has the value 19AD26D8 when i add 298 in the CLEO script i get 19AD2802, this is wrong, while in Cheat Engine and other HEX converters i get 19AD2970, which is the result i want to get
What's going on?

Last edited by Nahuel3d (02-02-2018 17:37)

Offline

#2 10-02-2018 09:45

Seemann
Registered: 07-08-2006
Posts: 2,050

Re: HEX Addition not working as expected?

298 is a decimal number and 19AD26D8 is a hexadimal one (430778072). 430778072+298=430778370=19AD2802
If you want to get a desired result you have to add a value of 0x298.

Offline

#3 10-02-2018 14:27

Nahuel3d
Registered: 28-12-2016
Posts: 2

Re: HEX Addition not working as expected?

Seemann wrote:

298 is a decimal number and 19AD26D8 is a hexadimal one (430778072). 430778072+298=430778370=19AD2802
If you want to get a desired result you have to add a value of 0x298.

Oh  wall
It works, thank you!

Offline

Board footer

Powered by FluxBB