From 6db0d6981661bfcb304c04ad1d61c1eb5cbfdae9 Mon Sep 17 00:00:00 2001 From: Erik Date: Thu, 20 Aug 2026 20:46:34 +0200 Subject: [PATCH] tools(LayoutDump): print the BUILT widget tree beside the authored one "This control is in the wrong place" has exactly two possible causes: the dat authored it there, or our importer moved it. Printing only the authored tree answers half the question. --built runs LayoutImporter.Build over the same ElementInfo and prints the resulting widget geometry underneath, so the two can be compared directly. On the effects window they match exactly, which is how the "misaligned scrollbar" report was ruled out as an import bug rather than assumed to be one. Co-Authored-By: Claude Opus 5 --- tools/LayoutDump/Program.cs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tools/LayoutDump/Program.cs b/tools/LayoutDump/Program.cs index fe7a2a1b..a30e43a5 100644 --- a/tools/LayoutDump/Program.cs +++ b/tools/LayoutDump/Program.cs @@ -8,6 +8,7 @@ // // dotnet run --project tools/LayoutDump -- 0x21000071 // dotnet run --project tools/LayoutDump -- 0x2100002F 0x1000018E --states +using AcDream.App.UI; using AcDream.App.UI.Layout; using AcDream.Content; using DatReaderWriter; @@ -42,8 +43,30 @@ if (root is null) Console.WriteLine($"layout 0x{ids[0]:X8}"); Print(root, 0); + +if (args.Contains("--built")) +{ + // What the importer actually PRODUCES, next to what the dat authored. + // A difference between the two is the whole question for any "this + // control is in the wrong place" report. + Console.WriteLine(); + Console.WriteLine("built widget tree:"); + ImportedLayout built = LayoutImporter.Build(root, _ => (0u, 0, 0), null, _ => null); + PrintBuilt(built.Root, 0); +} return 0; +void PrintBuilt(UiElement e, int depth) +{ + string pad = new(' ', depth * 2); + Console.WriteLine( + $"{pad}{e.GetType().Name,-20} id=0x{e.EventId:X8} " + + $"L={e.Left,6:0.#} T={e.Top,6:0.#} W={e.Width,6:0.#} H={e.Height,6:0.#} " + + $"vis={e.Visible}"); + foreach (UiElement child in e.Children) + PrintBuilt(child, depth + 1); +} + void Print(ElementInfo e, int depth) { string pad = new(' ', depth * 2);