Page 1 of 1

Read memory and pointer

Posted: Tue Jul 07, 2009 8:57 pm
by el_dios85
This is some source code from auto it script:
=====================================================================
Global $OFFSET_MP[3]
$OFFSET_MP[1] = 32
$OFFSET_MP[2] = IniRead($SOFTWARE_OFFSET_CONFIG, $CFG_OFFSET_ROOT_KEY, $CFG_OFFSET_MP, "1108")

Global $OFFSET_PET_HP[5]
$OFFSET_PET_HP[1] = 32
$OFFSET_PET_HP[2] = 3204
$OFFSET_PET_HP[3] = IniRead($SOFTWARE_OFFSET_CONFIG, $CFG_OFFSET_ROOT_KEY, $CFG_OFFSET_SLOT, "16")
$OFFSET_PET_HP[4] = 56
=====================================================================

to read MP
in auto it script
$HP = _MEMORYPOINTERREAD($APP_BASE_ADDRESS, $PROCESS_INFORMATION, $OFFSET_MP)
in micromacro
MP = memoryReadIntPtr(proc, charptr_addr, MP_offset);
the variable OFFSET_MP and MP_offset contain the same value


to read Pet HP
in auto it script
$PET_HP = _MEMORYPOINTERREAD($APP_BASE_ADDRESS, $PROCESS_INFORMATION, $OFFSET_PET_HP)
in micromacro I'm a little bit confuse because the PET_HP variable contain two more pointer [3] and [4]
can anyone give any clue to read the pet HP that use more pointer?


Thanks

Re: Read memory and pointer

Posted: Tue Jul 07, 2009 9:23 pm
by Administrator
So you're doing a pointer chain? That is, something like (((address+x)+y)+z)?

Do it like this:

Code: Select all

local tmp1 = memoryReadIntPtr(proc, address, offset1);
local tmp2 = memoryReadInt(proc, tmp1 + offset2);
local tmp3 = memoryReadInt(proc, tmp2 + offset3);
local petHP = memoryReadInt(proc, tmp3 + offset4);

Re: Read memory and pointer

Posted: Wed Jul 08, 2009 1:58 am
by el_dios85
tmp1 = memoryReadIntPtr(proc, charptr_addr, HPPet_offset);
tmp2 = memoryReadInt(proc, tmp1 + HPPet3);
HPPet = memoryReadInt(proc, tmp2 + HPPet4);

Thank you, It's work....

Re: Read memory and pointer

Posted: Tue Jul 14, 2009 4:49 pm
by Rishijin
I thought that your solution would apply to the problem I was having, but it doesn't seem to work.
There is a chance I could be doing it wrong, but unfortunately el_dios' situation doesn't seem to involve the new addresses of the pointers, but just extra offsets (which doesn't make sense to me as to why you'd want to keep adding offsets to the same address; so it makes me think that something else is going on there that I'm not seeing.) and so it confuses me as to what I should do.
I have a pointer with two other pointers above it, and I don't know how I would code it to read properly in lua to make it read from the base pointer.

For example:

I'm looking at this in Cheat Engine:

Image


Is this the same type of chain that el_dios was working with?



BTW: The base pointer address is missing at 8 at the end. Should be game.exe+01DF1CB8

Re: Read memory and pointer

Posted: Tue Jul 14, 2009 5:00 pm
by Administrator
Yes, it is the same thing. The only real difference is that you can't use the notation game.exe+(whatever). You must use the fully qualified address.

Code: Select all

local temp1 = memoryReadIntPtr(proc, 0x2BD3B98, 0x424);
local temp2 = memoryReadInt(proc, temp1 + 0xC0);
local value = memoryReadInt(proc, temp2 + 0x1EC);

Re: Read memory and pointer

Posted: Tue Jul 14, 2009 5:05 pm
by Rishijin
I see what happened.
I actually coded them backwards!
I thought you had to start with the nearest in the chain, but it seems that you start with the base.

Thanks.