Skip to content

Commit

Permalink
fix the assembler from handling [reg,reg*x] as a symbol when debuggin…
Browse files Browse the repository at this point in the history
…g has put the symbol in the lua state
  • Loading branch information
cheat-engine committed Oct 24, 2022
1 parent e8c0686 commit bba0d4e
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions Cheat Engine/Assemblerunit.pas
Original file line number Diff line number Diff line change
Expand Up @@ -3597,6 +3597,8 @@ function rewrite(var token:string): boolean;
haserror: boolean;
inQuote: boolean;
quotechar: char;

split: array of string;
begin
if length(token)=0 then exit(false); //empty string

Expand Down Expand Up @@ -3689,18 +3691,22 @@ function rewrite(var token:string): boolean;
val('$'+tokens[i],j,err);
if (err<>0) and (getreg(tokens[i],false)=-1) and (isReservedToken(tokens[i])=false) then //not a hexadecimal value and not a register
begin
j:=pos('*', tokens[i]);
if j>0 then //getreg failed, but could be it's the 'other' one
begin
split:=tokens[i].Split('*');
if (length(split)=2) and
(
(getreg(trim(split[0]),false)<>-1) or
(getreg(trim(split[1]),false)<>-1)
) then continue;
end;

temp:=inttohex(symhandler.getaddressfromname(tokens[i], true, haserror,nil),8);
if not haserror then
tokens[i]:=temp //can be rewritten as a hexadecimal
else
begin
j:=pos('*', tokens[i]);
if j>0 then //getreg failed, but could be it's the 'other' one
begin
if (length(tokens[i])>j) and (copy(tokens[i],j+1,1)[1] in ['2','4','8']) then
continue; //reg*2 / *3, /*4
end;

if (i<length(tokens)-1) then
begin
//perhaps it can be concatenated with the next one
Expand Down

0 comments on commit bba0d4e

Please sign in to comment.