Compare (CMP) register with multiple offset

Post your topics and discussions here that you can't find a good section for.
Post Reply
Almahdi
Cheater
Cheater
Posts: 37
Joined: Wed Jun 27, 2018 2:52 pm
Reputation: 35

Compare (CMP) register with multiple offset

Post by Almahdi »

is it possible to compare registers with multilevel offsets ?

aSwedishMagyar
Table Makers
Table Makers
Posts: 670
Joined: Mon Jul 06, 2020 3:19 am
Reputation: 1190

Re: Compare (CMP) register with multiple offset

Post by aSwedishMagyar »

Yeah it is. You just have to make sure that each level is guaranteed to be a valid pointer.

Say you have something that has 3 levels at +54, +1AC, and +8 with the base being in rcx, you would need to navigate like so:

push rax
mov rax,[rcx+54]
mov rax,[rax+1AC]
cmp [rax+8],1B //Whatever you need to compare with
pop rax
je code //Whatever kind of jump you need to do


The issue with this is if for some cases the +1AC level is not a valid pointer you will crash the game. You can do things like try except blocks or use 'IsBadReadPtr' to get around it but typically it's best to just find another compare.

Almahdi
Cheater
Cheater
Posts: 37
Joined: Wed Jun 27, 2018 2:52 pm
Reputation: 35

Re: Compare (CMP) register with multiple offset

Post by Almahdi »

thanks for the help .... it worked, i never thought we have to use the STACK function :D

Post Reply

Who is online

Users browsing this forum: No registered users