View previous topic :: View next topic |
Author |
Message |
beagle Cheater Reputation: 0
Joined: 27 Aug 2014 Posts: 36
|
Posted: Wed Feb 08, 2017 5:30 pm Post subject: Some Autoassemble and Lua questions |
|
|
I apologize if these are poor questions, i dont want to come off as lazy but i am thoroughly confused on how to correctly integrate AA with lua. I am comfortable with using AA but i dont have much experience using lua for memory editing. Im now mainly stuck on trying to get lua and AA to communicate.
Q1. I would like to use lua to remember things like opcodes and addresses and then inside my AA script call on them, is this possible?
eg:
in lua:
local ad1 = 12345 or op1 = eb 75
and in AA:
ad1: db 90 or 66666: op1
2. How do i put atuo assemble code in a lua script and vice versa?
3. is it possible to have an AA script in your cheat table read from your lua script and vice versa, or should they be together?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25287 Location: The netherlands
|
Posted: Wed Feb 08, 2017 6:02 pm Post subject: |
|
|
you can let your AA script read/write a registered symbol, and let a Lua script read/write that
e.g:
Code: |
alloc(bla,4)
registersymbol(bla)
...
cmp [bla],1
jne skipcheat
..cheatstuff...
|
and then use a menu in Lua, or a timer/thread, to set the bra variable
e.g:
Code: |
if myform.cbEnableCheat.Checked then
writeInteger('bla',1)
else
writeInteger('bla',0)
end
|
---
You can also combine Lua with AA using the {$lua} tag, but understand that this is mainly a pre-processor. (It runs BEFORE the aa script gets executed)
The result of the Lua function will be part of the auto assembler script which will get executed/injected
e.g:
Code: |
... aa script...
label(something)
...
{$lua}
if readInteger(0x00400500)==0 then
return [[
something:
dd 0
]]
else
return [[
something:
dd 1
]]
end
...
cmp [something],1
je dosomething
...
|
---
putting AA script inside Lua is done using the autoAssemble() command
e.g:
Code: |
x=12
s='something'
autoAssemble(string.format([[
alloc(xxx,4)
registersymbol(xxx)
alloc(mystring,255)
registersymbol(mystring)
xxx:
dd %x
mystring:
db '%s'
]],x,s)
|
---
and for more advanced things like calling Lua functions from the target process in an injected piece of code check out the Lua inject template
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
beagle Cheater Reputation: 0
Joined: 27 Aug 2014 Posts: 36
|
Posted: Wed Feb 08, 2017 6:14 pm Post subject: |
|
|
Fantastic, thank you :)
Something i would like to do is use lua to record variable wildcard bytes before they are overwritten so that i can restore them in the [disable] section of my AOBScan script. Should i use lua inside the AA script for this?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25287 Location: The netherlands
|
Posted: Wed Feb 08, 2017 6:26 pm Post subject: |
|
|
You can of course use Lua to store the original bytes in a byteTable and on disable write them back.
But keep in mind that the Lua section executes before the AA script, so things like AOBscan and stuff will not have been executed. So your Lua script would then have to do the aobscan itself to get to the address and store the original bytes.
Of course if it's an exact address, then it's easy enough. (readBytes/writeBytes)
BUT, you can also do all this without Lua
Code: |
[enable]
aobscan(xxx,11 22 33 * 55 * 77 88)
registersymbol(xxx)
alloc(originalbytes,8)
registersymbol(originalbytes)
originalbytes:
readmem(xxx,8)
....
xxx:
db 90 90 90 90 90 90 90 90
...
[disable]
...
xxx:
readmem(originalbytes,8)
dealloc(originalbytes)
unregistersymbol(originalbytes)
unregistersymbol(xxx)
...
|
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
beagle Cheater Reputation: 0
Joined: 27 Aug 2014 Posts: 36
|
Posted: Wed Feb 08, 2017 6:42 pm Post subject: |
|
|
Oh ok, that looks good. I figured it would be more difficult to do with just AA alone.
Thanks :)
Edit:
Are there any performance issues with using readmem to read and overwrite a lot of bytes, eg readmem(base1,2048)?
|
|
Back to top |
|
|
|