Comments (6)
const p1 = memoryjs.readMemory(processObject.handle, process.modBaseAddr + 0x41F8798, memoryjs.PTR);
// p1 = 0x1DBCCBCD730
const p2 = memoryjs.readMemory(processObject.handle, p1 + 0x0, memoryjs.PTR);
// p2 = 0x1DBCCB70C80
const p3 = memoryjs.readMemory(processObject.handle, p2 + 0x20, memoryjs.PTR);
// p3 = 0x1DC070CF3B8
// ...etc
It would be a good idea to not use process
as the name of your memoryjs.openProcess
variable as it is a reserved global variable in Node.js
from memoryjs.
Closing, comment if you still need help :)
from memoryjs.
Opening because others may find this stuff below helpful. If you're looking to recreate the Cheat Engine pointer experience then you can reduce down an array of offsets instead of potentially writing a ton of lines and getting lost.
Is this something that could fit the examples @Rob-- ?
const getValueWithOffsets = (address, handle, offsets, type) => {
return offsets.reduce((a, b, index, array) => {
const value = memoryjs.readMemory(handle, a + b, memoryjs.PTR)
if (index === array.length - 1) {
return memoryjs.readMemory(handle, a + b, type) // If we're at the last offset, we don't want to read it's value as a pointer, but rather the type it should be, instead. If you want the end address instead of the value (then return a + b)
}
return value
}, address)
}
Using the above Minecraft example, it'd look something like this.
const processName = 'Minecraft.Windows.exe'
const game = memoryjs.openProcess(processName)
const OFFSETS = [0x0, 0x20, 0x8, 0x10, 0x268, 0x128, 0x9A4] // Your array of offsets. (0x... notates that we're writing hexadecimal. Start from the bottom of the offset in Cheat Engine)
let result = getValueWithOffsets(
game.modBaseAddr + 0x41F8798, // Minecraft.Windows.exe + 0x41F8798
game.handle,
OFFSETS,
memoryjs.BYTE, // The end type of the value needed.
)
console.log(result) // 0. The value of the end address, as a byte.
I hope this helps!
from memoryjs.
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:
from memoryjs.
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:
Try setting the type of p8 to float instead of ptr
See my example above, where the last offset isn't declared as a pointer, but rather the type we're looking for.
from memoryjs.
Opening because others may find this stuff below helpful. If you're looking to recreate the Cheat Engine pointer experience then you can reduce down an array of offsets instead of potentially writing a ton of lines and getting lost.
Is this something that could fit the examples @Rob-- ?
const getValueWithOffsets = (address, handle, offsets, type) => { return offsets.reduce((a, b, index, array) => { const value = memoryjs.readMemory(handle, a + b, memoryjs.PTR) if (index === array.length - 1) { return memoryjs.readMemory(handle, a + b, type) // If we're at the last offset, we don't want to read it's value as a pointer, but rather the type it should be, instead. If you want the end address instead of the value (then return a + b) } return value }, address) }Using the above Minecraft example, it'd look something like this.
const processName = 'Minecraft.Windows.exe' const game = memoryjs.openProcess(processName) const OFFSETS = [0x0, 0x20, 0x8, 0x10, 0x268, 0x128, 0x9A4] // Your array of offsets. (0x... notates that we're writing hexadecimal. Start from the bottom of the offset in Cheat Engine) let result = getValueWithOffsets( game.modBaseAddr + 0x41F8798, // Minecraft.Windows.exe + 0x41F8798 game.handle, OFFSETS, memoryjs.BYTE, // The end type of the value needed. ) console.log(result) // 0. The value of the end address, as a byte.I hope this helps!
This didn't work but this refactor did.
const getValueWithOffsets = (handle, offsets, resultType) => {
let pointer = null;
for (let i = 0; i < offsets.length; i++) {
let isLast = i === offsets.length - 1,
offset = offsets[i];
if (isLast) {
return memoryjs.readMemory(handle, Number(pointer) + offset, resultType);
} else {
if (pointer === null) {
pointer = memoryjs.readMemory(handle, offset, memoryjs.PTR);
} else {
pointer = memoryjs.readMemory(handle, Number(pointer) + offset, memoryjs.PTR);
}
}
}
}
const hp = getValueWithOffsets(
trose.handle,
[trose.modBaseAddr + 0x0154EE60, 0x3B90],
memoryjs.INT32, // The end type of the value needed.
)
from memoryjs.
Related Issues (20)
- How to read shared memory channel? (Windows) HOT 5
- Reading an address that is a BigInt throwing errors? HOT 3
- The library can't read memory for me can someone help me figure it out? HOT 2
-
- Any way to get module exports? HOT 2
- Add "Windows only" to readme HOT 2
- Usage with electron HOT 2
- Just pushed a commit (3be70b051025327db5d5f54cd5a1f777dea75943) that I think should enable this now (not on NPM yet). I wasn't familiar with memory mapped files before working on this change, but from my little testing it seems like you should be able to replicate this C# logic with memoryjs now. Updated the README with an example ([documentation](https://github.com/Rob--/memoryjs#memory-mapped-files-1)). HOT 2
- Error reading BigInt pointer HOT 6
- Feature: Open process using th32ProcessID instead of process name(multiple processes same name) HOT 2
- Idea: External thread trace
- Writing to an adres using pointers HOT 2
- Little Endian Support HOT 3
- add pointer or int64 parameters on callFunction?
- publish/release newest version to npm? :) HOT 2
- Linux/Unix support HOT 2
- setProtection is not available in latest version HOT 1
- Problems when using with electron. HOT 1
- Hi Rob, HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from memoryjs.