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 


Assembly - Comparing two addresses

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

Joined: 21 Aug 2018
Posts: 19

PostPosted: Tue Oct 23, 2018 10:07 am    Post subject: Assembly - Comparing two addresses Reply with quote

In short, I was to use code injection with assembly code to compare two addresses. As it is right now, my assembly code idea goes something like this:

push ebx -- Just storing this so I can free up ebx
move ebx, 027EC7E4 -- loading this address into ebx
cmp [eax+ecx],ebx -- eax+ecx (0000601C,027E67C8 respectively) cmp ebx
je 02940024 -- jumps to "pop ebx" if equal
mov [eax+ecx],dl -- otherwise runs this line
pop ebx -- restores ebx to original value
ret

For some reason, the 3rd line returns false (ZF = 0) as shown in the attached picture. But 0000601C + 027E67C8 does in fact equal 027EC7E4, so idk why it's returning false. I assume it's because it's comparing the value stored at 027EC7E4 rather than the address, but if that's the case, then how do I get it to compare the actual address rather than the value at the address?

What I'm trying to do:
I'm trying to prevent gold from changing in Final Fantasy 1 (FF1). I've located gold's value to be stored at 027EC7E4 (4 bytes). I searched for which piece of code writes to this address and Cheat Engine (CE) returned "fceux.exe+84C76" which states "mov [eax+ecx],dl".

When I checked what addresses that piece of code writes to, it returned several other addresses as well. This means that I need to make sure to only change the code if it's writing to 027EC7E4. So I wrote the aforementioned code (slightly modified to keep things simple) to check if the code is being written to 027EC7E4 prior to skipping "move [eax+eac],dl".



Untitled.jpg
 Description:
 Filesize:  344.88 KB
 Viewed:  3042 Time(s)

Untitled.jpg


Back to top
View user's profile Send private message
OldCheatEngineUser
Whateven rank
Reputation: 20

Joined: 01 Feb 2016
Posts: 1586

PostPosted: Tue Oct 23, 2018 10:58 am    Post subject: Reply with quote

Code:
push ebx
mov ebx,eax
add ebx,ecx
cmp ebx, "with your address"


Code:
push ebx
lea ebx,[eax+ecx]
cmp ebx, "with your address"


Code:
... some other methods ...

dont forget to pop ebx

Outlivinglife wrote:
When I checked what addresses that piece of code writes to, it returned several other addresses as well.

you can compare registers, addresses, data, flags .. etc.

_________________
About Me;
I Use CE Since Version 1.X, And Still Learning How To Use It Well!
Jul 26, 2020
STN wrote:
i am a sweetheart.
Back to top
View user's profile Send private message Visit poster's website
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