how can i compare pointer in asm?

Anything Cheat Engine related, bugs, suggestions, helping others, etc..
Post Reply
User avatar
MikinaneShindouda
Cheater
Cheater
Posts: 48
Joined: Mon Sep 25, 2017 7:30 pm
Reputation: 32

how can i compare pointer in asm?

Post by MikinaneShindouda »

im pretty new here

i have this pointer
offset7: fc8
offset6: c
offset5: 10
offset4: 0
offset3: 5c
offset2: 20
offset1: 24
"GameAssembly.dll"+01ADFC7C

question is how can i use/compare it in asm table?

User avatar
Marc
Table Makers
Table Makers
Posts: 235
Joined: Mon Mar 26, 2018 2:35 pm
Reputation: 165

Re: how can i compare pointer in asm?

Post by Marc »

You'll have to follow the pointers manually. Instead of writing a wall of text here (which would only give you a worse explanation, I'm sure), I'd recommend watching the tutorial video from "Cheat The Game":

have fun,
Marc

User avatar
MikinaneShindouda
Cheater
Cheater
Posts: 48
Joined: Mon Sep 25, 2017 7:30 pm
Reputation: 32

Re: how can i compare pointer in asm?

Post by MikinaneShindouda »

Marc wrote:
Sat Jan 02, 2021 8:02 am
You'll have to follow the pointers manually. Instead of writing a wall of text here (which would only give you a worse explanation, I'm sure), I'd recommend watching the tutorial video from "Cheat The Game":

have fun,
Marc
thank you very much

User avatar
PeaceBeUponYou
Noobzor
Noobzor
Posts: 7
Joined: Sat Dec 12, 2020 8:09 am
Reputation: 7

Re: how can i compare pointer in asm?

Post by PeaceBeUponYou »

in AAssembler

Code: Select all

label(symbol)
[[[[[[["GameAssembly.dll"+01ADFC7C]+24]+20]+5C]+0]+10]+C]+FC8:
symbol:
then your current address will be called as symbol and you can directly link to it

jgoemat
Table Makers
Table Makers
Posts: 38
Joined: Fri Jul 21, 2017 6:47 pm
Reputation: 37

Re: how can i compare pointer in asm?

Post by jgoemat »

If you use the symbol the address is calculated when you enable the script. If one of the pointers changes like if this is a pointer for the ship you're in and you get in another ship, that object could get destroyed and you could corrupt the game memory or have an access violation. You could use code to go through the pointers. If you check for null (0) at each step that is usually sufficient:

Code: Select all

push eax
mov eax,["GameAssembly.dll"+01ADFC7C]
test eax,eax
jz @f // jumps forward to the next '@@:' label
mov eax,[eax+24]
test eax,eax
jz @f
mov eax,[eax+20]
test eax,eax
jz @f
mov eax,[eax+5c]
test eax,eax
jz @f
mov eax,[eax]
test eax,eax
jz @f
mov eax,[eax+10]
test eax,eax
jz @f
mov eax,[eax+c]
test eax,eax
jz @f
// now eax has the last pointer, I assume the value you want to use is at [eax+fc8]
// say we want to change the value to 1,000
mov [eax+fc8],#1000
@@:
pop eax
Of course it would be better to hook the code that actually uses the value at this address and do something with it there... You mention comparing the pointer. I'll assume the value is a pointer to the current ship you're in let's say, and you have a function that does damage to ships so you want to make it so it does 0 damage to YOUR ship by comparing the ship pointer to this value. The normal way to do this would be to have two scripts. One hooks the code that you know accesses the player's ship and no other and saves that value to an address in memory and registers a symbol for it (pseudo-code here):

Code: Select all

[enable]
label(pPlayerShip)
newmem:
  mov eax,[ecx+fc8] // original code
  mov [pPlayerShip],eax
  jmp return
  
align 10
pPlayerShip:
  dd 0
  
hook:
  jmp newmem
return:

registersymbol(pPlayerShip)
Then when you have code that does damage to a ship, you can compare that pointer with the ship pointer (esi here) and skip the instruction that subtracts the damage if it matches:

Code: Select all

[enable]
alloc(newmem,$1000)
newmem:
  cmp esi,[pPlayerShip]
  je @f
  subss xmm1, xmm2 // original instruction, subtracts damage
@@:
  jmp return

Post Reply

Who is online

Users browsing this forum: No registered users