diff --git a/ZuneHost/Program.cs b/ZuneHost/Program.cs new file mode 100644 index 0000000..8640bfb --- /dev/null +++ b/ZuneHost/Program.cs @@ -0,0 +1,76 @@ +using Silk.NET.Windowing; +using System; +using System.IO; +using System.Reflection; +using System.Threading; + +namespace ZuneHost +{ + internal class Program + { + static string? _zuneProgramFolder; + + static void Main(string[] args) + { + Console.WriteLine("Creating splash window..."); + + string strArgs = string.Join(' ', args); + + // Make sure that ZuneDBApi can find all the Zune native libraries + Console.WriteLine("Setting up dependency resolver..."); + _zuneProgramFolder = Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), + "Zune"); + foreach (string file in Directory.GetFiles(_zuneProgramFolder)) + { + string fileName = Path.GetFileName(file); + if ((fileName.StartsWith("Zune") || fileName.StartsWith("UIX")) + && file.EndsWith(".dll") + && fileName != "ZuneDbApi.dll") + { + string targetPath = Path.Combine(Environment.CurrentDirectory, fileName); + if (!File.Exists(targetPath)) + File.Copy(file, targetPath); + } + } + //AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; + + Console.WriteLine("Starting Zune..."); + + Thread zuneThread = new Thread(new ThreadStart(() => + { + Microsoft.Zune.Shell.ZuneApplication.Launch(strArgs, IntPtr.Zero); + })); + zuneThread.SetApartmentState(ApartmentState.STA); + zuneThread.Start(); + + //Thread t = new(() => + // Microsoft.Zune.Shell.ZuneApplication.Launch(strArgs, IntPtr.Zero)); + //t.SetApartmentState(ApartmentState.STA); + //t.Start(); + } + + private static Assembly? CurrentDomain_AssemblyResolve(object? sender, ResolveEventArgs args) + { + string fileName = args.Name[..args.Name.IndexOf(",")]; + + if (fileName == "ZuneDBApi") + { + string assemblyPath = Path.Combine(Directory.GetCurrentDirectory(), "ZuneDBApi.dll"); + bool exists = File.Exists(assemblyPath); + return Assembly.LoadFrom(assemblyPath); + } + else if (!fileName.StartsWith("Zune")) + { + return null; + } + else + { + string assemblyPath = Path.Combine( + _zuneProgramFolder ?? throw new ArgumentNullException(), + fileName + ".dll"); + return Assembly.Load(assemblyPath); + } + } + } +} \ No newline at end of file diff --git a/ZuneHost/ZuneHost.csproj b/ZuneHost/ZuneHost.csproj new file mode 100644 index 0000000..ae76468 --- /dev/null +++ b/ZuneHost/ZuneHost.csproj @@ -0,0 +1,17 @@ + + + + Exe + net6.0 + AnyCPU;x64;x86;ARM32 + + true + enable + + + + + + + + diff --git a/ZuneShell.sln b/ZuneShell.sln index 7941390..e2f1b87 100644 --- a/ZuneShell.sln +++ b/ZuneShell.sln @@ -6,42 +6,88 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZuneShell", "ZuneShell\Zune EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libs", "libs", "{7640D6FE-600E-44BE-A59F-E90602FA7754}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UIX", "libs\MicrosoftIris\UIX\UIX.csproj", "{78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UIX", "libs\MicrosoftIris\UIX\UIX.csproj", "{78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UIX.RenderApi", "libs\MicrosoftIris\UIX.RenderApi\UIX.RenderApi.csproj", "{CB2B7609-C7B8-4E2A-82D8-DD631B70B621}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZuneHost", "ZuneHost\ZuneHost.csproj", "{4041A91F-EF2A-4C47-9EBE-F4E862532345}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|ARM32 = Debug|ARM32 Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU + Release|ARM32 = Release|ARM32 Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Debug|Any CPU.ActiveCfg = Debug|x64 {E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Debug|Any CPU.Build.0 = Debug|x64 + {E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Debug|ARM32.ActiveCfg = Debug|x64 + {E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Debug|ARM32.Build.0 = Debug|x64 {E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Debug|x64.ActiveCfg = Debug|x64 {E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Debug|x64.Build.0 = Debug|x64 + {E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Debug|x86.ActiveCfg = Debug|x86 + {E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Debug|x86.Build.0 = Debug|x86 {E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Release|Any CPU.ActiveCfg = Release|x64 {E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Release|Any CPU.Build.0 = Release|x64 + {E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Release|ARM32.ActiveCfg = Release|x64 + {E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Release|ARM32.Build.0 = Release|x64 {E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Release|x64.ActiveCfg = Release|x64 {E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Release|x64.Build.0 = Release|x64 + {E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Release|x86.ActiveCfg = Release|x86 + {E93CFFA3-1EEB-4E71-9E83-7377C1422119}.Release|x86.Build.0 = Release|x86 {78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Debug|ARM32.ActiveCfg = Debug|Any CPU + {78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Debug|ARM32.Build.0 = Debug|Any CPU {78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Debug|x64.ActiveCfg = Debug|x64 {78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Debug|x64.Build.0 = Debug|x64 + {78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Debug|x86.ActiveCfg = Debug|x86 + {78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Debug|x86.Build.0 = Debug|x86 {78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Release|Any CPU.ActiveCfg = Release|Any CPU {78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Release|Any CPU.Build.0 = Release|Any CPU + {78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Release|ARM32.ActiveCfg = Release|Any CPU + {78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Release|ARM32.Build.0 = Release|Any CPU {78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Release|x64.ActiveCfg = Release|x64 {78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Release|x64.Build.0 = Release|x64 + {78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Release|x86.ActiveCfg = Release|x86 + {78A8B08C-C0E9-4BAC-9AF6-58D3A55C05C9}.Release|x86.Build.0 = Release|x86 {CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Debug|x64.ActiveCfg = Debug|Any CPU - {CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Debug|x64.Build.0 = Debug|Any CPU + {CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Debug|ARM32.ActiveCfg = Debug|Any CPU + {CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Debug|ARM32.Build.0 = Debug|Any CPU + {CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Debug|x64.ActiveCfg = Debug|x64 + {CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Debug|x64.Build.0 = Debug|x64 + {CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Debug|x86.ActiveCfg = Debug|x86 + {CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Debug|x86.Build.0 = Debug|x86 {CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Release|Any CPU.ActiveCfg = Release|Any CPU {CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Release|Any CPU.Build.0 = Release|Any CPU + {CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Release|ARM32.ActiveCfg = Release|Any CPU + {CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Release|ARM32.Build.0 = Release|Any CPU {CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Release|x64.ActiveCfg = Release|Any CPU {CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Release|x64.Build.0 = Release|Any CPU + {CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Release|x86.ActiveCfg = Release|x86 + {CB2B7609-C7B8-4E2A-82D8-DD631B70B621}.Release|x86.Build.0 = Release|x86 + {4041A91F-EF2A-4C47-9EBE-F4E862532345}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4041A91F-EF2A-4C47-9EBE-F4E862532345}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4041A91F-EF2A-4C47-9EBE-F4E862532345}.Debug|ARM32.ActiveCfg = Debug|ARM32 + {4041A91F-EF2A-4C47-9EBE-F4E862532345}.Debug|ARM32.Build.0 = Debug|ARM32 + {4041A91F-EF2A-4C47-9EBE-F4E862532345}.Debug|x64.ActiveCfg = Debug|x64 + {4041A91F-EF2A-4C47-9EBE-F4E862532345}.Debug|x64.Build.0 = Debug|x64 + {4041A91F-EF2A-4C47-9EBE-F4E862532345}.Debug|x86.ActiveCfg = Debug|x86 + {4041A91F-EF2A-4C47-9EBE-F4E862532345}.Debug|x86.Build.0 = Debug|x86 + {4041A91F-EF2A-4C47-9EBE-F4E862532345}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4041A91F-EF2A-4C47-9EBE-F4E862532345}.Release|Any CPU.Build.0 = Release|Any CPU + {4041A91F-EF2A-4C47-9EBE-F4E862532345}.Release|ARM32.ActiveCfg = Release|ARM32 + {4041A91F-EF2A-4C47-9EBE-F4E862532345}.Release|ARM32.Build.0 = Release|ARM32 + {4041A91F-EF2A-4C47-9EBE-F4E862532345}.Release|x64.ActiveCfg = Release|Any CPU + {4041A91F-EF2A-4C47-9EBE-F4E862532345}.Release|x64.Build.0 = Release|Any CPU + {4041A91F-EF2A-4C47-9EBE-F4E862532345}.Release|x86.ActiveCfg = Release|x86 + {4041A91F-EF2A-4C47-9EBE-F4E862532345}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/ZuneShell/ZuneShell.csproj b/ZuneShell/ZuneShell.csproj index 232b7aa..4491306 100644 --- a/ZuneShell/ZuneShell.csproj +++ b/ZuneShell/ZuneShell.csproj @@ -9,9 +9,7 @@ ZuneShell 4.7.0.0 - net35 - v3.5 - 3.5 + net35;net6.0 x64;x86 512 @@ -22,16 +20,24 @@ True - + + v3.5 + 3.5 + + + - + + + C:\Program Files\Zune\ZuneDBApi.dll C:\Program Files\Zune\UIXcontrols.dll + \ No newline at end of file diff --git a/libs/MicrosoftIris b/libs/MicrosoftIris index 4a6bca1..72bba3f 160000 --- a/libs/MicrosoftIris +++ b/libs/MicrosoftIris @@ -1 +1 @@ -Subproject commit 4a6bca1e9f4c6e2d8f175061b64fcb135bd738a6 +Subproject commit 72bba3fe14b491c2866fb8f8725ef4a5e4a12f3d