[Help] Using Address pointer in symbol as a new label?

Anything Cheat Engine related, bugs, suggestions, helping others, etc..
Post Reply
IcyPurpose99
Expert Cheater
Expert Cheater
Posts: 470
Joined: Fri Mar 03, 2017 6:04 pm
Reputation: 16

[Help] Using Address pointer in symbol as a new label?

Post by IcyPurpose99 »

Lets say I grab an address from an instruction that leads to the exact location of a dynamic inventory storage that I can later null out with DB 00 00 00 00 or add my own sequence of default items in bytes. The address is stored in inventory, but to gain access to the exact address I need to use [inventory]. Using it in the table is fine and dandy, but wasn't there a way to do this in assembler? Why does this not work as simple as:

Code: Select all

[inventory]:
db 00 00 00 00

Code: Select all

label(code)
label(return)

label(inventory)
registersymbol(inventory)

newmem:

code:
  mov ecx,rdi
  add ecx,38A10
  mov [inventory],ecx
  mov ecx,[rdi+000000A0]
  jmp return

inventory:
  db 0

gGiveAllItems:
  jmp newmem
  nop
return:

registersymbol(gGiveAllItems)
What is the best way going about this, or did I over complicate it and there is an easy way?

TimFun13
Expert Cheater
Expert Cheater
Posts: 1353
Joined: Fri Mar 03, 2017 12:31 am
Reputation: 7

Re: [Help] Using Address pointer in symbol as a new label?

Post by TimFun13 »

It's just the way CE works, and it's not ASM. You can use lua to do it, but it needs to be allocated in another script. You could just nest a "reset" script under the main one.

Also if "inventory" is to be an address (which you use it that way) you should make it 64 bits. It would probable work fine but if you only allocate 1 byte, you can run into problems.

Code: Select all

label(code)
label(return)

label(inventory)
registersymbol(inventory)

newmem:

code:
  mov rcx,rdi
  add rcx,38A10
  mov [inventory],rcx
  mov ecx,[rdi+000000A0]
  jmp return

inventory:
  dq 0 // "data quad" is 64 bits

gGiveAllItems:
  jmp newmem
  nop
return:

registersymbol(gGiveAllItems)

Code: Select all

{$lua}
[ENABLE]
if syntaxcheck then return end
writeInteger('[inventory]', 0) // this will write a 32 bit integer to the address stored at "inventory".
[DISABLE]

User avatar
SunBeam
Administration
Administration
Posts: 4932
Joined: Sun Feb 04, 2018 7:16 pm
Reputation: 4630

Re: [Help] Using Address pointer in symbol as a new label?

Post by SunBeam »

People have this convoluted impression that CE Lua is something scary. All it takes is practice and doing everything you were used to do in ASM.. in Lua. Or even combine the two. Exit your "comfort" zone. See it as learning something new. If you wanna stay at that same boring knowledge level, so be it :P

Post Reply

Who is online

Users browsing this forum: No registered users