From 3aa9af53645c4c4bfc9dabb0a9db40b56b76a852 Mon Sep 17 00:00:00 2001 From: ZestyTS Date: Sun, 28 Aug 2022 14:43:34 -0700 Subject: [PATCH] Changed code to hotfix CNUSPacker --- UWUVCI AIO WPF/Classes/Injection.cs | 39 +++++++++++++++----------- UWUVCI AIO WPF/Classes/ToolCheck.cs | 5 ++-- UWUVCI AIO WPF/Models/MainViewModel.cs | 2 +- 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/UWUVCI AIO WPF/Classes/Injection.cs b/UWUVCI AIO WPF/Classes/Injection.cs index 0b49ffd..54df830 100644 --- a/UWUVCI AIO WPF/Classes/Injection.cs +++ b/UWUVCI AIO WPF/Classes/Injection.cs @@ -1624,21 +1624,24 @@ namespace UWUVCI_AIO_WPF mvm.Progress = 40; mvm.msg = "Packing..."; - if (Environment.Is64BitOperatingSystem) - CNUSPACKER.Program.Main(new string[] { "-in", baseRomPath, "-out", outputPath, "-encryptKeyWidth", Settings.Default.Ckey }); + using var cnuspacker = new Process(); + if (!mvm.debug) + { + cnuspacker.StartInfo.UseShellExecute = false; + cnuspacker.StartInfo.CreateNoWindow = true; + } + if (false) + { + cnuspacker.StartInfo.FileName = Path.Combine(toolsPath, "CNUSPACKER.exe"); + cnuspacker.StartInfo.Arguments = $"-in \"{baseRomPath}\" -out \"{outputPath}\" -encryptKeyWith {Properties.Settings.Default.Ckey}"; + } else { - using var cnuspacker = new Process(); - if (!mvm.debug) - { - cnuspacker.StartInfo.UseShellExecute = false; - cnuspacker.StartInfo.CreateNoWindow = true; - } cnuspacker.StartInfo.FileName = "java"; - cnuspacker.StartInfo.Arguments = $"-jar \"{Path.Combine(toolsPath, "NUSPacker.jar")}\" -in \"{baseRomPath}\" -out \"{outputPath}\" -encryptKeyWith {Settings.Default.Ckey}"; - cnuspacker.Start(); - cnuspacker.WaitForExit(); + cnuspacker.StartInfo.Arguments = $"-jar \"{Path.Combine(toolsPath, "NUSPacker.jar")}\" -in \"{baseRomPath}\" -out \"{outputPath}\" -encryptKeyWith {Properties.Settings.Default.Ckey}"; } + cnuspacker.Start(); + cnuspacker.WaitForExit(); mvm.Progress = 90; mvm.msg = "Cleaning..."; Clean(); @@ -2416,7 +2419,7 @@ namespace UWUVCI_AIO_WPF CopyAndConvertImage(Path.Combine(toolsPath, "bootTvTex.png"), Path.Combine(imgPath), false, 1280, 720, 24, "bootTvTex.tga"); usetemp = true; } - Images.Add(fileExists); + Images.Add(fileExists); } } else @@ -2481,7 +2484,7 @@ namespace UWUVCI_AIO_WPF File.Copy(Path.Combine(tempPath, "bootTvTex.png"), Path.Combine(tempPath, "bootDrcTex.png")); - if (File.Exists(Path.Combine(tempPath, "bootTvTex.png"))) + if (File.Exists(Path.Combine(tempPath, "bootTvTex.png"))) File.Delete(Path.Combine(tempPath, "bootTvTex.png")); if (File.Exists($"bootTvTex.{config.TGATv.extension}")) @@ -2583,13 +2586,15 @@ namespace UWUVCI_AIO_WPF } catch (Exception e) { - if (e.Message.Contains("Size")) + if (!e.Message.Contains("Could not find")) { - throw e; + if (e.Message.Contains("Size")) + { + throw e; + } + throw new Exception("Images"); } - throw new Exception("Images"); } - } private static void CopyAndConvertImage(string inputPath, string outputPath, bool delete, int widht, int height, int bit, string newname) diff --git a/UWUVCI AIO WPF/Classes/ToolCheck.cs b/UWUVCI AIO WPF/Classes/ToolCheck.cs index 8ef581a..a9cd116 100644 --- a/UWUVCI AIO WPF/Classes/ToolCheck.cs +++ b/UWUVCI AIO WPF/Classes/ToolCheck.cs @@ -12,7 +12,7 @@ namespace UWUVCI_AIO_WPF.Classes class ToolCheck { static string FolderName = new FileInfo(System.Reflection.Assembly.GetEntryAssembly().Location).DirectoryName + "\\bin\\Tools"; - public static string backupulr = @"https://github.com/Hotbrawl20/UWUVCI-Tools/raw/master/" + (Environment.Is64BitProcess ? "x64/" : ""); + public static string backupulr = @"https://github.com/Hotbrawl20/UWUVCI-Tools/raw/master/"; public static string[] ToolNames = { "N64Converter.exe", @@ -54,7 +54,8 @@ namespace UWUVCI_AIO_WPF.Classes "font2.ttf", "forwarder.dol", "gba1.zip", - "gba2.zip" + "gba2.zip", + "CNUSPACKER.exe" }; public static bool DoesToolsFolderExist() diff --git a/UWUVCI AIO WPF/Models/MainViewModel.cs b/UWUVCI AIO WPF/Models/MainViewModel.cs index 5034d55..5ce093f 100644 --- a/UWUVCI AIO WPF/Models/MainViewModel.cs +++ b/UWUVCI AIO WPF/Models/MainViewModel.cs @@ -486,7 +486,7 @@ namespace UWUVCI_AIO_WPF } public MainViewModel() { - if (!Environment.Is64BitOperatingSystem) + if (true) { List Tools = ToolCheck.ToolNames.ToList(); Tools.Add("NUSPacker.jar");