Posted: Thu Jan 28, 2021 10:52 am Post subject: Retrieving a 4 Byte Hex value from the cheat table
Hi! im trying to retrieve the 4byte hex value from the cheat table to compare in Lua, the problem is, at least the way im trying to do it, the hash is "mirrored" so instead of getting, for example, the hash
2BEC3CBE i get BE3CEC2B
The code im using is:
Code:
local addrhash = getAddress"[VehTweaksPtr]-4" --Hash
print(string.format('%02X%02X%02X%02X', readBytes(addrhash, 4)))
if readBytes(addrhash, 4) == 'EEF345EC' then
Any solutions you can point me to?
Thanks in advance!
Multibyte values are stored in little endian: least significant byte first. e.g. the 4-byte value 305420988 (0x12345ABC) is stored as the array of bytes BC 5A 34 12.
If you want to print an integer in base-16 (hexadecimal), use the hexadecimal format specifier:
Code:
print(("%08X"):format(305420988))
To read a 4-byte integer value at an address, use readInteger:
Code:
if readInteger"[VehTweaksPtr]-4" == 0xEEF345EC then
-- ...
end
Edit: BBCode typo _________________
I don't know where I'm going, but I'll figure it out when I get there.
Last edited by ParkourPenguin on Thu Jan 28, 2021 4:41 pm; edited 1 time in total
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