Closed ChristianTucker closed 2 years ago
Read ‘baseAddress + localPlayerAddress’ as DWORD. Then read that value + healthOffset as float.
So, here's what I came up with (and tried before making this issue)
memoryjs.openProcess("League of Legends.exe", (error, process) => {
if(error) return console.error(error);
if(!process.szExeFile) return console.error("Failed to open handle, szExeFile not found.");
const baseAddress = process.modBaseAddr;
const oLocalPlayer = 0x2F457FC;
const oHealth = 0x0DE8;
const pointer = memoryjs.readMemory(process.handle, baseAddress + oLocalPlayer, memoryjs.DWORD);
const health = memoryjs.readMemory(process.handle, pointer + oHealth, memoryjs.FLOAT);
console.log("Health:", health);
});
This prints a value of 1.0062128199535909e-31
which is definitely wrong, as it should be 586. Reading directly in C++ reflects this with a value of 586.xxxxxxxxxxx
.
This value also changes every time I query the memory, even though my health is not changing.
Just trying this out for fun
solved the problem?
So, here's what I came up with (and tried before making this issue)
memoryjs.openProcess("League of Legends.exe", (error, process) => { if(error) return console.error(error); if(!process.szExeFile) return console.error("Failed to open handle, szExeFile not found."); const baseAddress = process.modBaseAddr; const oLocalPlayer = 0x2F457FC; const oHealth = 0x0DE8; const pointer = memoryjs.readMemory(process.handle, baseAddress + oLocalPlayer, memoryjs.DWORD); const health = memoryjs.readMemory(process.handle, pointer + oHealth, memoryjs.FLOAT); console.log("Health:", health); });
This prints a value of
1.0062128199535909e-31
which is definitely wrong, as it should be 586. Reading directly in C++ reflects this with a value of586.xxxxxxxxxxx
.This value also changes every time I query the memory, even though my health is not changing.
Just trying this out for fun
If I am not mistaken, LoL runs 32 bit. Did you run
npm run build32
?
Just a shot in the blue. I cannot see anything majorly wrong with the code itself.
EDIT: try to make pointer and health use let and not const. I have had some problems with that in the past.
Oh additionally, all of that may even be caused by some anti cheat fuckery.
Closing, please comment if you still need help.
Notes:
process
as the variable name for the process object memoryjs.openProcess
returns, it is a reserved global variable in Node.jsmemoryjs.PTR
data type for reading pointers.npm run build32
or npm run build64
in the module directory).
I'm a little new to all of this, so please excuse my ignorance if I'm doing something wrong. I have a game that I'm going to call "game.exe" and the offset to the local player, and then a list of offsets that I want to obtain data for.
Here's what reading from this data looks like in C++
Here is what I'm trying the memoryjs
Printing these values out to hex shows up like this:
This is of-course being printed with
.toString(16)
Not really sure what I'm doing wrong, as it grabs the correct value in C++ but not in memoryjs (I'm probably doing something wrong).