Compare big address in assembly

Anything Cheat Engine related, bugs, suggestions, helping others, etc..
Post Reply
User avatar
nihilism
Cheater
Cheater
Posts: 28
Joined: Thu Mar 29, 2018 1:28 am
Reputation: 1

Compare big address in assembly

Post by nihilism » Tue Nov 26, 2019 12:35 am

Using the new CE feature, it found a commonality and I would like to compare it out in a script. However, seems that the value is large or my syntax is incorrect.

Any help to put me in the right direction would be appreciated :geek:

Image

cmp rcx,7FF477AA1240
Image

User avatar
nihilism
Cheater
Cheater
Posts: 28
Joined: Thu Mar 29, 2018 1:28 am
Reputation: 1

Re: Compare big address in assembly

Post by nihilism » Tue Nov 26, 2019 1:09 am

After some trial and error, was able to get it working by storing big value some place in memory and referencing that in the compare.

If there is an easier/more efficient method for doing this, please still let me know.

compareaddy:
dq 7FF477AA1240

newmem:
cmp rax,1
je incItems
cmp rcx,[compareaddy]
je health
jne code

Eric
Hall of Famer
Hall of Famer
Posts: 115
Joined: Thu Mar 02, 2017 11:01 pm
Reputation: 47

Re: Compare big address in assembly

Post by Eric » Tue Nov 26, 2019 9:05 am

You could use a mov reg64,value64 and then cmp that but takes one more instruction (and more if you need to restore the register)

also, a value like that will likely only work for you on that one run. See if there is a way to figure out what that value really is and then deal with it accordingly

e.g if 7FF477AA1240 is an address inside a module, then the 7FF477AA part can change next run. But the 1240 part will be the same, so you could do a cmp cx,1240 and have the same effect and will work between different runs/systems

User avatar
SunBeam
Administration
Administration
Posts: 3197
Joined: Sun Feb 04, 2018 7:16 pm
Reputation: 1595

Re: Compare big address in assembly

Post by SunBeam » Tue Dec 10, 2019 5:05 pm

^ ..as long as the .exe is the same :) Enphasizing it as people often confuse what you explained with 'working across game updates'.

User avatar
Akhent
Cheater
Cheater
Posts: 26
Joined: Sun Dec 08, 2019 9:34 am
Reputation: 11

Re: Compare big address in assembly

Post by Akhent » Wed Jan 08, 2020 12:07 am

for compare where the problems on my script

push rdi // or rcx // or rax
mov rdi,[rbx+78]
mov rdi,[rdi+c40]
cmp [rdi+598],#0
pop rdi
jne code

