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: 237
Joined: Sat Oct 06, 2018 3:19 pm
Reputation: 104

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

Post by MartaLabieniec » Sat Nov 30, 2019 12:03 am

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

User avatar
GreenHouse
GreenHouse!
GreenHouse!
Posts: 387
Joined: Fri Oct 12, 2018 10:25 pm
Reputation: 327

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

Post by GreenHouse » Sat Nov 30, 2019 12:38 am

You can always try (if you didn't already) to do an AOB of nearby bytes that are not changing.
Image
You don't like feeling like you're staring at the sun when using the FearlessRevolution forum? Use my dark theme for Stylish/Stylus. Guaranteed satisfaction.
https://userstyles.org/styles/171116/fe ... ution-dark

MartaLabieniec
Expert Cheater
Expert Cheater
Posts: 237
Joined: Sat Oct 06, 2018 3:19 pm
Reputation: 104

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

Post by MartaLabieniec » Sat Nov 30, 2019 1:29 am

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: 544
Joined: Fri Feb 15, 2019 5:45 pm
Reputation: 422

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

Post by cfemen » Sat Nov 30, 2019 2:16 am

alloc some bytes+registersymbol and use readMem to this symbol, also readMem this symbol at [DISABLE]
you like my tables and want to support me? my patreon :)

MartaLabieniec
Expert Cheater
Expert Cheater
Posts: 237
Joined: Sat Oct 06, 2018 3:19 pm
Reputation: 104

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

Post by MartaLabieniec » Sat Nov 30, 2019 6:10 am

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

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

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

Post by cfemen » Sat Nov 30, 2019 11:18 am

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.
you like my tables and want to support me? my patreon :)

MartaLabieniec
Expert Cheater
Expert Cheater
Posts: 237
Joined: Sat Oct 06, 2018 3:19 pm
Reputation: 104

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

Post by MartaLabieniec » Sat Nov 30, 2019 1:46 pm

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: 544
Joined: Fri Feb 15, 2019 5:45 pm
Reputation: 422

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

Post by cfemen » Sat Nov 30, 2019 2:21 pm

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 reassemble or with an another aob to find the address to recreate the jump.
you like my tables and want to support me? my patreon :)

Post Reply

Who is online

Users browsing this forum: No registered users