- 45
- 2
RU: Здравствуйте, люди из Blast.HK, я пытаюсь создать способ выполнения функции `destroyScmThread(uint thread)` на C++ для освобождения файлов CLEO.
EN: Hello people from Blast.HK, I am trying to create a way to execute `destroyScmThread(uint thread)` from C++ to unload CLEO files.
Original LUA code:
EN: Hello people from Blast.HK, I am trying to create a way to execute `destroyScmThread(uint thread)` from C++ to unload CLEO files.
Original LUA code:
Free cleos memory:
local function findCleoScript(arg)
for file in require("lfs").dir(getGameDirectory() .. "/cleo") do
if file:match(arg) and file:match(".cs") then
return file
end
end
return "Unknown"
end
local function unloadCleoScripts()
local memory = require("memory")
local scripts = {}
local address = memory.getint32(11056172, false)
while address > 0 do
wait(0)
if memory.getint32(address + 16, false) > 0 then
local name = memory.tostring(address + 8, 8):match("[%w]*[%p%w]*")
if name then
local dir = findCleoScript(name)
scripts[#scripts + 1] = {
name = name,
address = string.format("0x%x", address),
dir = dir
}
end
end
address = memory.getint32(address, false)
end
for _, script in ipairs(scripts) do
destroyScmThread(scripts[idx].address)
end
end