always display "fatal error" on game :( :( :( :oops: :cry:

User avatar
Akhent
Cheater
Cheater
Posts: 26
Joined: Sun Dec 08, 2019 9:34 am
Reputation: 11

Re: Compare big address in assembly

Post by Akhent » Wed Jan 08, 2020 12:17 am

Akhent wrote:
Wed Jan 08, 2020 12:07 am
for compare where the problems on my script

push rdi // or rcx // or rax
mov rdi,[rbx+78]
mov rdi,[rdi+c40]
cmp [rdi+598],#0
pop rdi
jne code

always display "fatal error" on game :( :( :( :oops: :cry:
this the full script,, if whitout compare the script will run perfectly but enemy have same effect
newmem:

push rdi
mov rdi,[rbx+78]
mov rdi,[rdi+c40]
cmp [rdi+598],#0
pop rdi
jne code

mov eax,[rsi+000007ac] //7ac //f14 (max health) to eax
cvtsi2ss xmm0,eax //max health to health

code:
movss [rsi+00000AB8],xmm0 //originalcode
jmp return

User avatar
TheyCallMeTim13
Administration
Administration
Posts: 1715
Joined: Fri Mar 03, 2017 12:31 am
Reputation: 676

Re: Compare big address in assembly

Post by TheyCallMeTim13 » Wed Jan 08, 2020 2:03 am

The fatal error is likely due to rax/eax not being saved and restored, or because rbx+78 or one of the others used isn't always an address. As far as rax/eax goes, you don't need to use it at all, just use that xmm0 (i.e. movss xmm0,[rsi+7AC]). And for the address you read from, put in a check.

Code: Select all

push rdi
mov rdi,[rbx+78]
test rdi,rdi
jz code
mov rdi,[rdi+C40]
test rdi,rdi
jz code
cmp [rdi+598],0
jne code

movss xmm0,[rsi+7AC]

code:
pop rdi
movss [rsi+00000AB8],xmm0 //originalcode
jmp return
CE wiki - Tutorials CE wiki - Auto Assembler Basics - CE wiki - Lua Basics If it's not a Personal Message don't PM me, use the forum. I ignore PMs that should be asked on the forum.

User avatar
Akhent
Cheater
Cheater
Posts: 26
Joined: Sun Dec 08, 2019 9:34 am
Reputation: 11

Re: Compare big address in assembly

Post by Akhent » Wed Jan 08, 2020 8:14 am

TheyCallMeTim13 wrote:
Wed Jan 08, 2020 2:03 am
The fatal error is likely due to rax/eax not being saved and restored, or because rbx+78 or one of the others used isn't always an address. As far as rax/eax goes, you don't need to use it at all, just use that xmm0 (i.e. movss xmm0,[rsi+7AC]). And for the address you read from, put in a check.

Code: Select all

push rdi
mov rdi,[rbx+78]
test rdi,rdi
jz code
mov rdi,[rdi+C40]
test rdi,rdi
jz code
cmp [rdi+598],0
jne code

movss xmm0,[rsi+7AC]

code:
pop rdi
movss [rsi+00000AB8],xmm0 //originalcode
jmp return
thank's I had try with your script but have the same result, I have try and error and I figure out the problem on jump command, maybe too far (I don't know exactly) the address memory from the original code :cry: :cry: :cry: because if I disable "//jne code" from my first script it's gonna be ok

User avatar
Akhent
Cheater
Cheater
Posts: 26
Joined: Sun Dec 08, 2019 9:34 am
Reputation: 11

Re: Compare big address in assembly

Post by Akhent » Wed Jan 08, 2020 8:35 am

label(originalcode)
label(return)
label(healmeplease)

newmem:

push rdi
mov rdi,[rbx+78]
mov rdi,[rdi+c40]
cmp [rdi+598],#0
pop rdi
je healmeplease

originalcode:

movss [rsi+AB8],xmm0 //originalcode
jmp return

healmeplease:

cvtsi2ss xmm0,[rsi+7ac] //max health to health
movss [rsi+AB8],xmm0
jmp return

fix,,,, :D :D :D but have a new problem if heal team again and again, fatal error :oops: :oops: :lol: :lol:

TheByteSize
Fearless Donors
Fearless Donors
Posts: 212
Joined: Sat Mar 04, 2017 7:28 am
Reputation: 106

Re: Compare big address in assembly

Post by TheByteSize » Wed Jan 08, 2020 5:39 pm

It means that at some point the:
mov rdi,[rbx+78]
or
mov rdi,[rdi+c40]

doesn't contain valid address.

Bloodybone
Table Makers
Table Makers
Posts: 318
Joined: Thu Aug 03, 2017 6:19 am
Reputation: 96

Re: Compare big address in assembly

Post by Bloodybone » Thu Jan 09, 2020 3:14 pm

Could you try out this and tell me what happens:

Code: Select all

label(originalcode)
label(return)
label(healmeplease)

newmem:
{$try}
push rdi
mov rdi,[rbx+78]
mov rdi,[rdi+c40]
cmp [rdi+598],#0
jne originalcode

healmeplease:
cvtsi2ss xmm0,[rsi+7ac] //max health to health
movss [rsi+AB8],xmm0
pop rdi
jmp return

{$except}
push rbp
mov rbp,rsp
and spl,F0
sub rsp,70
mov [rsp+20],rax
mov [rsp+28],rcx
mov [rsp+30],rdx
mov [rsp+38],r8
mov [rsp+40],r9
mov [rsp+48],r10
mov [rsp+50],r11
mov dword ptr [rsp+58],'Exce'
mov dword ptr [rsp+5C],'ptio'
mov word ptr [rsp+60],006E
xor rcx,rcx
lea rdx,[rsp+58]
xor r8,r8
xor r9,r9
call user32.MessageBoxA
mov r11,[rsp+50]
mov r10,[rsp+48]
mov r9,[rsp+40]
mov r8,[rsp+38]
mov rdx,[rsp+30]
mov rcx,[rsp+28]
mov rax,[rsp+20]
mov rsp,rbp
pop rbp

originalcode:
movss [rsi+AB8],xmm0 //originalcode
pop rdi
jmp return

Post Reply

Who is online

Users browsing this forum: No registered users