jgoemat Master Cheater Reputation: 22
Joined: 25 Sep 2011 Posts: 252
|
Posted: Mon Jul 16, 2018 9:00 pm Post subject: Open dissect data with struct and address |
|
|
This function will use an existing structure dissect window with the specified structure or create one if one doesn't exist and add the specified address as a string:
Code: | function AddAddressToStructureForm(structName, addressString)
local frm = nil
for i,v in ipairs(enumStructureForms()) do
local struct = v.MainStruct
if struct ~= nil then
if struct.Name == structName then
frm = v
break
end
end
end
if frm == nil then
-- TODO: Create new form
createStructureForm(addressString, nil, structName)
return
end
local col = frm.addColumn()
col.AddressText = addressString
col.Focused = true
return col
end
|
Here's a sample script I'm using it in so they can enable/disable for a 'Unit' structure I have and a pointer to the last unit that was manually moved in the game:
Code: | [ENABLE]
{$lua}
if syntaxcheck then return end
local addr = string.format('%x', getAddressSafe('[pLastManuallyMovedUnit]'))
AddAddressToStructureForm('Unit', addr)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
local addr = string.format('%x', getAddressSafe('[pLastManuallyMovedUnit]'))
AddAddressToStructureForm('Unit', addr)
{$asm}
|
|
|