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 


JE instruction not working with [returnAddress]

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

Joined: 11 Oct 2023
Posts: 4
Location: Finland

PostPosted: Wed Oct 11, 2023 9:25 am    Post subject: JE instruction not working with [returnAddress] Reply with quote

jmp [returnAddress] works just fine but je [returnAddress] doesn't compile. This doesn't make any sense to me why this wouldn't compile to asm.

"(Error in line 29 (je [ffffffffffffffff]) :This instruction can't be compiled)"

Code:
cmp al,1
je [returnAddress]
jmp [returnAddress]
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

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

PostPosted: Wed Oct 11, 2023 9:34 am    Post subject: Reply with quote

I believe the issue lies with the use of the square brackets.
Code:

cmp al,1
je returnAddress
jmp returnAddress
Back to top
View user's profile Send private message
Sestain
How do I cheat?
Reputation: 0

Joined: 11 Oct 2023
Posts: 4
Location: Finland

PostPosted: Wed Oct 11, 2023 9:41 am    Post subject: Reply with quote

That's not a fix since it will jump to the address where returnAddress is located; I want to jump to the address that returnAddress is holding instead.
Like I said on my first post, jmp [returnAddress] works but je doesn't.
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

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

PostPosted: Wed Oct 11, 2023 9:52 am    Post subject: Reply with quote

I'm pretty bad at explaining things, but ASM doesn't work like that.
Code:

cmp al,1
push rbx
mov rbx,[returnAddress]
je rbx
pop rbx


Here we preserve what's held in the RBX register, then we copy what is held in [returnAddress] into RBX, then jump to the address held in RBX if al = 1 then restore the RBX register.

Also, having the compare is negligent in this case because the following instruction means to jump to [returnAddress] anyway so even if al was 0 it would jump.
Back to top
View user's profile Send private message
Sestain
How do I cheat?
Reputation: 0

Joined: 11 Oct 2023
Posts: 4
Location: Finland

PostPosted: Wed Oct 11, 2023 10:00 am    Post subject: Reply with quote

I know that asm code is bad but it was shortened version of original code.
Here's a better example of my code.
Code:

glowChecks:
  cmp byte ptr [rdi+298],5 // Team check
  je [returnAddress]

  cmp byte ptr [rdi+280],74 // Viewmodel check
  je viewModel

  jmp [returnAddress]

viewModel:
  cmp byte ptr [glowOptions+2],1
  je enableGlow
  jmp [returnAddress]

glowSet:
  push rbx
  lea rbx,[glowSet+1C]
  mov [returnAddress],rbx
  pop rbx
  mov byte ptr [glowOptions],0
  jmp glowChecks
  reassemble(aobGlowSet)
  jmp exitGlowSet

aobGlowSet:
  jmp glowSet
  nop 2

exitGlowSet:
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4702

PostPosted: Wed Oct 11, 2023 10:07 am    Post subject: Reply with quote

There is no `jcc r/m32` instruction. `jcc` can only take an immediate operand as a relative displacement.

Use a jcc and two `jmp` instructions instead.
Code:
code:
  cmp al,1
  je foo
  jmp [returnAddress1]
foo:
  jmp [returnAddress2]

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

Joined: 11 Oct 2023
Posts: 4
Location: Finland

PostPosted: Wed Oct 11, 2023 10:23 am    Post subject: Reply with quote

Thanks for replies and help.
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