[WIP] Execute UIXA at runtime

This commit is contained in:
Yoshi Askharoun
2025-01-28 15:41:41 -06:00
parent 0c086dd725
commit 92f05b9692
246 changed files with 1719542 additions and 10 deletions
+36 -8
View File
@@ -1,4 +1,6 @@
using System; using Microsoft.Iris.Session;
using System;
using System.Collections;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@@ -21,15 +23,24 @@ namespace ZuneHost.Wpf
{ {
InitializeComponent(); InitializeComponent();
Loaded += MainWindow_Loaded; Loaded += MainWindow_Loaded;
AppDomain.CurrentDomain.UnhandledException += DumpErrorsOnEvent;
}
private void DumpErrorsOnEvent(object sender, EventArgs e)
{
PrintErrors(ErrorManager.GetErrors());
} }
private void MainWindow_Loaded(object sender, RoutedEventArgs e) private void MainWindow_Loaded(object sender, RoutedEventArgs e)
{ {
var debug = false;
// Construct a single string of args. Be sure to skip executing path. // Construct a single string of args. Be sure to skip executing path.
var args = Environment.GetCommandLineArgs().Skip(1); var args = Environment.GetCommandLineArgs().Skip(1);
#if DEBUG
args = args.Concat(new[] { $"-uixdebuguri", }); if (debug)
#endif args = args.Concat(new[] { $"-uixdebuguri", });
string strArgs = string.Join(" ", args.ToArray()); string strArgs = string.Join(" ", args.ToArray());
// Make sure that ZuneDBApi can find all the Zune native libraries // Make sure that ZuneDBApi can find all the Zune native libraries
@@ -75,10 +86,15 @@ namespace ZuneHost.Wpf
IrisApp.DebugSettings.DataMappingModels.CollectionChanged += DataMappingModels_CollectionChanged; IrisApp.DebugSettings.DataMappingModels.CollectionChanged += DataMappingModels_CollectionChanged;
} }
// Set decompiler breakponts if (debug)
//IrisApp.DebugSettings.Breakpoints.Add(new("clr-res://ZuneShell!QuickplayStrip.uix", 172, 25, false)); {
//IrisApp.DebugSettings.Breakpoints.Add(new("clr-res://ZuneMarketplaceResources!SelectionActions.uix", 121, 14, false)); // Set decompiler breakponts
//IrisApp.DebugSettings.Breakpoints.Add(new("clr-res://ZuneShell!Quickplay.uix", 917, 62, false)); IrisApp.DebugSettings.Breakpoints.Add(new("clr-res://ZuneShell!QuickplayStrip.uix", 172, 25, false));
IrisApp.DebugSettings.Breakpoints.Add(new("clr-res://ZuneMarketplaceResources!SelectionActions.uix", 121, 14, false));
IrisApp.DebugSettings.Breakpoints.Add(new("clr-res://ZuneShell!Quickplay.uix", 917, 62, false));
}
ErrorManager.OnErrors += PrintErrors;
IntPtr hWnd = new System.Windows.Interop.WindowInteropHelper(this).Handle; IntPtr hWnd = new System.Windows.Interop.WindowInteropHelper(this).Handle;
Thread zuneThread = new(new ThreadStart(() => Thread zuneThread = new(new ThreadStart(() =>
@@ -86,6 +102,7 @@ namespace ZuneHost.Wpf
IrisApp.Initialized += delegate IrisApp.Initialized += delegate
{ {
IrisApp.AddImportRedirect("res://ZuneShellResources!", "clr-res://ZuneShell!"); IrisApp.AddImportRedirect("res://ZuneShellResources!", "clr-res://ZuneShell!");
Microsoft.Iris.Asm.Assembler.RegisterLoader();
}; };
Microsoft.Zune.Shell.ZuneApplication.Launch(strArgs, hWnd); Microsoft.Zune.Shell.ZuneApplication.Launch(strArgs, hWnd);
@@ -151,5 +168,16 @@ namespace ZuneHost.Wpf
CopyAll(diSourceDir, nextTargetDir); CopyAll(diSourceDir, nextTargetDir);
} }
} }
private static void PrintErrors(IEnumerable errors)
{
foreach (var error in errors.OfType<ErrorRecord>())
{
if (error.Warning) continue;
Debug.Write(error.Warning ? "WARNING: " : "ERROR: ");
Debug.WriteLine(error.Message);
}
}
} }
} }
+1
View File
@@ -10,6 +10,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\ZuneUIXTools\libs\UIX.Asm\UIX.Asm.csproj" />
<ProjectReference Include="..\ZuneShell\ZuneShell.csproj" /> <ProjectReference Include="..\ZuneShell\ZuneShell.csproj" />
</ItemGroup> </ItemGroup>
@@ -38,6 +38,7 @@ namespace Microsoft.Zune.Shell
{ {
public class ZuneApplication public class ZuneApplication
{ {
private const bool UseUixa = true;
private const string ResourceDllName = "ZuneShellResources.dll"; private const string ResourceDllName = "ZuneShellResources.dll";
private const int ApplicationIconResourceId = 1; private const int ApplicationIconResourceId = 1;
private static ZuneLibrary _zuneLibrary; private static ZuneLibrary _zuneLibrary;
@@ -481,7 +482,9 @@ namespace Microsoft.Zune.Shell
Application.Window.CloseRequested += new WindowCloseRequestedHandler(CodeDialogManager.Instance.OnWindowCloseRequested); Application.Window.CloseRequested += new WindowCloseRequestedHandler(CodeDialogManager.Instance.OnWindowCloseRequested);
CodeDialogManager.Instance.WindowCloseNotBlocked += new EventHandler(OnWindowCloseNotBlocked); CodeDialogManager.Instance.WindowCloseNotBlocked += new EventHandler(OnWindowCloseNotBlocked);
Application.Window.SessionConnected += new SessionConnectedHandler(OnSessionConnected); Application.Window.SessionConnected += new SessionConnectedHandler(OnSessionConnected);
string source = "res://ZuneShellResources!Frame.uix#Frame"; string source = UseUixa
? "clr-res://ZuneShell!Frame.uixa#Frame"
: "res://ZuneShellResources!Frame.uix#Frame";
_hWndSplashScreen = hWndSplashScreen; _hWndSplashScreen = hWndSplashScreen;
_initializationFailsafe = new InitializationFailsafe(); _initializationFailsafe = new InitializationFailsafe();
@@ -537,6 +540,7 @@ namespace Microsoft.Zune.Shell
private static void MarkupSystem_NewMarkupLoaded(object sender, Iris.Markup.LoadResult e) private static void MarkupSystem_NewMarkupLoaded(object sender, Iris.Markup.LoadResult e)
{ {
return;
if (e is not Iris.Markup.MarkupLoadResult loadResult) if (e is not Iris.Markup.MarkupLoadResult loadResult)
return; return;
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More