Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Is there a smarter/cleaner way I could have done this?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Goat Engine
Cheater
Reputation: 0

Joined: 13 Aug 2018
Posts: 44

PostPosted: Thu Apr 21, 2022 8:59 pm    Post subject: Is there a smarter/cleaner way I could have done this? Reply with quote

This works as is, but I was curious if this is the most efficient way to accomplish comparing a pointer with several offsets in AA? Isn't there some way to get it working with the whole pointer on a single line, or do we have to break it up like this for these situations?

Code:
push rsi
mov esi,["WWE2K19_x64.exe"+025B6BD0]
mov esi,[esi+398]
mov esi,[esi+B8]
mov esi,[esi+238]
mov esi,[esi+1AC]
cmp esi,#3212836864
pop rsi
jne exit
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4291

PostPosted: Thu Apr 21, 2022 9:51 pm    Post subject: Reply with quote

If none of the nodes in a pointer path change, I think CE could accept this:
Code:
cmp [[[[["game.exe"+025B6BD0]+398]+B8]+238]+1AC],#3212836864
But this instruction assembles down to something like this:
Code:
cmp [741C5948AE58],#3212836864
The address in square brackets (e.g. 741C5948AE58) is the pointed-to address.
Obviously if any node in the pointer path changes this address becomes invalid and that instruction may crash the process. Even if it doesn't change, there's no guarantee the pointed-to address would be within 2 GiB for RIP-relative addressing, meaning you can't do that in a single instruction.

One alternative is to do an injection copy to get the pointed-to address.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Csimbi
I post too much
Reputation: 94

Joined: 14 Jul 2007
Posts: 3110

PostPosted: Fri Apr 22, 2022 1:53 am    Post subject: Reply with quote

Yes, you have to break it up like that, but your code is broken.
There are no 32bit pointers in x64.

You are also assuming the pointers will be okay.
I'd add a try/except just in case.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites