|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
godsblight Grandmaster Cheater Reputation: 0
Joined: 02 Jul 2007 Posts: 805
|
Posted: Sun Dec 20, 2020 9:48 am Post subject: Reading AA Registered Symbols in Lua |
|
|
I looked around and read some stuff and everything I can think of me doing is correct, so at this point I'm stumped.
Situation: I have a registered symbol in AA called ConsumablesBase along with an allocation of the same name. The symbol's value is an address, so ConsumablesBase is essentially a pointer. I am attempting to read that pointer or extract the value and then get the value of that address with offset 10F. My issue is that Lua is returning completely wrong addresses and values.
Lua is returning these values (I tried with different formatting just incase):
ConsumeablesBase Address formatted with string format: 7ff652670016
ConsumeablesBase Address formatted with DEC_HEX function: 7FF652670016
ConsumeablesBase Address not formatted, output in integer: 140695921164310 <= this one in hex is the same as the two above.
ConsumeablesBase's Value formatted to Hex: 7BB7F807598
Cheat engine when putting these ConsumeablesBase as an address into the table:
Address: 7FF652660013
Value: 000007BB7FB486D8
Thanks in advance for any helpful insight on what might be happening.
Here is my code
Code: |
[enable]
{$lua}
function DEC_HEX(IN)
local B,K,OUT,I,D=16,"0123456789ABCDEF","",0
while IN>0 do
I=I+1
IN,D=math.floor(IN/B),math.mod(IN,B)+1
OUT=string.sub(K,D,D)..OUT
end
return OUT
end
local HpAddress
HpAddressStringFormat = string.format( '%x', GetAddress("ConsumeablesBase") )
HpAddressDEC_HEX = DEC_HEX( GetAddress("ConsumeablesBase") )
HpAddressDecRaw = GetAddress("ConsumeablesBase")
HpAddressValue = DEC_HEX( readQword("ConsumeablesBase") )
| [/code]
_________________
Name: Player One
Occupation: Gamer
The Players are a particularly violent group of gamers. They solve all of their problems via bloody bouts with each other, and they live happier lives for it.
Player One is blue, and a bit of an asshole. |
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4289
|
Posted: Sun Dec 20, 2020 11:00 am Post subject: |
|
|
It would be helpful if you had the AA script that initializes the symbol. I'm assuming it goes something like this:
Code: | newmem:
// original code:
mov [edi+10F],eax
// your code:
mov [ConsumablesBase],edi
jmp return |
godsblight wrote: | The symbol's value is an address, so ConsumablesBase is essentially a pointer. I am attempting to read that pointer or extract the value and then get the value of that address with offset 10F.
...
Cheat engine when putting these ConsumeablesBase as an address into the table:
Address: 7FF652660013
Value: 000007BB7FB486D8 | You recognize it's a pointer and it has one offset of 10F. Treat it like it's a pointer with an offset of 10F.
When you click on "add address", click the "pointer" checkbox, put "ConsumablesBase" for the base address, and put "10F" for the offset.
Lua equivalent:
Code: | print(getAddressSafe'[ConsumablesBase]+10F')
print(readInteger'[ConsumablesBase]+10F')
-- more explicit:
print(readInteger(readPointer'ConsumablesBase'+0x10F)) |
Also:
Code: | function DEC_HEX(IN)
return ('%X'):format(IN)
end | Lua has operators for integer division ("//") and modulus ("%") too.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Sun Dec 20, 2020 11:06 am Post subject: |
|
|
keep in mind that lua executes before the AA script, so if you do the registering of the symbol in the SAME script, you're not going to get the current address
_________________
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 |
|
|
godsblight Grandmaster Cheater Reputation: 0
Joined: 02 Jul 2007 Posts: 805
|
|
Back to top |
|
|
|
|
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
|
|