Read memory and pointer

Discuss, ask for help, share ideas, give suggestions, read tutorials, and tell us about bugs you have found with MicroMacro in here.

Do not post RoM-Bot stuff here. There is a subforum for that.
Forum rules
This is a sub-forum for things specific to MicroMacro.

This is not the place to ask questions about the RoM bot, which uses MicroMacro. There is a difference.
Post Reply
Message
Author
el_dios85
Posts: 29
Joined: Tue Jul 07, 2009 8:43 pm

Read memory and pointer

#1 Post by el_dios85 » Tue Jul 07, 2009 8:57 pm

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

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Read memory and pointer

#2 Post by Administrator » Tue Jul 07, 2009 9:23 pm

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);

el_dios85
Posts: 29
Joined: Tue Jul 07, 2009 8:43 pm

Re: Read memory and pointer

#3 Post by el_dios85 » Wed Jul 08, 2009 1:58 am

tmp1 = memoryReadIntPtr(proc, charptr_addr, HPPet_offset);
tmp2 = memoryReadInt(proc, tmp1 + HPPet3);
HPPet = memoryReadInt(proc, tmp2 + HPPet4);

Thank you, It's work....

User avatar
Rishijin
Posts: 49
Joined: Sat Jul 04, 2009 4:25 pm
Location: Kauai

Re: Read memory and pointer

#4 Post by Rishijin » Tue Jul 14, 2009 4:49 pm

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

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Read memory and pointer

#5 Post by Administrator » Tue Jul 14, 2009 5:00 pm

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);

User avatar
Rishijin
Posts: 49
Joined: Sat Jul 04, 2009 4:25 pm
Location: Kauai

Re: Read memory and pointer

#6 Post by Rishijin » Tue Jul 14, 2009 5:05 pm

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests