Dark Byte Site Admin Reputation: 465 Joined: 09 May 2003 Posts: 25570 Location: The netherlands
|
Posted: Fri Apr 29, 2022 9:44 am Post subject: Using notepad as your memoryrecord AA editor |
|
|
I'm sure everyone wishes they could edit their addresslist memoryrecord AA scripts using notepad instead of ce's built-in editor
you can do that with this script
Just doubleclick on the script part and instead of opening the CE AA editor, notepad will pop up with the curent script.
Do not forget to save the script before closing notepad
Code: |
function LaunchCommandAndWait(command)
local lpStartupInfo=createMemoryStream()
local lpProcessInfo=createMemoryStream()
local sisize
local pisize
local r
local result
if cheatEngineIs64Bit() then
sisize=104
pisize=24
else
sisize=68
pisize=16
end
lpStartupInfo.writeDword(sisize)
lpStartupInfo.Size=sisize
lpProcessInfo.Size=pisize
r=executeCodeLocalEx('CreateProcessA',0,command,0,0,0,0,0,0,lpStartupInfo.Memory,lpProcessInfo.Memory);
if r~=0 then
lpProcessInfo.Position=0
local hProcess
local hThread
if cheatEngineIs64Bit() then
hProcess=lpProcessInfo.readQword()
hThread=lpProcessInfo.readQword()
else
hProcess=lpProcessInfo.readDword()
hThread=lpProcessInfo.readDword()
end
r=executeCodeLocalEx('WaitForSingleObject', hProcess, 0xffffffff)
local ExitCode=createMemoryStream()
ExitCode.Size=4
if executeCodeLocalEx('GetExitCodeProcess', hProcess, ExitCode.Memory)~=0 then
result=ExitCode.readDword()
end
ExitCode.destroy()
--cleanup handles
executeCodeLocalEx('CloseHandle', hProcess)
executeCodeLocalEx('CloseHandle', hThread)
end
lpProcessInfo.destroy()
lpStartupInfo.destroy()
return result
end
local counter=0
local active={}
AddressList.OnAutoAssemblerEdit=function(al,mr)
-- print("editing aa script")
if active[mr.ID] then return true end --already editing
mr.beginEdit()
-- print("memrec has been marked as editing")
local sl=createStringList()
sl.Text=mr.Script
local path
if getTempFolder then
path=getTempFolder()
else
path=getCheatEngineDir()
end
lfs.mkdir(path.."editing-ceaascripts") --assume it works, or it already exists
path=path.."editing-ceaascripts\\"
--printf("initial path=%s", path)
local ms=createMemoryStream()
ms.size=260
if executeCodeLocalEx("GetTempFileNameA", path,"CEA",0,ms.Memory) ~=0 then
path=readStringLocal(ms.Memory,260)
--printf("final path=%s", path)
ms.destroy()
--printf("saving script to %s", path)
sl.saveToFile(path)
active[mr.ID]=true
createThread(function(t)
--print("AA editorthread: Launching notepad and wait")
LaunchCommandAndWait('notepad.exe '..path)
--print("AA editorthread: Finished waiting")
sl.loadFromFile(path)
mr.Script=sl.Text
mr.endEdit()
sl.destroy()
active[mr.ID]=nil
-- print("done editing")
end)
return true
else
print("GetTempFileNameA failed")
sl.destroy()
ms.destroy()
return false
end
end
|
_________________ 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
|
|