CheatMaker 论坛

首页 » 游戏相关版块 » 游戏工具及相关 » Cheat Engine 6.x - 添加OllyDbg的按ALT+Backsp撤销选择处修改的功能
dfzetcc - 2015/11/9 17:18:00
源作者:mgr.inz.Player

脚本版本: 1.0.4
功能:
CE会记录源始指令、跳转线将移动到右边以及按ALT+R键可撤销选择处的修改

AA注入之后,跳转线移动到右边


Manually altered line:


新的菜单项:

2077

以下是lua脚本代码,使用方法为:代码复制粘贴到文本文档,并将文本文档的.txt后缀名修改成.lua,然后将此文本文档复制到CE目录中的autorun文件夹内,重启CE即可。
  1. function restoreOrigBytes(sender)
  2.   if origBytesTable[selectedAddress_redo]==nil then return end

  3.   local bytes={}
  4.   local start=origBytesTable[selectedAddress_redo].startaddress
  5.   local size=origBytesTable[selectedAddress_redo].size

  6.   --prepare subset
  7.   for i=1,size do bytes[#bytes+1]=origBytesTable[start+i-1].byte end

  8.   local script=string.format('%X',start)..':\r\n'..'db '..'#'..(table.concat(bytes,' #'))

  9.   skip_myAssemblerWithRedo=true
  10.   if not autoAssemble(script) then return nil end
  11.   skip_myAssemblerWithRedo=false
  12. end

  13. skip_myAssemblerWithRedo=false
  14. function myAssemblerWithRedo(addr,inst)

  15.   if skip_myAssemblerWithRedo               -- forced skip?
  16.      or
  17.      origBytesTable[addr]~=nil   -- we already have collected orig bytes
  18.   then return nil end

  19.   local origsize=getInstructionSize(addr)
  20.   local sizes={}
  21.   local tmpVar=0

  22.   -- get sizes of those next lines
  23.   for i=1,20 do
  24.     sizes[i]=getInstructionSize(addr+tmpVar)
  25.     tmpVar=tmpVar+sizes[i]
  26.   end

  27.   --get bytes of those next lines
  28.   local originalbytes=readBytes(addr,tmpVar,true)
  29.   if originalbytes==nil then return nil end

  30.   -- save original bytes if not already saved
  31.   tmpVar=1
  32.   for i=1,20 do
  33.     for j=1,sizes[i] do
  34.       local tmp={startaddress=addr, byte=originalbytes[tmpVar], size=sizes[i]}
  35.       if not origBytesTable[addr+j-1] then origBytesTable[addr+j-1]=tmp end
  36.       tmpVar=tmpVar+1
  37.     end
  38.     addr=addr+sizes[i]
  39.   end

  40.   return nil
  41. end

  42. getVisibleDisassembler().OnDisassembleOverride =
  43. function (vd, a, ldd)
  44.   if origBytesTable[a]==nil then return nil,nil end -- 100% not changed

  45.   disAsm_redo.syntaxhighlighting=vd.syntaxhighlighting
  46.   disAsm_redo.disassemble(a)

  47.   local modified=false
  48.   local startbyte=origBytesTable[a].startaddress
  49.   local endbyte=startbyte+origBytesTable[a].size-1

  50.   -- search for differences
  51.   for i=startbyte,endbyte do
  52.     if disAsm_redo.LastDisassembleData.bytes[i-origBytesTable[a].startaddress+1]~=
  53.        origBytesTable[i].byte
  54.     then modified=true break end
  55.   end

  56.   if not modified then return nil,nil end -- bytes the same, not modified

  57.   for k,v in pairs(disAsm_redo.LastDisassembleData) do ldd[k]=v end

  58.   ldd.opcode='  '..ldd.opcode -- add few spaces at the beginning
  59.   return ldd.opcode,ldd.description
  60. end

  61. function addRedoMenuItem()
  62.   dv=getMemoryViewForm().DisassemblerView

  63.   if redoMenuItem==nil then
  64.    local pmenu=dv.PopupMenu
  65.    redoMenuItem=createMenuItem(pmenu)
  66.    pmenu.Items.add(redoMenuItem)
  67.   end
  68.   redoMenuItem.Caption='恢复原始字节'
  69.   redoMenuItem.Shortcut='Alt+R'
  70.   redoMenuItem.OnClick=restoreOrigBytes

  71.   disassemblerview_onSelectionChange(dv,function (dv,a1,a2) selectedAddress_redo=a1 end)
  72. end

  73. if myAssemblerWithRedo_ID==nil then myAssemblerWithRedo_ID=registerAssembler(myAssemblerWithRedo) end
  74. if disAsm_redo==nil then disAsm_redo=createDisassembler() end
  75. if origBytesTable==nil then origBytesTable={} end

  76. addRedoMenuItem()
复制代码
1
查看完整版本: Cheat Engine 6.x - 添加OllyDbg的按ALT+Backsp撤销选择处修改的功能