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 


executeCodeLocal "BitBlt" not working

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

Joined: 10 Jan 2008
Posts: 159

PostPosted: Wed Jun 12, 2019 12:58 pm    Post subject: executeCodeLocal "BitBlt" not working Reply with quote

Issue about call blit
Code:
  local width = 300
  local height = 100 
  local addressLocal = getAddress("BitBlt", true)
  print(string.format('%08X',addressLocal))
  local SRCCOPY = 0xCC0020
  executeCodeLocal(addressLocal,
  canvasFrmShadowMemoryView.Handle,
  0, 0, width, height,
  canvasMainMemoryView.Handle, 0,0, SRCCOPY)


I think I need to show all the code.
Code:
local mvForm2 = getMemoryViewForm()

local mi = createMenuItem(mvForm2.Menu)
mi.Caption = 'GH Tools'
mvForm2.Menu.Items.add(mi)

local mi2 = createMenuItem(mi)
mi2.Caption = 'MV Scanner'
mi.add(mi2)

mi3HBmethod = createMenuItem(mi2)
mi3HBmethod.Caption = 'HB method'
mi2.add(mi3HBmethod)
mi3HBmethod.OnClick = function()
  if not CheckPreloadActions() then
    return
  end
  mi3HBmethod.Enabled = false
  mi4DBVMmethod.Enabled = false
  mi5Stop.Enabled = true
  mi3HBmethod.Checked = true
end

mi4DBVMmethod = createMenuItem(mi2)
mi4DBVMmethod.Caption = 'DBVM method'
mi2.add(mi4DBVMmethod)
mi4DBVMmethod.OnClick = function()
  if not CheckPreloadActions() then
    return
  end
  mi3HBmethod.Enabled = false
  mi4DBVMmethod.Enabled = false
  mi5Stop.Enabled = true
  mi4DBVMmethod.Checked = true
end

mi5Stop = createMenuItem(mi2)
mi5Stop.Caption = 'Stop'
mi2.add(mi5Stop)
mi5Stop.OnClick = function()
  mi3HBmethod.Enabled = true
  mi4DBVMmethod.Enabled = true
  mi5Stop.Enabled = false
  mi4DBVMmethod.Checked = false
  mi3HBmethod.Checked = false
  mi5Stop.Enabled = false
end
mi5Stop.Enabled = false

function CheckPreloadActions()
  local mainMemoryView = getMemoryViewForm().HexadecimalView
  if mainMemoryView.DisplayType ~= dtByte then
    showMessage("Set display type: view bytes")
    return false
  end
  return true
end
----------------------------------------------------------------------


mainMemoryView = getMemoryViewForm().HexadecimalView
--mainMemoryView.OnAddressChange = function(hexadecimalview, address)
 --  print("new address " .. address)
--end
--mainMemoryView.OnCharacterRender = function(sender, address, text2)
--   if text2 ~= nil then
--    print('text:'..text2)
--   end
--end
--[[
mainMemoryView.OnValueRender = function(sender, address, text)
getMemoryViewForm().Hide()
  print(sender.ClassName)
  local listProperties = getPropertyList(sender)
  local allowCustomInput = false
  local id, name = showSelectionList("Title", "Caption", listProperties, allowCustomInput)
  print ('Index: '..id..", Name: "..name)
  mainMemoryView.OnValueRender= function () end
end
--]]


local topAddress = mainMemoryView.Address -- top Address
--print(topAddress)

--print('..'..UDF1.CELabel1.Color)

frmMemoryViewForm = getMemoryViewForm()
mainMemoryView = getMemoryViewForm().HexadecimalView
isShowMainMemoryView = false
canvasMainMemoryView = mainMemoryView.Canvas

frmMemoryViewForm.DoubleBuffered = true
mainMemoryView.DoubleBuffered = true

if frmShadowMemoryView == nil then
   clNone = 536870911
   clRed = 255
   frmShadowMemoryView = createForm(false)
   frmShadowMemoryView.DoubleBuffered = true

   canvasFrmShadowMemoryView = frmShadowMemoryView.Canvas
   canvasFrmShadowMemoryView.Brush.Color = clRed
   canvasFrmShadowMemoryView.Brush.Style = 'bsClear'
   canvasFrmShadowMemoryView.Pen.Color = clNone --0x00FF0000
   canvasFrmShadowMemoryView.Pen.Width = 1   
end



--mainMemoryView.OnPaint = function() 
     
function OnTickTimerDrawer()
  if frmMemoryViewForm.Visible then
    frmShadowMemoryView.Show()
  else
    frmShadowMemoryView.Hide()
    return
  end 
 
  frmShadowMemoryView.Height = mainMemoryView.Height
  frmShadowMemoryView.Width = mainMemoryView.Width


  --canvasFrmShadowMemoryView.copyRect(0, 0, width, height, canvasMainMemoryView, 0,0, width,height)
  local width = 300
  local height = 100 
  local addressLocal = getAddress("BitBlt", true)
  --print(string.format('%08X',addressLocal))
  local SRCCOPY = 0xCC0020
  executeCodeLocal(addressLocal,
  canvasFrmShadowMemoryView.Handle,
  0, 0, width, height,
  canvasMainMemoryView.Handle, 0,0, SRCCOPY)
 
  --hdcWin = GetDC(hwnd);
  --ReleaseDC(hwnd, hdcWin);
 
  -- BitBlt(MemDC,0,0,1024,768,ScreenDC,0,0,SRCCOPY);
   
  local startPointX = 10
  local startPointY= 0
  local widthCell = 30
  local heightCell = 20
  local space = 20

  for x = 0, 16 do
    for y = 0, 5 do
      local x1 = startPointX + x*widthCell
      local y1 = startPointY+ y*heightCell
      local x2 = x1 + widthCell
      local y2 = y1 + heightCell
      --canvasFrmShadowMemoryView.rect(x1,y1,x2,y2)
      --canvasFrmShadowMemoryView.textOut(startPointX + x*widthCell, startPointY+ y*heightCell,'00')
    end
  end
end


if timerOnRenderer == nil then
  timerOnRenderer = createTimer()
  timerOnRenderer.Interval = 100
  timerOnRenderer.Enabled = true
  timerOnRenderer.OnTimer = OnTickTimerDrawer 
end



function StartHWMode()
  --todo...
end

function StartDBVMMode()
  --todo..
end
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25296
Location: The netherlands

PostPosted: Wed Jun 12, 2019 4:35 pm    Post subject: Reply with quote

executeCodeLocal only takes one parameter, you need to write a stub function first that reads out the parameter pointer to a block of actual parameters, and then pass that to the function you wish to call

(next ce version has executeCodeLocalEx)

_________________
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
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting 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