Hi,
I am resurrecting this post because I have returned to this same bit of code just now after the big Path of Exile update. It is now 64 bit and I am having a lot of trouble reading the memory. I also had some trouble finding the offsets and static address in Cheat Engine but I figured that part out (had to use 8 byte instead of the default 4). I am having trouble reading the memory in the addresses I have figured out with both the ReadMemory() function below and I have installed classMemory.ahk and tried using that as well but I couldn't get results. Thank you in advance!
base = 7FF6 EB18 0000
static = base + 0x1311268 = 7FF6 EC49 1268
current hp = static + +0xa10 + 0x998 + 0x9d8
max hp = static + +0xa10 + 0x998 + 0x9d0
you can check my work here
https://imgur.com/a/jbxLp
classMemory.ahk
https://github.com/Kalamity/classMemory
For simplicity sake all I want is a program that will give me the max hp and current hp values in a msgbox. If i can extract that info the auto potion code is easy and I've already done it in the past as you can see.
Simple Msgbox:
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#Include <classMemory>
; You can use this code to check if you have installed the class correctly.
if (_ClassMemory.__Class != "_ClassMemory")
{
msgbox class memory not correctly installed. Or the (global class) variable "_ClassMemory" has been overwritten
ExitApp
}
poe := new _ClassMemory("ahk_exe PathOfExile_x64Steam.exe", "", hProcessCopy)
; Check if the above method was successful.
if !isObject(poe)
{
msgbox failed to open a handle
if (hProcessCopy = 0)
msgbox The program isn't running (not found) or you passed an incorrect program identifier parameter.
else if (hProcessCopy = "")
msgbox OpenProcess failed. If the target process has admin rights, then the script also needs to be ran as admin. Consult A_LastError for more information.
ExitApp
}
base:=getProcessBaseAddress("ahk_exe PathOfExile_x64Steam.exe")
s1:=base+0x1311268
p1:=poe.Read(s1)
p2:=poe.Read(p1+0xa10)
p3:=poe.Read(p2, "UInt", 0x998)
chp:=poe.Read(p3, "UInt", 0x9d8)
mhp:=poe.Read(p3, "UInt", 0x9d0)
WinGet, pid, PID, ahk_exe PathOfExile_x64Steam.exe
MsgBox, The POE's PID is %pid%`nbase = %base%`ns1 = %s1%`np1 = %p1%`np2 = %p2%`np3 = %p3%`nchp = %chp%`nmhp = %mhp%
ReadMemory: (even though my code is currently trying to use the classMemory.ahk lib file. classMemory.ahk is standard and unaltered from github so there is no point posting that here but the ReadMemory function could be different so I am posting it here)
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
ReadMemory(address)
{
; It would be safer to use a more exact title for winget e.g.
; winget, pid, PID, ahk_exe PathOfExile.exe ; or what ever the exe is called
; otherwise you risk reading from another process when PoE isn't the active window.
WinGet, pid, PID, ahk_exe PathOfExile_x64Steam.exe
if !pid
return
if !hProcess := DllCall("OpenProcess", "UInt", 24, "Int", False, "UInt", pid, "Ptr")
return
success := DllCall("ReadProcessMemory", "Ptr", hProcess, "Ptr", address, "UInt*", result, "Ptr", 4, "Ptr",0)
DllCall("CloseHandle", "Ptr", hProcess)
return success ? result : ""
}