| View previous topic :: View next topic |
| Author |
Message |
24quant42 Cheater
Reputation: 0
Joined: 19 Apr 2023 Posts: 31
|
Posted: Thu Apr 18, 2024 11:32 pm Post subject: Create structure from popup menu |
|
|
I have to use Structure Dissect very often, but manually updating the viewing address every time is very annoying for me. So I decided to write such a script. Which should add a direct transition to the Structure Dissect window to the mouse menu item.
But I ran into a problem. The "createStructureForm" method creates a window structure, but does not create a structure, that is, it does not call the "Define new structure Ctrl+N" button.
So I wanted to know about creation, how can I call createStructureForm along with "Define new Structure"???
| Code: | function isOpenStructureDissect()
for i = 0, getFormCount() - 1 do
local frm = getForm(i)
if frm.ClassName=="TfrmStructures2" then
for i = 0, frm.getComponentCount() -1 do
if "TEdit"==frm.getComponent(i).ClassName then
frm.getComponent(i).Text="FFFFFFFF"
end
end
return true
end
end
return false
end
if isOpenStructureDissect() then
print("OPEN")
else
createStructureForm("FFFFFFFF",nil,"TEST")
print("CLOSE")
end |
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25807 Location: The netherlands
|
Posted: Fri Apr 19, 2024 1:20 am Post subject: |
|
|
https://github.com/cheat-engine/cheat-engine/blob/dc08c7db1d9b936e4e486ad78e7aa73308b6bb5b/Cheat%20Engine/bin/celua.txt#L2718
create the structure and then use autoGuess(address,0,4096)
set the Name property and then call addToGlobalStructureList()
when done set the MainStruct property of the structure form to the created structure
---
also, you don't have to scan through all the forms to find a structure dissect window, you can also use enumStructureForms()
and instead of scanning for an edit box you can go through the structureColumns and assign the address or addressText there
_________________
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 |
|
 |
Csimbi I post too much
Reputation: 97
Joined: 14 Jul 2007 Posts: 3327
|
Posted: Fri Apr 19, 2024 1:35 am Post subject: |
|
|
I use it a lot too, so I am curious how this idea plays out.
Be sure to post your extension when you're done.
Thanks!
|
|
| Back to top |
|
 |
24quant42 Cheater
Reputation: 0
Joined: 19 Apr 2023 Posts: 31
|
Posted: Fri Apr 19, 2024 8:17 am Post subject: |
|
|
| Dark Byte wrote: | https://github.com/cheat-engine/cheat-engine/blob/dc08c7db1d9b936e4e486ad78e7aa73308b6bb5b/Cheat%20Engine/bin/celua.txt#L2718
|
Thank you) I understood a lot from this document)
| Csimbi wrote: | I use it a lot too, so I am curious how this idea plays out.
Be sure to post your extension when you're done.
Thanks! |
Okay, I'll send it
-------------------------------------------------------
https://github.com/cheat-engine/cheat-engine/blob/dc08c7db1d9b936e4e486ad78e7aa73308b6bb5b/Cheat%20Engine/images/Cheat%20Engine%20Icons/structure128x128.png
I also wanted to attach this icon, but I couldn’t add something to the Popup menu item.
In general, here we keep it for those who need it.
I tested it in different versions, I’m not a master of LUA, but I know a little. If you find any errors, I will be glad if you correct and attach them.
| Code: | function getFormStructureDissect()
for k,v in ipairs(enumStructureForms()) do
if v.ClassName=="TfrmStructures2" then
return v
end
end
return nil
end
function MyMenuItemClick()
local addrList = getAddressList()
if addrList.getSelectedRecord()~=nil then
local addr=addrList.getSelectedRecord().Address
local structFrm=getFormStructureDissect()
--Struct
if getStructureCount()<=0 then
local struct=createStructure("Struct")
struct.setName("Struct")
struct.autoGuess(addr,0,4096)
struct.addToGlobalStructureList()
else
if structFrm~=nil then
structFrm.Column[0].AddressText=addr
end
end
--Struct Form
if structFrm~=nil then
local struct=getStructure(0)
sleep(200)
structFrm.MainStruct=struct
else
local newStructFrm=createStructureForm(addr)
local struct=getStructure(0)
sleep(200)
newStructFrm.MainStruct=struct
end
else
showMessage("Select one address from the list of addresses")
end
end
--Mouse PopupMenu--
local addrPopupMenu=getMainForm().PopupMenu2
local addrMenuItems=addrPopupMenu.Items
local itemCaption="Show Structure/Dissect"
function isItemStructureDissectExists()
for i=0, addrMenuItems.Count-1 do
if addrMenuItems[i].Caption==itemCaption then
return true
end
end
return false
end
if not isItemStructureDissectExists() then
local customMenu=createMenuItem(addrPopupMenu)
customMenu.Caption=itemCaption
customMenu.OnClick = MyMenuItemClick
addrMenuItems.insert(addrMenuItems.Count-1, customMenu)
end |
| Description: |
|
| Filesize: |
22.63 KB |
| Viewed: |
3669 Time(s) |

|
|
|
| Back to top |
|
 |
Zephyrusiac Newbie cheater
Reputation: 1
Joined: 05 Feb 2015 Posts: 16
|
Posted: Sat Jun 15, 2024 12:10 am Post subject: |
|
|
| This is great! Any way to also add that option to the mono dissect/.net info windows?
|
|
| Back to top |
|
 |
Csimbi I post too much
Reputation: 97
Joined: 14 Jul 2007 Posts: 3327
|
Posted: Sun Jun 16, 2024 2:46 pm Post subject: |
|
|
| 24quant42 wrote: |
Okay, I'll send it
|
Works well, thanks!
Could you add a variant where the 'value' field is used as the address?
You know, for pointers.
Thanks!
|
|
| Back to top |
|
 |
|