How to save and restore constantly changing bytes in static address?

Anything Cheat Engine related, bugs, suggestions, helping others, etc..
Post Reply
MartaLabieniec
Expert Cheater
Expert Cheater
Posts: 312
Joined: Sat Oct 06, 2018 3:19 pm
Reputation: 137

How to save and restore constantly changing bytes in static address?

Post by MartaLabieniec »

Hello.

I have a problem with writing a script.

The problem is with saving and restoring bytes - I don't know how to do it.

I have static green address, but in this address the bytes are constantly changing after every restart the game so I can't make normal AOB or CJ script because after resetting the game, they bytes will be totally new and my script will not find anymore the bytes.

If anyone can share any example and explain it, i will be very thankful.

Best regards,
Marta

GreenHouse
Expert Cheater
Expert Cheater
Posts: 854
Joined: Fri Oct 12, 2018 10:25 pm
Reputation: 891

Re: How to save and restore constantly changing bytes in static address?

Post by GreenHouse »

You can always try (if you didn't already) to do an AOB of nearby bytes that are not changing.

MartaLabieniec
Expert Cheater
Expert Cheater
Posts: 312
Joined: Sat Oct 06, 2018 3:19 pm
Reputation: 137

Re: How to save and restore constantly changing bytes in static address?

Post by MartaLabieniec »

You don't understand. I must use the address with changing dynamic Bytes. I just wanna know how to save Bytes to restore them after disable script

User avatar
cfemen
RCE Fanatics
RCE Fanatics
Posts: 877
Joined: Fri Feb 15, 2019 5:45 pm
Reputation: 1509

Re: How to save and restore constantly changing bytes in static address?

Post by cfemen »

alloc some bytes+registersymbol and use [Link] to this symbol, also readMem this symbol at [DISABLE]

MartaLabieniec
Expert Cheater
Expert Cheater
Posts: 312
Joined: Sat Oct 06, 2018 3:19 pm
Reputation: 137

Re: How to save and restore constantly changing bytes in static address?

Post by MartaLabieniec »

Can you share any example? I need to see full script

User avatar
cfemen
RCE Fanatics
RCE Fanatics
Posts: 877
Joined: Fri Feb 15, 2019 5:45 pm
Reputation: 1509

Re: How to save and restore constantly changing bytes in static address?

Post by cfemen »

Code: Select all

aobscanmodule(aobSetEff,noita.exe,23 8D ?? ?? ?? ?? 3B C8) // should be unique
alloc(newmem,$1000)

alloc(origSet,6)
registersymbol(origSet)

label(code)
label(return)

origSet:
readmem(aobSetEff,6)

newmem:

code:
  db 23 8D
  readmem(aobSetEff+2,4)

  jmp return
aobSetEff:
  jmp newmem
  nop
return:
registersymbol(aobSetEff)

[DISABLE]

aobSetEff:
  readmem(origSet,6)

unregistersymbol(aobSetEff)
dealloc(newmem)
Example from one of my scripts.

MartaLabieniec
Expert Cheater
Expert Cheater
Posts: 312
Joined: Sat Oct 06, 2018 3:19 pm
Reputation: 137

Re: How to save and restore constantly changing bytes in static address?

Post by MartaLabieniec »

Ok, thanks for the example. I have 2 questions

You have in your example: aobscanmodule(aobSetEff,noita.exe,23 8D ?? ?? ?? ?? 3B C8)

and also you have: readmem(aobSetEff+2,4) <---- this means that it will save 4 BYTES in place in memory = aobscanmodule(aobSetEff,noita.exe,23 8D ?? ?? ?? ?? 3B C8) + 2 BYTES next? Am I right?

If you will have for example : readmem(aobSetEff+4F,23) <--- this will mean that it will save 23 BYTES in place in memory = aobscanmodule(aobSetEff,noita.exe,23 8D ?? ?? ?? ?? 3B C8) + 79 BYTES next? Am I right? [79 bytes because it is the same number like 4F in HEX)

User avatar
cfemen
RCE Fanatics
RCE Fanatics
Posts: 877
Joined: Fri Feb 15, 2019 5:45 pm
Reputation: 1509

Re: How to save and restore constantly changing bytes in static address?

Post by cfemen »

readmem(aobSetEff+2,4)

copies 4 bytes to the allocated mem to restore the stolen bytes

aobSetEff = 23
aobSetEff+1 = 8D
aobSetEff+2 = ?? - - - > first byte copie
Am I right? [79 bytes because it is the same number like 4F in HEX)
yes
definition of readMem:
readMem(Address, Size)

the first parameter is the address to start reading(and you can give an offset+) , second one is size.
aob_address+4F = start 79 bytes next to it yes.

Edit : readmem will only work if the address is absolute.
if its something like jump equal / jump not equal +5 then it wont work coz you are jumping in the allocated memory.
but for cases like this you can use [Link] or with an another aob to find the address to recreate the jump.

Post Reply

Who is online

Users browsing this forum: No registered users