[WIP] First pass at script decompilation

This commit is contained in:
Yoshi Askharoun
2025-07-18 00:23:23 -05:00
parent 059e143980
commit f18920fd33
8 changed files with 302 additions and 49 deletions
+17 -1
View File
@@ -11,7 +11,7 @@ using System.Xml.Linq;
namespace Microsoft.Iris.DecompXml;
public class Decompiler
public partial class Decompiler
{
private static readonly XNamespace _nsUix = XNamespace.Get("http://schemas.microsoft.com/2007/uix");
private readonly DecompileContext _context;
@@ -51,6 +51,22 @@ public class Decompiler
if (export.InitializePropertiesOffset is not uint.MaxValue)
AnalyzeMethodForInit(export.InitializePropertiesOffset, xExport, export, name + "_prop");
if (export.InitialEvaluateOffsets is { Length: > 0 })
{
XElement xScripts = new(_nsUix + "Scripts");
foreach (var offset in export.InitialEvaluateOffsets)
{
var syntaxTree = DecompileScript(offset, export);
var scriptText = FormatScript(syntaxTree);
XElement xScript = new(_nsUix + "Script", scriptText);
xScripts.Add(xScript);
}
xExport.Add(xScripts);
}
if (export.InitializeContentOffset is not uint.MaxValue)
AnalyzeMethodForInit(export.InitializeContentOffset, xExport, export, name + "_cont");