Auto Assembler:TRY EXCEPT

From Cheat Engine
Revision as of 21:27, 17 November 2018 by Csimbi (talk | contribs) (First draft)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

CE 6.8 added {$try}/{$except} to auto assembler scripts.

Essentially, any code included in the {$try}/{$except} block will jump to the {$EXCEPT} part when any kind of exception happens within the block.

This means, you will want to put the code likely to result in an error between {$try} and {$except}.

Next, at the end of {$try} you will want to force a jump to a location indicating success; if you do not, then the code after {$except} will be executed.

Also note that the exception may break from any line, so make sure that you exception code can handle unexpected register values.


In this example, if any error occurs - for example, ecx is zero or ecx+10 is unreadable -, eax will be set to zero:

{$try}

mov eax,[ecx+10]

jmp short @f

{$except}

xor eax,eax

@@: