|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
usernotfound Expert Cheater Reputation: 0
Joined: 21 Feb 2016 Posts: 115
|
Posted: Fri Jul 21, 2017 3:47 pm Post subject: How to free memory properly in Lua autoAssemble? |
|
|
I've been told before that dealloc does not work in autoAssemble disable section string, if this is the case then how can I free the memory allocated in the first section
Would this work?
Code: |
function enable()
autoAssemble([[
alloc(hook,124)
registersymbol(hook)
//etc..
]])
end
function disable()
autoAssemble([[
unregistersymbol(hook)
]])
deAlloc('hook')
end
|
|
|
Back to top |
|
|
panraven Grandmaster Cheater Reputation: 55
Joined: 01 Oct 2008 Posts: 942
|
Posted: Fri Jul 21, 2017 4:12 pm Post subject: |
|
|
Try search "disableinfo".
eg. http://forum.cheatengine.org/viewtopic.php?t=604767#5726898
Note that in ce 6.7 with disableinfo, the autoAssemble script can be exactly same in a memory record with [ENABLE]/[DISABLE]section, except the 'memrec' variable in Lua block {$lua}.
_________________
- Retarded. |
|
Back to top |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Fri Jul 21, 2017 4:52 pm Post subject: Re: How to free memory properly in Lua autoAssemble? |
|
|
deAlloc, it is the oldest solution since CE6.5, it should do the trick. But, it is not perfect if you have more than one alloc.
e.g. you have this memory record AA script:
Code: | [ENABLE]
alloc(InfiniteHealth,2048,BlackOps3.exe)
aobscanmodule(InfiniteHealthAOB,BlackOps3.exe,8B 83 C8 02 00 00 48 8B)
registersymbol(InfiniteHealthAOB)
label(return)
InfiniteHealth:
mov [rbx+000002C8],#999
jmp return
InfiniteHealthAOB:
jmp InfiniteHealth
nop
return:
[DISABLE]
InfiniteHealthAOB:
db 8B 83 C8 02 00 00
unregistersymbol(InfiniteHealthAOB)
dealloc(InfiniteHealth) |
version with deAlloc will look like this:
Code: | InfiniteHealth_enable = [[
alloc(InfiniteHealth,2048,BlackOps3.exe)
label(InfiniteHealthUserSymbol)
registersymbol(InfiniteHealthUserSymbol)
aobscanmodule(InfiniteHealthAOB,BlackOps3.exe,8B 83 C8 02 00 00 48 8B)
registersymbol(InfiniteHealthAOB)
label(return)
InfiniteHealth:
InfiniteHealthUserSymbol:
mov [rbx+000002C8],#999
jmp return
InfiniteHealthAOB:
jmp InfiniteHealth
nop
return:
]]
InfiniteHealth_disable = [[
InfiniteHealthAOB:
db 8B 83 C8 02 00 00
unregistersymbol(InfiniteHealthAOB)
]]
function enableInfiniteHealthCheat()
if not InfiniteHealthCheatIsEnabled then
InfiniteHealthCheatIsEnabled = autoAssemble(InfiniteHealth_enable)
end
end
function disableInfiniteHealthCheat()
if InfiniteHealthCheatIsEnabled then
if autoAssemble(InfiniteHealth_disable) then
deAlloc('InfiniteHealthUserSymbol')
unregisterSymbol('InfiniteHealthUserSymbol')
InfiniteHealthCheatIsEnabled = false
end
end
end |
With CE6.7, this:
Code: | InfiniteHealthScript = [[
[ENABLE]
alloc(InfiniteHealth,2048,BlackOps3.exe)
aobscanmodule(InfiniteHealthAOB,BlackOps3.exe,8B 83 C8 02 00 00 48 8B)
registersymbol(InfiniteHealthAOB)
label(return)
InfiniteHealth:
mov [rbx+000002C8],#999
jmp return
InfiniteHealthAOB:
jmp InfiniteHealth
nop
return:
[DISABLE]
InfiniteHealthAOB:
db 8B 83 C8 02 00 00
unregistersymbol(InfiniteHealthAOB)
dealloc(InfiniteHealth)
]]
function enableInfiniteHealthCheat()
if not InfiniteHealthCheatIsEnabled then
InfiniteHealthCheatIsEnabled,InfiniteHealthCheatDisableinfo = autoAssemble(InfiniteHealthScript)
end
end
function disableInfiniteHealthCheat()
if InfiniteHealthCheatIsEnabled then
if autoAssemble(InfiniteHealthScript,InfiniteHealthCheatDisableinfo) then
InfiniteHealthCheatIsEnabled = false
end
end
end |
_________________
Last edited by mgr.inz.Player on Fri Jul 21, 2017 5:04 pm; edited 3 times in total |
|
Back to top |
|
|
dl748 Advanced Cheater Reputation: 0
Joined: 05 Mar 2016 Posts: 75
|
Posted: Fri Jul 21, 2017 4:52 pm Post subject: |
|
|
I've found this to be cumbersome. I generally use allocateSharedMemory(), I can't wait until deallocateShareMemory() works but right now, I do a single allocation and just reuse when needed.
|
|
Back to top |
|
|
usernotfound Expert Cheater Reputation: 0
Joined: 21 Feb 2016 Posts: 115
|
Posted: Fri Jul 21, 2017 6:15 pm Post subject: |
|
|
Thanks guys didn't know about disableinfo being added, works as intended
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|