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 


How to execute different code on different assert?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
mindoff
Advanced Cheater
Reputation: 0

Joined: 12 Jun 2016
Posts: 96

PostPosted: Thu Jan 19, 2017 7:46 am    Post subject: How to execute different code on different assert? Reply with quote

sometimes Unity game,function with a lot of code,let's say 200 line for C# may be 500 or more for assembly language

for example

define(NoDashCooldown2_Entry, "RaycastCharacterController2D:MoveInXDirection"+1440)

the code i am looking for maybe at 1440 offset of the function this time.
next time it maybe 16f4

luckily,the varation is predictable,means it only vary 2 or 3.
So i am thinking is it possibly to judge


define(A_bytes,11 22 33 44)
assert(A_Entry, A_bytes)

define(B_bytes, 66 77 88 99)
assert(B_Entry, B_bytes)

if the assert A pass I will execute codeA
if it fail,I will try assert B and if B pass execute codeB
so does C and D and that...

Can CE auto assemble do this?If so,how?any example?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25807
Location: The netherlands

PostPosted: Thu Jan 19, 2017 8:51 am    Post subject: Reply with quote

you can do something like this in auto assemble scripts: (fill in a/b_address* yourself, or use registered symbols)

Code:

{$lua}
if autoAssemble([[assert(a_address,11 22 33 44)]]) then
  return [[define(correctaddress,a_address)]]
end

if autoAssemble([[assert(a_address2,11 22 33 44)]]) then
  return [[define(correctaddress,a_address2)]]
end

if autoAssemble([[assert(a_address3,11 22 33 44)]]) then
  return [[define(correctaddress,a_address3)]]
end

error('No correctaddress found')

if autoAssemble([[assert(b_address,66 77 88 99)]]) then
  return [[define(correctaddress2,b_address)]]
end

if autoAssemble([[assert(b_address2,66 77 88 99)]]) then
  return [[define(correctaddress2,b_address2)]]
end

if autoAssemble([[assert(b_address3,66 77 88 99)]]) then
  return [[define(correctaddress2,b_address3)]]
end

error('No correctaddress2 found')
{$asm}
correctaddress:
db 90 90 90 90

correctaddress2:
db 00 00 00 00



_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
mindoff
Advanced Cheater
Reputation: 0

Joined: 12 Jun 2016
Posts: 96

PostPosted: Fri Jan 20, 2017 1:33 am    Post subject: Reply with quote

er,how to use asm variable in lua?
I try to write like below,can't compile...

Code:

{$lua}

LaunchMonoDataCollector()

mono_symbolLookupCallback("RaycastCharacterController2D:MoveInXDirection")


{$asm}
define(NoDashCooldown_Entry1, "RaycastCharacterController2D:MoveInXDirection"+14a8)
define(NoDashCooldown_Entry2, "RaycastCharacterController2D:MoveInXDirection"+16f4)


define(NoDashCooldown_bytes, F3 0F 10 87 FC 00 00 00)

{$lua}
if autoAssemble([[assert(NoDashCooldown_Entry1, NoDashCooldown_bytes)]]) then
  return [[define(NoDashCooldown_addr, NoDashCooldown_Entry1)]]
end

if autoAssemble([[assert(NoDashCooldown_Entry2,NoDashCooldown_bytes)]]) then
  return [[define(NoDashCooldown_addr, NoDashCooldown_Entry2)]]
end

error('No correctaddress found')

[ENABLE]
globalalloc(NoDashCooldown_Code,0x1000)

NoDashCooldown_Code:
mov [rdi+000000FC],0
movss xmm0,[rdi+000000FC]


jmp NoDashCooldown_Exit

NoDashCooldown_addr:
jmp NoDashCooldown_Code
db 90 90 90

NoDashCooldown_Exit:

[DISABLE]
NoDashCooldown_addr:
db NoDashCooldown_bytes
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25807
Location: The netherlands

PostPosted: Fri Jan 20, 2017 5:39 am    Post subject: Reply with quote

you don't, the lua sections are parsed before auto assembler runs



use things like
Code:
 
{$asm}
define(NoDashCooldown_Entry1, "RaycastCharacterController2D:MoveInXDirection"+14a8)

{$lua}

if autoAssemble([[
define(NoDashCooldown_Entry1, "RaycastCharacterController2D:MoveInXDirection"+14a8)


define(NoDashCooldown_bytes, F3 0F 10 87 FC 00 00 00)
assert(NoDashCooldown_Entry1, NoDashCooldown_bytes)
]]) then
  return [[define(NoDashCooldown_addr, NoDashCooldown_Entry1)]]
end



or just
Code:
 
