Page 1 of 1

Assign label to a static address?

Posted: Sun Nov 28, 2021 7:30 pm
by andiabrudan
Hey all,
I've got a script I'm working on, and I need to compare a register with a static address to determine whether to execute my code or the original.
But I don't want to compute this static address every time the check is performed. How do I assign a label to it?

To give you more details, the address looks something like:
[["game.exe" + 0x44] + 0x23] + 0x588
(well, I say it's a static address, but it's more of a pointer with a static address and known offsets)

I'm pretty sure you can do something like this in cheat engine:

Code: Select all

[Enable]
label(my_address)
[["game.exe" + 0x44] + 0x23] + 0x588:
    my_address:

[Disable]
Or something similar. Basically, I just want to tell AutoAssembler "I've got this specific address I know. Please put a label here"
What's the correct syntax for this?

Re: Assign label to a static address?

Posted: Sun Nov 28, 2021 7:51 pm
by LeFiXER
You can use registersymbol(symbolname).

Re: Assign label to a static address?

Posted: Sun Nov 28, 2021 11:40 pm
by andiabrudan
LeFiXER wrote:
Sun Nov 28, 2021 7:51 pm
You can use registersymbol(symbolname).
Sorry, LeFiXER, that wasn't what I was looking for.

But I did figure out the issue.
My syntax was correct, but there was another issue causing the script not to run.
You see, I was doing something like:

Code: Select all

[Enable]
alloc(space, 64)
label(my_address)

space:
  cmp rax, my_address

"game.exe" + 0x123456:
  jmp space

[["game.exe" + 0x44] + 0x23] + 0x588:
    my_address:

[Disable]
dealloc(space)
But for some reason, AutoAssembly does not allow you to compare straight with a label.
It does, however, allow you to move the address of the label into a register and use that.

Code: Select all

// === Will not run ===
space:
  cmp rax, my_address

// === Runs like a charm ===
space:
  mov rbx, my_address
  cmp rax, rbx
Sorry that I didn't post more code; that probably would have helped people point out the issue.
But I was convinced the trouble was with my syntax, not some arbitrarily obscure rule AA has regarding labels and compares.
Just a final thought:
AA will not raise any compilation errors if you try the erroneous code out. When you try to run it, though, it just won't turn on.

Re: Assign label to a static address?

Posted: Mon Nov 29, 2021 10:58 am
by LeFiXER
andiabrudan wrote:
Sun Nov 28, 2021 11:40 pm
But for some reason, AutoAssembly does not allow you to compare straight with a label.
It does, however, allow you to move the address of the label into a register and use that.

Code: Select all

// === Will not run ===
space:
  cmp rax, my_address

// === Runs like a charm ===
space:
  mov rbx, my_address
  cmp rax, rbx
Sorry that I didn't post more code; that probably would have helped people point out the issue.
But I was convinced the trouble was with my syntax, not some arbitrarily obscure rule AA has regarding labels and compares.
Just a final thought:
AA will not raise any compilation errors if you try the erroneous code out. When you try to run it, though, it just won't turn on.
The reason it won't let you compare directly with a label is because a label is just a symbol within the script. It allows you manage code blocks more easily than having arbitrary addresses for labels. registerSymbol is used to define a code block/allocated memory for use in other scripts/entries within the table. Nevertheless, I'm glad you resolved your issue :).