asm question
asm question
Code:
mov eax, dword ptr ds:[004E4DBCh] mov eax, [eax] // eax is now local mov eax, dword ptr ds:[004E4E08h] mov eax, [eax] //eax is now pPlayerTable
Just a side question:
when you write: [eax] . Does that mean the data located in eax or like the address of eax?
This might be a stupid question but i get confused on stuff like this.
when you write: [eax] . Does that mean the data located in eax or like the address of eax?
This might be a stupid question but i get confused on stuff like this.
teleport proc
mov edx, DWORD PTR [player1]
add edx, DWORD PTR ofs_new_x
mov [edx], WORD PTR 0
add edx, 4h
mov [edx], WORD PTR 0
add edx, 4h
mov [edx], WORD PTR 0
ret
teleport endp
mov edx, DWORD PTR [player1]
add edx, DWORD PTR ofs_new_x
mov [edx], WORD PTR 0
add edx, 4h
mov [edx], WORD PTR 0
add edx, 4h
mov [edx], WORD PTR 0
ret
teleport endp
The declaration of player1 and playertable is not like a C preprocessor macro, that is to say that player will not be replaced by the value it has been initialized as. It has its own legitimate address. You need one more level of indirection (otherwise known as dereferencing) in order to obtain the same C code you posted above.
i dont understand. lets say i have this
i know that i have it all right. the class start address is inside of 004E4DBC. so i access the class start it by doing [004E4DBC]. then i move that into a register,so the register holds the class start address. then, i add my x offset to get the x value, and try to change it. then i add 4 and do the same for y, and z. but it won't work ingame. i know the hotkey works, i used a messagebox for testing.
i converted the class to offsets.
Code:
teleport proc mov eax, DWORD PTR player1 mov edx, [eax] add edx, DWORD PTR ofs_new_x mov [edx], WORD PTR 0 add edx, 4h mov [edx], WORD PTR 0 add edx, 4h mov [edx], WORD PTR 0 ret teleport endp
i converted the class to offsets.
[player] is not the same as [004E4DBCh]. [player] is 004E4DBCh.
As you can see, there is one more level of indirection.
Code:
// This... mov eax, dword ptr ds:[player] mov eax, [eax] mov eax, [eax] // is equivalent to this... mov eax, dword ptr ds:[004E4DBCh] mov eax, [eax]
Why are you derefrencing the pointer twice? The address of player1 (004e4dbc) is a pointer that points to the address of the class. If u derefrence it once, you should have the class address.
So what is player1 by itself?
also, when is it appropriate to use ds: ?
here it is in cheat engine...

34 is ofs_new_x
So what is player1 by itself?
also, when is it appropriate to use ds: ?
here it is in cheat engine...

34 is ofs_new_x
By creating the variable player1, you are effectively creating a pointer. If you create another pointer, you must dereference one more time to achieve the same result. In every single post, I have in some form or another stated that player1 occupies its own memory space. player1 contains the value 004E4DBCh, it is not 004E4DBCh itself.
ds - data
ss - stack
fs - OS defined (TIB for Windows)
cs/gs/es - point to the same locations/reserved
ds - data
ss - stack
fs - OS defined (TIB for Windows)
cs/gs/es - point to the same locations/reserved
so if i did
then edx would hold the value contained at the address of 004E4DBC?
Code:
mov edx, dword ptr [player1] mov edx, [edx]
ok well i fixed it big thanks to @Fovea .

