Page 1 of 1

Help in building tables??

Posted: Sun Jul 11, 2021 6:00 pm
by cHAOSfRED
Should be simple, but I dunno how to do this since this is the first time I am trying. Also without using "Find out what writes to this address" due to reason. For starter, the game has this "game unlockables table" region which if viewed in memory viewer looked like this.

Code: Select all

?? ?? ?? ?? ?? ?? ?? ?? 0A 00 00 00 01 00 00 00 ?? ?? ?? ?? ?? ?? ?? ??
?? ?? ?? ?? ?? ?? ?? ?? 0A 00 00 00 01 00 00 00 ?? ?? ?? ?? ?? ?? ?? ??
?? ?? ?? ?? ?? ?? ?? ?? 0A 00 00 00 00 00 00 00 ?? ?? ?? ?? ?? ?? ?? ??
?? ?? ?? ?? ?? ?? ?? ?? 0A 00 00 00 00 00 00 00 ?? ?? ?? ?? ?? ?? ?? ??
?? ?? ?? ?? ?? ?? ?? ?? 0A 00 00 00 00 00 00 00 ?? ?? ?? ?? ?? ?? ?? ??
71 00 96 00 24 00 24 00 ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
This region moves and the ?? ?? part also changes everytime the game restarted, so no fixed pointer. But in manual terms, I could always search this table by using the ending pattern with AoB search "71 00 96 00 24 00 24 00" which does not change even after game restarted. This results in just one search result everytime which is where this memory region set.

The 0A 00 00 00 (00/01) 00 part indicates feature locked/unlocked.

now then, I wanted to change it into for example like this to unlock all features

Code: Select all

?? ?? ?? ?? ?? ?? ?? ?? 0A 00 00 00 01 00 00 00 ?? ?? ?? ?? ?? ?? ?? ??
?? ?? ?? ?? ?? ?? ?? ?? 0A 00 00 00 01 00 00 00 ?? ?? ?? ?? ?? ?? ?? ??
?? ?? ?? ?? ?? ?? ?? ?? 0A 00 00 00 01 00 00 00 ?? ?? ?? ?? ?? ?? ?? ??
?? ?? ?? ?? ?? ?? ?? ?? 0A 00 00 00 01 00 00 00 ?? ?? ?? ?? ?? ?? ?? ??
?? ?? ?? ?? ?? ?? ?? ?? 0A 00 00 00 01 00 00 00 ?? ?? ?? ?? ?? ?? ?? ??
71 00 96 00 24 00 24 00 ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
My current assemble script atm

Code: Select all

<AssemblerScript>
...
[ENABLE]

aobscan(unlockall,71 00 96 00 24 00 24 00 ) 
alloc(newmem,$1000,unlockall)

label(code)
label(return)

newmem:

code:
  
return:

[DISABLE]

unlockall:
  db 71 00 96 00 24 00 24 00

unregistersymbol(unlockall)
dealloc(newmem)
</AssemblerScript>
What should I write in newmem, code and return part to make "all features unlocked" ? Should I changes to LUA instead?

Wonder if there is a method like "Search this AoB, then offset by XX dword addresses, turn the value into XYZ, repeat again from last position" sort of that?

Re: Help in building tables??

Posted: Mon Jul 12, 2021 2:59 am
by ShyTwig16
You can use a positive or negative offset in the AA script. Just count the bytes, or use the addresses and some math.

Code: Select all

// ...
unlockall-XX:
  db 0A 00 00 00 01 00 00 00 // change to what is needed to unlock
unlockall-XY:
  db 0A 00 00 00 01 00 00 00
// ...
Do this in the enable section. And get rid of the "alloc" and labels you have since you don't use any of that, all you need in the aob scan and where it writes.

Re: Help in building tables??

Posted: Mon Jul 12, 2021 6:34 am
by cHAOSfRED
Thank you for the help. so the current becomes like this :

Code: Select all

<AssemblerScript>
...

[ENABLE]
aobscan(unlockall,71 00 96 00 24 00 24 00 ) 

unlockall-00000C:
  db 01 
unlockall-00001C:
  db 01
unlockall-00002C:
  db 01
unlockall-00003C:
  db 01
unlockall-00004C:
  db 01
unlockall-00005C:
  db 01
  ....
  
  [DISABLE]

unlockall:
  db 71 00 96 00 24 00 24 00
  </AssemblerScript>
 
This works, but makes the code quite big since there are some others (eg: inventory region, stats, etc). Perhaps is there a way to make it simpler? Like telling the write instruction to repeat this step "unlockall-00000C: db 01" while adding offset -000010 after every repeat and limits it to like 20 times repeat or alike?

Sorta like in web CSS got ":nth-child(5+2n) {color:red}" which repeats the step on 5th child, 7, 9, 11, 13 and so on. Then you can limit them with ":nth-child(40+n) {color:initial}" which means the previous instruction limited up to 40th child and the rest are not included.

Re: Help in building tables??

Posted: Mon Jul 12, 2021 12:58 pm
by ShyTwig16
Not with AA, but with Lua you could write a function for it. But it looks like one of those situation where you'll spend more time automating a tack then the tack would actually take. So up to you I guess.

Re: Help in building tables??

Posted: Mon Jul 12, 2021 1:00 pm
by cHAOSfRED
ShyTwig16 wrote:
Mon Jul 12, 2021 12:58 pm
Not with AA, but with Lua you could write a function for it. But it looks like one of those situation where you'll spend more time automating a tack then the tack would actually take. So up to you I guess.
All right then, guess gotta learn LUA basics for now.