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 


Weird problem with "jump if equal".

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
SebaSX
How do I cheat?
Reputation: 0

Joined: 12 Mar 2012
Posts: 8

PostPosted: Thu May 12, 2016 7:40 am    Post subject: Weird problem with "jump if equal". Reply with quote

My script seems silly, because I created it for modding.
Is called only once, has a lock unlocked characters, then unlock previously locked.

Unfortunately, the script does not work properly.
Unlocks only SOME characters, and does not block all of previously unlocked.
Code:
label(lock)
label(code)
label(return)

newmem:
  cmp byte ptr [rax+14],01
  je lock
  mov byte ptr [rax+14],01
  jmp code

lock:
  mov byte ptr [rax+14],00


code:
  cmp byte ptr [rax+14],01  // Original code
  sete r9l                  // Original code
  jmp return                // Original code

Switch:
  jmp newmem
  nop
  nop
  nop
return:

But when all I want to unlock or lock, everything works perfect.
Code:
//label(lock)
label(code)
label(return)

newmem:
//  cmp byte ptr [rax+14],01
//  je lock
  mov byte ptr [rax+14],01
  jmp code

//lock:
//  mov byte ptr [rax+14],00


code:
  cmp byte ptr [rax+14],01  // Original code
  sete r9l                  // Original code
  jmp return                // Original code

Switch:
  jmp newmem
  nop
  nop
  nop
return:

If anyone knows why does not work, and how to fix it, I will be grateful for your help.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4702

PostPosted: Thu May 12, 2016 8:06 am    Post subject: Reply with quote

Are you sure 0 and 1 are the only values that byte can take on? Try comparing it with 0 instead and see if it's the same behavior:
Code:
newmem:
  cmp byte ptr [rax+14],00
  jne lock
  mov byte ptr [rax+14],01
  jmp code

_________________
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
SebaSX
How do I cheat?
Reputation: 0

Joined: 12 Mar 2012
Posts: 8

PostPosted: Thu May 12, 2016 8:55 am    Post subject: Reply with quote

There are three types of values: 00 - locked, 01 - unlocked, 03 - manager.
My full script looks like.
Code:
label(lock)
label(code)
label(return)

newmem:
  cmp byte ptr [rax+14],01
  je lock
  cmp byte ptr [rax+14],03
  je code
  mov byte ptr [rax+14],01
  jmp code

lock:
  mov byte ptr [rax+14],00


code:
  cmp byte ptr [rax+14],01  // Original code
  sete r9l                  // Original code
  jmp return                // Original code

Switch:
  jmp newmem
  nop
  nop
  nop
return:
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4702

PostPosted: Thu May 12, 2016 9:07 am    Post subject: Reply with quote

I'm not sure what "manager" means in the context of whether something is unlocked or not, but if any byte is 03, then it won't affect its state at all. That might be the reason why it's selective in what it changes.

Try this code:
Code:
label(lock)
label(code)
label(return)

newmem:
  xor byte ptr[rax+14],1
code:
  cmp byte ptr [rax+14],01  // Original code
  sete r9l                  // Original code
  jmp return                // Original code

Switch:
  jmp newmem
  nop
  nop
  nop
return:

_________________
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
SebaSX
How do I cheat?
Reputation: 0

Joined: 12 Mar 2012
Posts: 8

PostPosted: Thu May 12, 2016 9:33 am    Post subject: Reply with quote

I tried that before, not working, the same behavior.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4702

PostPosted: Thu May 12, 2016 9:44 am    Post subject: Reply with quote

Code:
newmem:
  and byte ptr[rax+14],1
  xor byte ptr[rax+14],1
code:
  cmp byte ptr [rax+14],01  // Original code
  sete r9l                  // Original code
  jmp return                // Original code

If that doesn't work, then set a breakpoint at your injection point and see what's going on, because we can't help you out any more than this with the information you've provided thus far.

_________________
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
SebaSX
How do I cheat?
Reputation: 0

Joined: 12 Mar 2012
Posts: 8

PostPosted: Thu May 12, 2016 12:30 pm    Post subject: Reply with quote

I do not have time for this, I did what I have to manually.
WWE 2K16 is bugged (more than I thought), but thanks for trying to help, I appreciate it!

Topic to close.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Thu May 12, 2016 12:35 pm    Post subject: Reply with quote

Are you sure that the instruction is only executed once? If you are wrong, your script will not work as intended.
Back to top
View user's profile Send private message
SebaSX
How do I cheat?
Reputation: 0

Joined: 12 Mar 2012
Posts: 8

PostPosted: Thu May 12, 2016 1:35 pm    Post subject: Reply with quote

I'm sure, I checked it with the "find out what addresses this instruction accesses", was some 100 addresses and all the counter once.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Thu May 12, 2016 1:45 pm    Post subject: Reply with quote

That's no good. There are better ways to check. For example, just because that instruction is only getting executed once, there may be another instruction that is writing to those values. Also, depending on when you performed the check and/or whether or not your script was activated during that time, you may not be seeing everything.

Add one of the problem values to your table and check to see what is writing to it after you have enabled your script. You will be able to see all of the instructions that are writing to that value, as well as the count number for each. This will show you what's really going on and whether or not your script needs adjusting.
Back to top
View user's profile Send private message
SebaSX
How do I cheat?
Reputation: 0

Joined: 12 Mar 2012
Posts: 8

PostPosted: Thu May 12, 2016 2:07 pm    Post subject: Reply with quote

It remains a secret of WWE 2K16, because I've already done what I needed and I do not intend to pursue.

Once again, thanks you all for trying to help.

Topic to close.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Thu May 12, 2016 2:12 pm    Post subject: Reply with quote

You couldn't have done everything if the problem still persists. There is no secret or bug about it.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine 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