What is an offset?

Asked

Viewed 2,423 times

2

Good, I am researching about Heats for games and I came across the term "offset", I researched about and did not pass the thought, that offset is a calculation of the distance from the address to where you want to allocate such variable. that thought is right? if not, what is offset?

2 answers

2

I think it depends a lot on the context, because the word itself, it just means deslocado, compensado, equilibrado...

Considering the context you quoted, memory addressing, would consider the offset as the desired address offset. Therefore, I believe your thought: "is a calculation of the distance from the address to where you want to allocate such variable" is correct.

  • That’s right, the displacement relative to an initial position or root position.

2

  • What is an offset?

Offset, as already answered, is where is allocated a process information relative to a position. In written form this is, but for the subject, I prefer to give examples and show images:

To base ourselves better, let’s assume that a game (process) has the following architecture:

inserir a descrição da imagem aqui

Let’s assume the following offsets:

ClientDll = 0x12EA567; //Em relação ao ponto inicial, esse seria o modulo em que vamos trabalhar
Localplayer = 0x4BCD3F; //Em relação ao ClientDll
Vida = 0x100; //Em relação ao Localplayer

How do I get the life of the local player? Simple! Add it all up:

VidaDoJogador = ClientDll + Localplayer + Vida;

Understand that what we did, is to take information that is contained in a process from an address that we got through the offsets.

In real code (C++ & Winapi):

int VidaDoJogador = 0;
DWORD endereço = ClientDll + Localplayer + Vida;

ReadProcessMemory(processo, (void*)endereço, &VidaDoJogador, sizeof(VidaDoJogador), 0);

Where processo is the HANDLE of the process.

  • Why not work with offsets?

Offsets are very dynamic and can change whenever the process source code changes. I recommend reading Pattern Scanner, where instead of creating variables for the offsets and having to keep changing, it finds them for you, according to the static values next to it.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.