if autoAssemble([["RaycastCharacterController2D:MoveInXDirection"+14a8, F3 0F 10 87 FC 00 00 00) then
return [[define(NoDashCooldown_addr,  "RaycastCharacterController2D:MoveInXDirection"+14a8]]
end

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping


Last edited by Dark Byte on Fri Jan 20, 2017 5:49 am; edited 3 times in total
Back to top
View user's profile Send private message MSN Messenger
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Fri Jan 20, 2017 5:41 am    Post subject: Reply with quote

Lua is executed before anything else. It doesn't know anything about what is inside "Asm" part(s).



Try this one:
Code:
{$lua}
LaunchMonoDataCollector()
mono_symbolLookupCallback("RaycastCharacterController2D:MoveInXDirection")
{$asm}

define(NoDashCooldown_bytes,F3 0F 10 87 FC 00 00 00)

[ENABLE]
define(NoDashCooldownRegion,"RaycastCharacterController2D:MoveInXDirection")
aobscanregion(NoDashCooldown_addr,NoDashCooldownRegion+14a8,NoDashCooldownRegion+1750,NoDashCooldown_bytes)
registersymbol(NoDashCooldown_addr)
globalalloc(NoDashCooldown_Code,4096)

NoDashCooldown_Code:
mov [rdi+000000FC],0
movss xmm0,[rdi+000000FC]
jmp NoDashCooldown_Exit

NoDashCooldown_addr:
jmp NoDashCooldown_Code
db 90 90 90
NoDashCooldown_Exit:

[DISABLE]
NoDashCooldown_addr:
db NoDashCooldown_bytes

unregistersymbol(NoDashCooldown_addr)


(you might extend NoDashCooldown_bytes so aobscanregion will get right address)

_________________
Back to top
View user's profile Send private message MSN Messenger
mindoff
Advanced Cheater
Reputation: 0

Joined: 12 Jun 2016
Posts: 96

PostPosted: Fri Jan 20, 2017 2:57 pm    Post subject: Reply with quote

Thank you guys.

OK,dark byte ways work now.

the aobscanregion function,I tried mgr.inz.Player code too.

Code:

{$lua}
LaunchMonoDataCollector()
mono_symbolLookupCallback("RaycastCharacterController2D:MoveInXDirection")
{$asm}


define(NoDashCooldown_bytes,F3 0F 10 87 FC 00 00 00 F3 0F 5A C0 F3 0F 10 8F DC 00 00 00)

[ENABLE]
define(NoDashCooldownRegion,"RaycastCharacterController2D:MoveInXDirection")
aobscanregion(NoDashCooldown_addr,NoDashCooldownRegion+14a8,NoDashCooldownRegion+1750,NoDashCooldown_bytes)
registersymbol(NoDashCooldown_addr)
globalalloc(NoDashCooldown_Code,4096)

NoDashCooldown_Code:
mov [rdi+000000FC],0
movss xmm0,[rdi+000000FC]
cvtss2sd xmm0,xmm0
movss xmm1,[rdi+000000DC]


jmp NoDashCooldown_Exit

NoDashCooldown_addr:
jmp NoDashCooldown_Code
db 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90
NoDashCooldown_Exit:

[DISABLE]
NoDashCooldown_addr:
db NoDashCooldown_bytes

unregistersymbol(NoDashCooldown_addr)


It compiles OK,and should be working,but not.I also try to extend from 0 to 2000,still nothing

what's wrong?
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Fri Jan 20, 2017 3:48 pm    Post subject: Reply with quote

Extend only for aobscanregion, not for everything. Also, I forgot that user defined keyword(s) doesn't work for aobscans. Fixed.

Code:

{$lua}
LaunchMonoDataCollector()
mono_symbolLookupCallback("RaycastCharacterController2D:MoveInXDirection")
{$asm}

define(NoDashCooldown_bytes,F3 0F 10 87 FC 00 00 00)

[ENABLE]
aobscanregion(NoDashCooldown_addr,"RaycastCharacterController2D:MoveInXDirection"+14a8,"RaycastCharacterController2D:MoveInXDirection"+1750,F3 0F 10 87 FC 00 00 00 F3 0F 5A C0 F3 0F 10 8F DC 00 00 00)
registersymbol(NoDashCooldown_addr)
globalalloc(NoDashCooldown_Code,4096)

NoDashCooldown_Code:
mov [rdi+000000FC],0
movss xmm0,[rdi+000000FC]
jmp NoDashCooldown_Exit

NoDashCooldown_addr:
jmp NoDashCooldown_Code
db 90 90 90
NoDashCooldown_Exit:

[DISABLE]
NoDashCooldown_addr:
db NoDashCooldown_bytes

unregistersymbol(NoDashCooldown_addr)

_________________
Back to top
View user's profile Send private message MSN Messenger
mindoff
Advanced Cheater
Reputation: 0

Joined: 12 Jun 2016
Posts: 96

PostPosted: Sat Jan 21, 2017 4:26 am    Post subject: Reply with quote

Thank you,now it works.
All problem solved Very Happy
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