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 


Extracting Address From Opcode

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

Joined: 23 Sep 2022
Posts: 9

PostPosted: Thu Aug 24, 2023 1:19 am    Post subject: Extracting Address From Opcode Reply with quote

How to extract the address that accessing the opcode using auto assemble?
I have the opcode that are accessed by playerAltitude address that I want to extract to cheat table.

The opcode goes like :
mov [ebx+0000011C],eax

The aob for that opcode is :
89 83 1C 01 00 00

The address that I want to extract is :
2455E7BC (as in the attached pic)

I already tried the code :
Code:
[ENABLE]
aobscan(altitude,89 83 1C 01 00 00)
alloc(newmem,$1000)

label(code)
label(return)
label(altitude_save)
label(altitude_ptr)

newmem:

code:

altitude_save:
readmem(altitude,6)
push ebx
db 48 81 C3
readmem(ebx+4,4)
mov [altitude_ptr],ebx
pop ebx
jmp return

altitude_ptr:
dq 0

altitude:
jmp code
nop
nop
nop

return:
registersymbol(altitude)
registersymbol(altitude_save)
registersymbol(altitude_ptr)

[DISABLE]
altitude:
readmem(altitude_save, 6)
unregistersymbol(altitude)
unregistersymbol(altitude_save)
unregistersymbol(altitude_ptr)
dealloc(newmem)


But it didn't work, maybe that's not the code that should be used or something, I don't really know.
Anyone can help me?

[EDIT]
forgot to add that I want to add address manually by writing "altitude" and it has the value of my targeted address.



Capture.PNG
 Description:
 Filesize:  31.39 KB
 Viewed:  2506 Time(s)

Capture.PNG


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

Joined: 06 Jul 2014
Posts: 4694

PostPosted: Thu Aug 24, 2023 10:07 am    Post subject: Reply with quote

That code is accessing two different addresses, which is very unfortunate. See step 9 of the CE tutorial. If you can find a different injection point that doesn't access multiple addresses, use that.

You should use an AA template for your code injection. Don't modify parts of the AA template that you don't understand.
In that script you posted, the amount of `nop`s at the injection point is wrong.
I think you're using the first `readmem` to execute the original code. Don't do that- just keep what the template wrote. If you're in some situation where that's impossible, use `reassemble(address)` instead of `readmem(address, count)`.
The second `readmem` is evaluated when the script is assembled and not when the code is run. Use basic instructions like `mov` to move data at runtime.
Code:
newmem:
code:
  mov [altitude_ptr],ebx
  mov [ebx+11C],eax
  jmp return

altitude_ptr:
  dd 0  // 32-bit process: addresses are 4 bytes, not 8

Search for a tutorial on "injection copy" for more information.

nemesis9 wrote:
forgot to add that I want to add address manually by writing "altitude" and it has the value of my targeted address.
That's impractical. Symbols are in CE's process- you can't register symbols from the game's process. You'd have to use a {$luacode} block at the injection point to go into CE and re-register the symbol every single time the original code gets executed.
It's far better to just use a pointer instead. Add address, check the pointer box, base address "altitude_ptr", only offset is 11C

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

Joined: 23 Sep 2022
Posts: 9

PostPosted: Thu Aug 24, 2023 12:32 pm    Post subject: Reply with quote

Thank you for the response and reference.

I managed to get the ebx assigned as pAltitude, the pAltitude address is close to what I wanted.
The Pointer pAltitude in cheat table is pointing to npc altitude address instead of my player altitude in Address I wanted.

Since it's shared opcode, how do I find the offset of which one is my player address.
And how do I insert the offset in (Change Address) if I found the offset.



Capture2.PNG
 Description:
 Filesize:  51.74 KB
 Viewed:  2479 Time(s)

Capture2.PNG


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 Discussions 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