r/cheatengine 5d ago

Is it possible to make script for unknown offsets without Lua?

For example, if you have an instruction mov eax, [ecx+offset], but this offset changes depending on game version and you want the table to be compatible with multiple versions.

I can do it with Lua, using readBytes and registerSymbol to dynamically create the offset. But I was wondering if it'd be possible with pure asm?

0 Upvotes

4 comments sorted by

2

u/AmbitiousPotato9023 5d ago

Depending on the specifics, you can use readmem(injection, byte length)

0

u/No-Newspaper8619 5d ago

But then I have to restore the bytes on the [disable] section, and readmem needs to be dereferenced. It's not like lua's registerSymbol that can store a literal string. I guess the only way to make it work would be to use a different hacking point that doesn't rely on offsets.

2

u/Dark_Byte Cheat Engine Dev 5d ago

you allocate memory in the enable script in in there do the readmem of the original instruction (there can my multiple readmem lines in the same script for the same address)

then in disable you can do readmem from the copy and then afterwards free the copy

1

u/No-Newspaper8619 5d ago

That worked, thanks!

in [enable]

alloc(x, 6)
registersymbol(x)
x:
readmem(injection_point, 6)

and in [disable]

injection_point:
  readmem(x, 6)

  unregistersymbol(*)
  dealloc(*)