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 


[feature suggestion] memory viewer / debugger

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Fresco
Grandmaster Cheater
Reputation: 4

Joined: 07 Nov 2010
Posts: 600

PostPosted: Tue May 04, 2021 2:57 pm    Post subject: [feature suggestion] memory viewer / debugger Reply with quote

Hi,

I'd like to more easily define user symbols.
Currently I have to right click an instruction -> copy to clipboard -> addresses only
then : view -> userdefined symbol or (ctrl+u)
in the dialog, paste the address and write my symbol name
then click the add symbol button.

I'd like the procedure to be easier, something like hitting F2 on the keyboard while the instruction is highlighted, type the symbol name then hit enter

Or a menu under the context menu of an instruction with
a simple dialog box just like (set change comment / header)

doing this will help with debugging and naming of known (reversed functions)

_________________
... Fresco
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 51

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Tue May 04, 2021 3:57 pm    Post subject: This post has 1 review(s) Reply with quote

You could write a lua module for the autorun folder that adds to the context menu.

Here's one I use to add a "Copy Address" option.
pluginAddCopyAddressMemoryView.lua:
Code:

local t = translate
local format = string.format

if MainForm == nil then
   MainForm = getMainForm()
end
if AddressList == nil then
   AddressList = getAddressList()
end


local function getPointerSize()
   aasStr = [====[
      globalAlloc(memPointerTest, 0x8)
      memPointerTest:
         db FF FF FF FF FF FF FF FF
   ]====]
   local assembled = autoAssemble(aasStr)
   if assembled then
      local p1 = readQword('memPointerTest')
      local p2 = readPointer('memPointerTest')
      if p1 == p2 then
         return 0x8
      else
         return 0x4
      end
   end
   return nil
end

local function getPointerSizeStrs()
   local pointerSize = getPointerSize()
   local pointerSizeStr = format('0x%X', pointerSize or 0x8)
   local pointerFtmStr = '%016X'
   local pointerWordSize = 'dq'
   local pointerDefaultStr = 'dq 0'
   if pointerSize == 0x4 then
      pointerFtmStr = '%08X'
      pointerWordSize = 'dd'
      pointerDefaultStr = 'dd 0'
   end
   return pointerSize, pointerSizeStr, pointerFtmStr, pointerWordSize, pointerDefaultStr
end


local function getModuleFromAddress(address)
   if address == 0 then
      return nil
   end
   if type(address) == 'string' then
      address = tonumber(address, 16)
   end
   if address == nil then
      return nil
   end
   local modulesTable = enumModules()
   local size = 0
   for i, v in pairs(modulesTable) do
      size = getModuleSize(v.Name)
      if size ~= nil then
         if address >= v.Address and address <= v.Address + size then
            return v.Name
         end
      end
   end
   return nil
end

local function getModuleAndOffsetFromAddress(address)
   local pointerSize, pointerSizeStr, pointerFtmStr, pointerWordSize, pointerDefaultStr = getPointerSizeStrs()
   if address == 0 then
      return format(pointerFtmStr, address)
   end
   if type(address) == 'string' then
      address = tonumber(address, 16)
   end
   if address == nil then
      return address
   end
   local addModule = getModuleFromAddress()
   if addModule then
      return format('%s+%X', addModule, (address - v.Address))
   end
   return getNameFromAddress(address)
end


local function copyAddress()
   writeToClipboard(getModuleAndOffsetFromAddress(math.min(dv_address1, dv_address2)))
end

local function copyMemoryRecordAddress()
   if AddressList.SelectedRecord ~= nil then
      local address = AddressList.SelectedRecord.Address
      if AddressList.SelectedRecord.OffsetCount > 0 then
         for i = 1, AddressList.SelectedRecord.OffsetCount do
            address = readPointer(address + AddressList.SelectedRecord.Offset[i])
         end
      end
      if address ~= nil then
         writeToClipboard(getModuleAndOffsetFromAddress(address))
      end
   end
end


local function OnSelectionTracker(disassemblerviewLine, address, address2)
   dv_address1 = address
   dv_address2 = address2
end


local function addContextMenuItems()
   local frmMemoryView = getMemoryViewForm()
   local dv = frmMemoryView.DisassemblerView
   disassemblerview_onSelectionChange(dv, OnSelectionTracker)
   dv_address1 = dv.SelectedAddress
   dv_address2 = dv.SelectedAddress2
   popupmenu = dv.PopupMenu
   mi = createMenuItem(popupmenu)
   mi.Caption = t('Copy Address')
   mi.onClick = copyAddress
   mi.Shortcut = 'Shift+Ctrl+C'
   popupmenu.Items.insert(3, mi)

   popupmenu = MainForm.PopupMenu2
   mi = createMenuItem(popupmenu)
   mi.Caption = t('Copy Address')
   mi.onClick = copyMemoryRecordAddress
   mi.Shortcut = 'Shift+Ctrl+C'
   popupmenu.Items.insert(2, mi)
end

addContextMenuItems()

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