|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Kamd Cheater Reputation: 1
Joined: 02 May 2018 Posts: 28
|
Posted: Sun Sep 01, 2019 4:42 am Post subject: Compare RAX to an existing address in ASM? |
|
|
I am pretty new to Assembly, so please try explain easily.
Basically, I am working with a shared opcode, for example, a HP damage opcode. I need to make this damage opcode to only effect things that are not writing to my player (health) address.
I already have an assembly script that locates my player structure, and +10 is the offset to my health.
To determine if the damage opcode is writing to my player's health address, I want to compare RAX (write address) to my already-found health address.
Example script:
NOTE: _player is start of player struct defined in the prior script (simplified):
Code: | ...
registersymbol(_player)
...
customCode:
...
mov [_player],rdx
|
So _player+10 is address of my health.
Code: | hpWrite:
cmp [rax],GetAddress(_player+10) // check if write address is player health address
jne runNormalCode // if rax != playerHpAddress we run the normal damage code
// We didn't jump so this is our player's health. Don't do anything
|
|
|
Back to top |
|
|
sbryzl Master Cheater Reputation: 6
Joined: 25 Jul 2016 Posts: 252
|
Posted: Sun Sep 01, 2019 4:26 pm Post subject: |
|
|
I'm not too certain about your situation but I think you can just preserve a register, load your address, add 10 and compare it.
Code: | push rcx
mov rcx,[_player]
add rcx,10
cmp rax,rcx
pop rcx
jne runNormalCode
|
|
|
Back to top |
|
|
|
|
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
|
|