MM2 getModuleAddress

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
KillerTHC
Posts: 63
Joined: Tue May 25, 2010 8:49 pm

MM2 getModuleAddress

#1 Post by KillerTHC » Wed Sep 24, 2014 5:00 pm

I am trying to access a static address in the LOTRO client using process.read, however I am having trouble understanding how to get the base address of the client and then adding the address to it to get the correct address to read from.

CE says the static address is at lotroclient.exe+1561154
So I tried the following

Code: Select all

staticAddress = 0x1561154;
lotroBase = process.getModuleAddress(lotroProcId, "lotroclient.exe");
process.read(lotroProc, "ushort", lotroBase + staticAddress);
But the value I am getting is incorrect, I can see the address is still valid in CE.
How should I be accomplishing this task?

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

Re: MM2 getModuleAddress

#2 Post by Administrator » Wed Sep 24, 2014 8:30 pm

How is it invalid, nil or is it giving the wrong address? What is getModuleAddress() returning? What happens if you print lotroBase + staticAddress?

KillerTHC
Posts: 63
Joined: Tue May 25, 2010 8:49 pm

Re: MM2 getModuleAddress

#3 Post by KillerTHC » Thu Sep 25, 2014 6:38 am

Administrator wrote:How is it invalid, nil or is it giving the wrong address? What is getModuleAddress() returning? What happens if you print lotroBase + staticAddress?
After doing some debugging I found out getModuleAddress() is returning the correct address and when I add the static address I get the correct address as displayed by CE, however the value I get when reading the memory from that address is drastically different than the value CE displays. CE display a float ranging from -1 to 1, MM displays a number in the thousands. I am going to keep debugging, if you have any tips or guesses I will appreciate it too.

EDIT:
I found my mistake I was reading a ushort instead of a float, I was a bit confused because the online documentation isn't 100% clear about what the variable type can be in process.read() I understand this is because its still in development. Thank you for the help!

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

Re: MM2 getModuleAddress

#4 Post by Administrator » Thu Sep 25, 2014 2:38 pm

Sorry, I might have to clear that up. Still, you want to keep the same type you do in Cheat Engine. So if the variable type is float in CE, read it as a float.

A "short" is a single byte from -127 to 127, and unsigned short is 0 to 255.

Here's a decent list to go by:
http://stackoverflow.com/questions/5895 ... t-long-etc
signed char: -127 to 127 (note, not -128 to 127; this accommodates 1's-complement platforms)
unsigned char: 0 to 255
"plain" char: -127 to 127 or 0 to 255 (depends on default char signedness)
signed short: -32767 to 32767
unsigned short: 0 to 65535
signed int: -32767 to 32767
unsigned int: 0 to 65535
signed long: -2147483647 to 2147483647
unsigned long: 0 to 4294967295
signed long long: -9223372036854775807 to 9223372036854775807
unsigned long long: 0 to 18446744073709551615

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: MM2 getModuleAddress

#5 Post by rock5 » Thu Sep 25, 2014 11:35 pm

Some of those values you copied over look wrong.
Looks like the long values are what we call ints and the long long values are what we call long.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

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

Re: MM2 getModuleAddress

#6 Post by Administrator » Fri Sep 26, 2014 12:31 pm

Not wrong, it's just there's some information missing.
A long and int are the same thing (in C++). Usually. It depends on platform, though nowadays I think it would be hard to find one where they are different. Many years ago, an int could be 4 bytes on one platform and 2 on another. Now it is standardized as 4 bytes (ie. long).

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: MM2 getModuleAddress

#7 Post by rock5 » Fri Sep 26, 2014 10:20 pm

Glad I quantified my answers with "what we call" then. :)
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests