0

I'm a beginner at this and I'm following tutorials but I am kind of stuck.

I found a function that accesses all characters X position in game. I found this using Cheat Engine and here's how it looks:enter image description here

All these addresses are X positions of characters in game.

I looked up this function in IDA and the functions looks like this:

double __thiscall sub_427380(int this)
{
  return *(float *)(this + 80);
}

So I managed to hook this function and read the values in C++.

Here's the code:

double hookedFunction(int i)
{
    float f = *(float *)(i + 80);
    return originalFunction(i);
}

This works but when I try to read values from other offsets that I found using the "Dissect Data/Structures" function in Cheat Engine I'm stuck.

Here's the structure from one of the addresses I found in Cheat Engine:

When I subtract 80 from the address and I create a new data structure in Cheat Engine it looks like this: enter image description here

So here's where I need help. How do I read the string at offset 0040 and the 4 bytes at offset 003C in my hooked function.

I tried doing stuff like:

DWORD d = *(DWORD *)(i + 0x3C);

But whatever I try I can't get the right values.

1

This is more of a C development question, however the answer is offset 0x40 has a pointer to an array of chars.

Code should be the following:

char* charname = *(char **)(i + 0x40);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.