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);