Assign label to a static address?

Anything Cheat Engine related, bugs, suggestions, helping others, etc..
Post Reply
andiabrudan
Novice Cheater
Novice Cheater
Posts: 16
Joined: Thu Dec 03, 2020 5:35 pm
Reputation: 10

Assign label to a static address?

Post 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?

User avatar
LeFiXER
LeFixer
LeFixer
Posts: 478
Joined: Wed Mar 24, 2021 9:35 am
Reputation: 242

Re: Assign label to a static address?

Post by LeFiXER »

You can use registersymbol(symbolname).

andiabrudan
Novice Cheater
Novice Cheater
Posts: 16
Joined: Thu Dec 03, 2020 5:35 pm
Reputation: 10

Re: Assign label to a static address?

Post 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.

User avatar
LeFiXER
LeFixer
LeFixer
Posts: 478
Joined: Wed Mar 24, 2021 9:35 am
Reputation: 242

Re: Assign label to a static address?

Post 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 :).

Post Reply

Who is online

Users browsing this forum: henee21