View previous topic :: View next topic |
Author |
Message |
Haizan Cheater Reputation: 1
Joined: 25 Aug 2014 Posts: 46
|
Posted: Mon Aug 25, 2014 3:24 pm Post subject: Auto Assembler Memory in Lua |
|
|
I have some data I'd like to back up on [ENABLE] and restore later.
For that I allocate a block in the auto assembler and try to have a Lua function copy the data to my memory. However the symbol apparently isn't registered by the time the Lua function runs (or maybe the memory isn't even allocated yet?) so this test code fails:
Code: | [ENABLE]
alloc(backup, $600)
registersymbol(backup)
LuaCall(copybackup())
[DISABLE]
dealloc(backup)
|
with "copybackup" being something like:
Code: | function copybackup()
local address = getAddress("backup")
local bytes = readBytes(0xDEADBEEF, 0x600, true)
writeBytes(address, bytes, 0x600)
end |
Questions:
- Is "backup" even allocated by the time "copybackup" is called?
- If so, how do I get an address for "backup"?
- If that is impossible how else could I get the job done? Do I have to write my whole script in Lua?
|
|
Back to top |
|
|
DaSpamer Grandmaster Cheater Supreme Reputation: 52
Joined: 13 Sep 2011 Posts: 1578
|
Posted: Mon Aug 25, 2014 3:29 pm Post subject: |
|
|
Lua calls are executed before the script is.
You may achieve this by write your whole script in lua, or 2 auto assembler functions.
I'd go for whole script in lua (more options, ordered, can add/update table entries).
_________________
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Mon Aug 25, 2014 3:53 pm Post subject: |
|
|
You can use readmem to backup the original bytes
Code: |
[enable]
alloc(backup,$600)
registersymbol(backup)
backup:
readmem(someaddress,$600)
someaddress:
nop
nop
nop
...
[disable]
someaddress:
readmem(backup,16)
...
dealloc(backup)
unregistersymbol(backup)
|
_________________
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 |
|
|
Haizan Cheater Reputation: 1
Joined: 25 Aug 2014 Posts: 46
|
Posted: Mon Aug 25, 2014 4:05 pm Post subject: |
|
|
Oh, that works!
For now I'm gonna go with the readmem method.
Thanks, you two.
|
|
Back to top |
|
|
|