Page 1 of 1

Comparison Tools

Posted: Mon Apr 07, 2025 2:40 pm
by SilverRabbit90
I would like to share some tools to automatically compare.

Dissect Data Method Tool:
[Link]

Use with this Lua script:
Spoiler

Code: Select all

function createSequentialElements(structureFrm, vartype, description, displayMethod)
    if not structureFrm.mainStruct then return end

    -- Remove existing elements
    while structureFrm.mainStruct.Count > 0 do
        structureFrm.mainStruct.Element[0].destroy()
    end

    -- Create 1656 elements with incremental offset of 1 byte
    for i = 0, 1656 do
        local element = structureFrm.mainStruct.addElement()
        element.Offset = i
        element.Vartype = vartype
        element.Bytesize = 4
        element.OffsetHex = string.format("%08X", element.Offset)
        element.Description = description
        element.DisplayMethod = displayMethod
    end

    -- Update the display
    structureFrm.tvStructureView.refresh()
end

function addMenuItem(timer, form)
    local popupMenu = form.pmStructureView
    if popupMenu then
        timer.destroy()

        -- Menu item for 4-byte sequence
        local miCreateDword = createMenuItem(popupMenu)
        miCreateDword.Caption = "Create 4-byte Sequence"
        miCreateDword.OnClick = function()
            createSequentialElements(form, vtDword, "4 Bytes", "unsigned integer")
        end

        -- Menu item for float sequence
        local miCreateFloat = createMenuItem(popupMenu)
        miCreateFloat.Caption = "Create Float Sequence"
        miCreateFloat.OnClick = function()
            createSequentialElements(form, vtSingle, "Float", "float")
        end

        -- Add items to the menu
        popupMenu.Items.add(miCreateDword)
        popupMenu.Items.add(miCreateFloat)

        -- Always show the items
        popupMenu.OnPopup = function()
            miCreateDword.Visible = true
            miCreateFloat.Visible = true
        end
    end
end

-- Register the hook for dissect windows
registerFormAddNotification(function(form)
    if form.ClassName == "TfrmStructures2" then
        local timer = createTimer()
        timer.Interval = 100
        timer.OnTimer = function(t)
            addMenuItem(t, form)
            t.destroy()
        end
    end
end)

This Lua script allows you to set the dissect data to show all the offsets (not just every 4 offsets as it usually does).

By modifying this part:

-- Create 1656 elements with incremental offset of 1 byte
for i = 0, 1656 do


Instead of 1656, you can use a much larger number of offsets (for example, for i = 0, 5000 do), but the conversion will be slower (although it will increase the chances of finding static values in the dissect data).

Insert the lua script in "Show Chat Table Lua Script" ( press Ctrl+Alt+L). After each changes press "Execute script" button.


Once you're in the dissect data, right-click on any item in the list and select "Create 4-byte Sequence" or "Create Float Sequence".


Lua script Video:
Spoiler
Tool Video:
Spoiler



Stack View Method Tool:
[Link]

Video:
Spoiler



Registers Method Tool:
[Link]

Video:
Spoiler
.


Here is my Cheat Engine Tutorial:
[Link]

.

Re: Comparison Tools

Posted: Wed Apr 30, 2025 11:24 am
by SilverRabbit90
Added a new method (lua method):

viewtopic.php?f=14&t=34595&p=405295#p405295

See point 19 (and 20):
19) Copy "Structure Compare" Elements & Auto compare "Structure Compare" (Commonalities)