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 


AA: assert() with a type-cast address don't work

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

Joined: 15 Mar 2012
Posts: 82

PostPosted: Tue Feb 06, 2024 1:33 pm    Post subject: AA: assert() with a type-cast address don't work Reply with quote

Hi.

For some reason assert() wont work with a type-cast address. If i use the type-cast string at disassembler or hex-browser it point/jump to the correct address. The aob at this address are also correct but the assert() check wont start the script.

Code:
assert(gameSymbol+5+(LONG)[gameSymbol+1]+0x47, 11 22 33 FF)
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4719

PostPosted: Tue Feb 06, 2024 2:08 pm    Post subject: Reply with quote

Parsing bug
Cheat Engine/autoassembler.pas:
Code:
if uppercase(copy(currentline,1,7))='ASSERT(' then //assert(address,aob)
begin
  if not syntaxcheckonly then
  begin
    a:=pos('(',currentline);
    b:=pos(',',currentline);
    c:=pos(')',currentline);
    if (a>0) and (b>0) and (c>0) then
    begin
      s1:=trim(copy(currentline,a+1,b-a-1));
      s2:=trim(copy(currentline,b+1,c-b-1));
      ...

Basically, CE looks for the first occurrence of ')' and assumes it's the end of `assert(...)`

Use {$lua} as a workaround:
Code:
{$lua}
if syntaxcheck then
  return 'define(address,0)'
end

local address = getAddress'gameSymbol+5+(LONG)[gameSymbol+1]+0x47'
return ('define(address,%X)'):format(address)
{$asm}
assert(address,12 34 56 78)

_________________
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
sir-gunny
Advanced Cheater
Reputation: 0

Joined: 15 Mar 2012
Posts: 82

PostPosted: Wed Feb 07, 2024 4:18 am    Post subject: Reply with quote

Ah, ok. Nice to know. Thanks.

Btw. Do the other functions then have the same bug? I tried it before with define(), but that didn't work either.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4719

PostPosted: Wed Feb 07, 2024 11:56 am    Post subject: Reply with quote

`define` is similar to a preprocessor macro substitution. It doesn't evaluate any addresses or anything- it just substitutes some text for some other text. Copying and pasting, if you will.

There's a weird interaction between `registersymbol` and `define` where it does have address semantics, but I'm pretty sure it's not helpful here.

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