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 


how can you compare 2 registers for same address?

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

Joined: 16 Apr 2010
Posts: 121

PostPosted: Sun Sep 11, 2022 11:58 am    Post subject: how can you compare 2 registers for same address? Reply with quote

hello lords of the cheating world. I prey to you almighty lords.
i have a problem with compare (cmp) function. i have almost no experience in programming and coding and i ask for you cheat-gods to please provide me with full code.

i have 2 registers on same address and i would like to compare both of them and only then jump to my custom code.

for example:
Code:

cmp R5,20
cmp R10,50
jne originalcode


i know this is wrong as it does not help, but i have no knowldedge of how to make it work. i was told there is some failure and i should fix the code, but i don't know how. i'm here asking help from the cheat-gods who know it all.

all i need is for code to compare R5 to 20 and R10 to 50 and if both registers match, only then execute the custom code that comes below, otherwise jump to originalcode and skip custom code.

please fix my code for me and show me how is right way.
i was told i need another "jne" but where do i put it and where does it have to go?
i dont understand this. can someone please fix this part for me and show me what im doing wrong. thank you so much cheat gods. I hope to see your god-like working example.
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1055
Location: 0x90

PostPosted: Sun Sep 11, 2022 2:22 pm    Post subject: This post has 1 review(s) Reply with quote

As mentioned previously in your other thread you have to use conditional instructions to determine logic of which code to execute.
Code:

...
label(my_code)

newmem:
  cmp r5,20
  je my_code
  jmp originalcode

my_code:
  cmp r10,50
  jne originalcode
  // execute other code here
...
Back to top
View user's profile Send private message
mordax
Expert Cheater
Reputation: 1

Joined: 16 Apr 2010
Posts: 121

PostPosted: Tue Sep 13, 2022 8:26 am    Post subject: Reply with quote

LeFiXER wrote:
As mentioned previously in your other thread you have to use conditional instructions to determine logic of which code to execute.
Code:

...
label(my_code)

newmem:
  cmp r5,20
  je my_code
  jmp originalcode

my_code:
  cmp r10,50
  jne originalcode
  // execute other code here
...


thanks! this is exactly the kind of example I was looking for. i didn't understand where to jump and i was under the impression that two compares should be right next to eachother separated by just one jump.

edit: yes it works fine and now i fully understand why and how it works. i was basically right, i just didn't understand that i need to jump from label to label and its not possible to have 2 cmp under same label.
it's so much easier when people like you just give specific reply with no additional complications or nonsense added. +rep


however i didnt get my cheat to work as it seems like some other addresses still have same register values. i'm out of options now as there are only 2 registers that are static. rest are dynamic.
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