I used CE to find 2 pointers with their addresses/offsets pointing at the same value. They both work really well in CE, but when I try to read these values in python with pymem I have completely differrent values :
In this exemple, the value I had in the game and in CE was 400. I tried the same with other games and other pointers, and got exactly the same issue. Another weird thing : "pm.base_address" gives me "4259840" while CE gives me "1908" for the base address of the same process. Why does pymem reads completely off values while my pointers are 100% working ?
I tried to "check if found opcodes also access other addresses", it shows (0) or (1) on all assembly fonction as expected, so no weird multiple address type of storage messing around.
python code :
from pymem import Pymem
import time
target = "Game.exe"
try :
pm = Pymem(target)
except :
print("ivalid exe file")
quit()
data = [["scraps", 0x4C549C, [0x20, 0x0, 0x4, 0x4D4]],
["scraps2", 0x4C54A0, [0x170, 0xFC, 0xB0, 0x9C, 0x4D4]]]
def getPointerAddr(base, offsets):
addr = pm.read_int(base)
for offset in offsets:
if offset != offsets[-1]:
addr = pm.read_int(addr + offset)
addr = addr + offsets[-1]
return addr
print(pm.base_address)
while True :
temp = ""
for i in range(len(data)) :
temp += data[i][0]+" : "+str(getPointerAddr(pm.base_address + data[i][1], offsets=data[i][2]))+", "
print(temp)
time.sleep(1.5)
I managed to find out the issue, in temp += data[i][0]+" : "+str(getPointerAddr(pm.base_address + data[i][1], offsets=data[i][2]))+", "
I am adding the address to the string, not the value in the address.
Changing this line to temp += data[i][0]+" : "+str(pm.read_int(getPointerAddr(pm.base_address + data[i][1], offsets=data[i][2])))+", "
fixed the issue.