Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Cheat Engine Custom Font loader

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Extensions
View previous topic :: View next topic  
Author Message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Wed Jul 27, 2016 8:57 am    Post subject: Cheat Engine Custom Font loader This post has 2 review(s) Reply with quote

This script allows you to load a font for you to use in the cheat engine 6.5.1 and newer (only).
By calling AddFontResourceExA

Put this script in your auto run folder
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



Usage:
Code:
-- Path to the font file in your computer
local path = 'c:\\The_Juke_Box-FFP.ttf';
TableAddFont(path)
-- File name inside cheat engine table
local name = 'Funkrocker.otf'
TableAddFont(name)


Preview:



Edit
Added CE 6.5.1 64 bit support

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Extensions All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites