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 


CE 6.6 Lua. OnExtraLineRender. Marked addresses

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials -> LUA Tutorials
View previous topic :: View next topic  
Author Message
GH*master
Expert Cheater
Reputation: 8

Joined: 10 Jan 2008
Posts: 159

PostPosted: Tue Jan 03, 2017 2:00 am    Post subject: CE 6.6 Lua. OnExtraLineRender. Marked addresses Reply with quote



Sometimes I need to paint addresses in debugging with different colors. My suggestion.

Code:
ClRed   = 0x0000FF
ClGreen   = 0x008000
ClBlue   = 0xFF0000

extraLineRender_defaultColor = ClGreen
extraLineRender_tableAddress = {}
extraLineRender_X = 60
extraLineRender_Y = -20

--RasterImage OPTIONAL, x OPTIONAL, y OPTIONAL
function OnExtraLineRender(sender_disassemblerviewLine, address, aboveInstruction, selected)
   for i = 1, #extraLineRender_tableAddress do
      if(extraLineRender_tableAddress[i] == address) then
         if(aboveInstruction) then
            return commentImage, extraLineRender_X - 100, extraLineRender_Y
         else
            return commentImage, extraLineRender_X, extraLineRender_Y
         end
      end
   end

end

function ExtraLineRender_Init()
   local disassemblerView = getMemoryViewForm().DisassemblerView
   disassemblerView.OnExtraLineRender = OnExtraLineRender
   local width = 20
   local height = 20
   if(commentImage == nil) then
      commentImage = createBitmap(width, height)
   end
   commentImage.Width = width
   commentImage.Height = height
   commentImage.Canvas.clear()
   commentImage.Canvas.Pen.Color = extraLineRender_defaultColor
   commentImage.Canvas.Brush.Color = extraLineRender_defaultColor
   commentImage.Canvas.fillRect(0, 0, commentImage.Width, commentImage.Height)
   commentImage.Canvas.Brush.Color = 0xC8D0D4
   commentImage.Canvas.fillRect(0, 0, commentImage.Width, commentImage.Height-13)
end

function ExtraLineRender_NewTable(newTable)
  extraLineRender_tableAddress = newTable
end

--
function ExtraLineRender_AddRecord(address)
   table.insert(extraLineRender_tableAddress,address)
end

function ExtraLineRender_RemoveRecord(address)
   for key,value in pairs(extraLineRender_tableAddress) do
      if(address == value) then
         table.remove(extraLineRender_tableAddress, key)
      end
   end
end

ExtraLineRender_Init()
ExtraLineRender_AddRecord(0x004556E3)
ExtraLineRender_AddRecord(0x004556EF)
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 Tutorials -> LUA Tutorials 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 cannot download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites