1

I have an offset to a property within a player class that I need to access data from. It's made of a specific struct that I have already assembled. IDA reports the accessing offset as so:

v32 = ( v3 + 280 ) // v3 is the player in this case

I want to convert this to the correct struct within my own C++ module so I can read a specific property of that struct. I can easily get the base address of the players but whenever I get the property it doesn't come out correct.

I have tried something of the following:

playerData* lpData = reinterpret_cast<playerData*>((int)n_GetLocalPlayer() + 280);

But the struct isn't correct.

There is NO doubt that the base address or offset are correct, as the function I reversed in IDA was short and well commented. I just need help casting it.

Thank you!

1 Answer 1

1

So silly me, the function n_GetLocalPlayer() needed to be dereferenced and then the result from the offset dereferenced again. It works now. Here's the format:

playerData* lpData = reinterpret_cast<playerData*>((*((DWORD *)n_GetLocalPlayer() + 280)));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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