Rob-- / memoryjs

Read and write process memory in Node.js (Windows API functions exposed via Node bindings)
MIT License
632 stars 86 forks source link

Hi Rob, #99

Closed broberts2 closed 2 years ago

broberts2 commented 2 years ago

Hi Rob,

I apologize in advance for commenting on an already closed issue, but I've been at this for hours and have hit a hard wall. I was able to read from cheat engine the values I want at a particular address just fine, but I'm having issues with the pointers in my code. As you can see in the GE screenshot, I am able to get float I want, but in my console screenshot from node, I am getting something totally different. pointerChain is the method in question that is being called from another file. Any help would be greatly appreciated :)

Please see below for reference:

image image image image

Originally posted by @broberts2 in https://github.com/Rob--/memoryjs/issues/89#issuecomment-1214350932

aurelius88 commented 2 years ago

The problem here is at line 7. You are just inserting an address offset (to the process' address), but memoryjs.readMemory only accepts the full address. So you need to add the process' base address to your offset 0x073dd720. You can get the process' base address by using your processObject. In the end, line 5 to 9 should look like this:

const p1 = memoryjs.readMemory(
    processObject.handle,
    processObject.modBaseAddr + 0x073dd720,
    memoryjs.PTR
);
broberts2 commented 2 years ago

Thanks for the reply,

I've tried that as well, and when I do that I still receive a separate value noted in the below screenshot:

image

image

broberts2 commented 2 years ago

Here's some context if it helps.

That pointer is tracking the z player coordinate in-game. It is generally a float between 0.0- 3000.0 when standing above water and < 0.0 when diving in Sea of Thieves. When working correctly, that value updates accordingly each time I scan memory every half-second.

Rob-- commented 2 years ago

Are you targeting a 32 or 64 bit application? And is your Node 32 or 64 bit?

It would help if you printed all the pointer values in hex to make it easier to see what is going wrong and where!

broberts2 commented 2 years ago

Using Node 64 and also targeting a 64 bit app. I've uploaded several more screen captures after adding some more logging like you suggested. You're probably on to something with pointer 6:

Capture image image

Rob-- commented 2 years ago

Checking with Cheat Engine like you did before, is the first pointer that is read the correct value?

broberts2 commented 2 years ago

Interesting. So yeah, they all match up except for the last one:

image image

broberts2 commented 2 years ago

Okay, so I actually figured this out. This was totally on my end. I included a snippet of my working code with the change.

This was really good to help me understand some fundamental concepts of pointers and I really appreciate you asking the right questions to make me think about the problem the correct way.

Thanks for the help Rob!

image