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

Anything Cheat Engine related, bugs, suggestions, helping others, etc..
Post Reply
User avatar
Marcus101RR
Table Makers
Table Makers
Posts: 420
Joined: Fri Mar 03, 2017 6:04 pm
Reputation: 359

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

Post by Marcus101RR »

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?

User avatar
TheyCallMeTim13
Administration
Administration
Posts: 1542
Joined: Fri Mar 03, 2017 12:31 am
Reputation: 809

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

Post by TheyCallMeTim13 »

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: 3443
Joined: Sun Feb 04, 2018 7:16 pm
Reputation: 2609

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: miriania