View previous topic :: View next topic |
Author |
Message |
Bit Byte Advanced Cheater
Reputation: 0
Joined: 28 Nov 2022 Posts: 62
|
Posted: Mon Aug 21, 2023 9:42 am Post subject: Same Address different value? Why? |
|
|
Code: | local TeamIdAddress1 = getAddress('[[[[game.exe+01CBBBF0]+60]+338]+38]+A0')
local baseAddress = getAddress('game.exe+01CBBBF0')
local TeamIdAddress2 = getAddress(baseAddress + 0x60 + 0x338 + 0x38 + 0xA0)
print("TeamIdAddress1:", TeamIdAddress1)
print("TeamIdAddress2:", TeamIdAddress2) |
I am getting different values at print for TeamIdAddress1 & TeamIdAddress2.
Why is that? Aren't both the same exact address?
Can someone explain and help me understand.
|
|
Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4700
|
Posted: Mon Aug 21, 2023 10:13 am Post subject: |
|
|
Pointers don't work that way. A pointer is a value type that stores another address.
Square brackets mean "the pointer value stored at this address"
Code: | local TeamIdAddress1 = getAddress'[[[[game.exe+01CBBBF0]+60]+338]+38]+A0'
local TeamIdAddress2 = readPointer(readPointer(readPointer(readPointer'game.exe+1CBBBF0'+0x60)+0x338)+0x38)+0xA0
assert(TeamIdAddress1 == TeamIdAddress2) |
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
 |
Bit Byte Advanced Cheater
Reputation: 0
Joined: 28 Nov 2022 Posts: 62
|
Posted: Tue Aug 22, 2023 3:01 am Post subject: |
|
|
Something new learnt. Thank you.
So In this example:
Code: | '[[[[game.exe+01CBBBF0]+60]+338]+38]+A0' |
Does it mean there are 5 pointers one pointing to the next until it comes to the final address?
|
|
Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4700
|
Posted: Tue Aug 22, 2023 9:29 am Post subject: |
|
|
There are 4 pointers. Example:
Code: | pointer -> value
1: [game.exe+01CBBBF0] -> 415C69AE0
2: [415C69AE0 + 60] -> 298145E00
3: [298145E00 + 338] -> 417BB14C0
4: [417BB14C0 + 38] -> 1C849EA08
final address (can be any type): 1C849EA08 + A0 = 1C849EAA8 |
The first pointer is the base address. The next 3 pointers are nodes. The final result is the address the pointer path points to.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
 |
Bit Byte Advanced Cheater
Reputation: 0
Joined: 28 Nov 2022 Posts: 62
|
Posted: Tue Aug 22, 2023 11:15 am Post subject: |
|
|
Code: | local xStepSequence = {0x0, 0x8, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38, 0x40, 0x48, 0x50, 0x58, 0x60}
for PIndex, PxOffset in ipairs(xStepSequence) do
local TeamIdAddress2 = readPointer(readPointer(readPointer(readPointer'game.exe+1CBBBF0'+0x60)+0x338)+PxOffset)+0xA0
end |
As you can see above when i used PxOffset to replace a certain offset (3rd one here) it works but when I use it similarly like this:
local TeamIdAddress1 = getAddress'[[[[game.exe+01CBBBF0]+60]+338]+PxOffset]+A0'
why doesn't it work?
Another question I have is that I learnt from you using getAddressSafe to counter errors for nil values. How would I do that in this case:
Code: | readPointer(readPointer(readPointer(readPointer'game.exe+1CBBBF0'+0x60)+0x338)+PxOffset)+0xA0 |
There is no readPointerSafe is there?
|
|
Back to top |
|
 |
LeFiXER Grandmaster Cheater Supreme
Reputation: 20
Joined: 02 Sep 2011 Posts: 1069 Location: 0x90
|
Posted: Tue Aug 22, 2023 11:52 am Post subject: |
|
|
Because getAddress requires a string literal.
Code: |
local TeamIdAddress1 = getAddress('[[[[game.exe+01CBBBF0]+60]+338]+' .. string.format('%X', PxOffset) .. ']+A0')
|
|
|
Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4700
|
Posted: Tue Aug 22, 2023 1:16 pm Post subject: |
|
|
Code: | local my_var = 5
print(my_var) -- prints "5"
print('my_var') -- prints "my_var", not 5 |
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
 |
Bit Byte Advanced Cheater
Reputation: 0
Joined: 28 Nov 2022 Posts: 62
|
Posted: Wed Aug 23, 2023 10:59 am Post subject: |
|
|
Ok, thank you, I got it to work.
|
|
Back to top |
|
 |
|