Code: |
function TableAddFont(path)
if (type(path)=='string') then
local font,filename
font = findTableFile(path);
if (not font) then
local file = io.open(path,"r")
if (not file) then
error("ERROR loading font");
else
file:close();
filename = path:match(".+\\(.-)$")
font = findTableFile(filename)
if (not font) then
font = createTableFile(filename,path)
end
end
end
local frmt = (cheatEngineIs64Bit() and "mov edx,#%%d\nmov rcx,#%%d\nxor r8d,r8d\nlea r9d,[count]\ncall AddFontMemResourceEx\nmov [handle],rax" or "lea eax,[count]\npush eax\npush 0\npush #%%d\npush #%%d\ncall AddFontMemResourceEx\nmov [handle],eax")
local pFont,length = font.stream.memory,font.stream.size
local sAdd = "alloc(script,128)\nalloc(data,32)\nlabel(count)\nlabel(handle)\nregistersymbol(count)\nregistersymbol(handle)\nregistersymbol(script)\nscript:\n_FORMAT\nret\ndata:\ncount:\ndd -1\nhandle:\ndd -1\ncreatethread(script)"
sAdd = sAdd:gsub("_FORMAT",frmt):format(length,pFont)
local status = autoAssemble(sAdd,true);
if (status) then
local handle = readIntegerLocal("handle") or 0;
return handle ~= 0
end
return false;
end
end |
_________________
I'm rusty and getting older, help me re-learn lua.