Fixed packing for all systems 32 bit users have to use java

This commit is contained in:
NicoAICP 2020-12-13 22:19:21 +01:00
parent 83c9778698
commit 44c38dec03
4 changed files with 53 additions and 9 deletions

View file

@ -8,6 +8,7 @@ using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Timers; using System.Timers;
using System.Windows; using System.Windows;
using UWUVCI_AIO_WPF.Classes;
using UWUVCI_AIO_WPF.UI.Windows; using UWUVCI_AIO_WPF.UI.Windows;
namespace UWUVCI_AIO_WPF namespace UWUVCI_AIO_WPF
@ -102,8 +103,9 @@ namespace UWUVCI_AIO_WPF
} }
else else
{ {
//wnd.is32(); //wnd.is32();
Custom_Message cm = new Custom_Message("Warning", "Some features may cause issues on a 32Bit System. Upgrading to 64Bit would be recommended. \nReport any issues in the UWUVCI Discord, or ping @NicoAICP in #wiiu-assistance in the Nintendo Homebrew discord. "); Custom_Message cm = new Custom_Message("Warning", "Some features may cause issues on a 32Bit System. Upgrading to 64Bit would be recommended.\nDue to an Issue with packing on 32Bit Systems, you need Java installed for packing. \nReport any issues in the UWUVCI Discord, or ping @NicoAICP in #wiiu-assistance in the Nintendo Homebrew discord. ");
cm.ShowDialog(); cm.ShowDialog();
} }

View file

@ -1682,7 +1682,7 @@ namespace UWUVCI_AIO_WPF
mvvm.foldername = $"[WUP]{reg.Replace(gameName, "").Replace("|", " ")}_{i}"; mvvm.foldername = $"[WUP]{reg.Replace(gameName, "").Replace("|", " ")}_{i}";
i++; i++;
} }
var oldpath = Directory.GetCurrentDirectory();
mvm.Progress = 40; mvm.Progress = 40;
mvm.msg = "Packing..."; mvm.msg = "Packing...";
using (Process cnuspacker = new Process()) using (Process cnuspacker = new Process())
@ -1692,12 +1692,19 @@ namespace UWUVCI_AIO_WPF
cnuspacker.StartInfo.UseShellExecute = false; cnuspacker.StartInfo.UseShellExecute = false;
cnuspacker.StartInfo.CreateNoWindow = true; cnuspacker.StartInfo.CreateNoWindow = true;
} }
if (Environment.Is64BitOperatingSystem)
{
cnuspacker.StartInfo.FileName = Path.Combine(toolsPath, "CNUSPACKER.exe"); cnuspacker.StartInfo.FileName = Path.Combine(toolsPath, "CNUSPACKER.exe");
cnuspacker.StartInfo.Arguments = $"-in \"{baseRomPath}\" -out \"{outputPath}\" -encryptKeyWith {Properties.Settings.Default.Ckey}"; cnuspacker.StartInfo.Arguments = $"-in \"{baseRomPath}\" -out \"{outputPath}\" -encryptKeyWith {Properties.Settings.Default.Ckey}";
}
else
{
cnuspacker.StartInfo.FileName = "java";
cnuspacker.StartInfo.Arguments = $"-jar \"{Path.Combine(toolsPath, "NUSPacker.jar")}\" -in \"{baseRomPath}\" -out \"{outputPath}\" -encryptKeyWith {Properties.Settings.Default.Ckey}";
}
cnuspacker.Start(); cnuspacker.Start();
cnuspacker.WaitForExit(); cnuspacker.WaitForExit();
Directory.SetCurrentDirectory(oldpath);
} }
mvm.Progress = 90; mvm.Progress = 90;
mvm.msg = "Cleaning..."; mvm.msg = "Cleaning...";

View file

@ -506,6 +506,13 @@ namespace UWUVCI_AIO_WPF
} }
public MainViewModel() public MainViewModel()
{ {
if (!Environment.Is64BitOperatingSystem)
{
List<string> Tools = ToolCheck.ToolNames.ToList();
Tools.Remove("CNUSPACKER.exe");
Tools.Add("NUSPacker.jar");
ToolCheck.ToolNames = Tools.ToArray();
}
//if (Directory.Exists(@"Tools")) Directory.Delete(@"Tools", true); //if (Directory.Exists(@"Tools")) Directory.Delete(@"Tools", true);

View file

@ -0,0 +1,28 @@
namespace UWUVCI_AIO_WPF.Properties {
// Diese Klasse ermöglicht die Behandlung bestimmter Ereignisse der Einstellungsklasse:
// Das SettingChanging-Ereignis wird ausgelöst, bevor der Wert einer Einstellung geändert wird.
// Das PropertyChanged-Ereignis wird ausgelöst, nachdem der Wert einer Einstellung geändert wurde.
// Das SettingsLoaded-Ereignis wird ausgelöst, nachdem die Einstellungswerte geladen wurden.
// Das SettingsSaving-Ereignis wird ausgelöst, bevor die Einstellungswerte gespeichert werden.
internal sealed partial class Settings {
public Settings() {
// // Heben Sie die Auskommentierung der unten angezeigten Zeilen auf, um Ereignishandler zum Speichern und Ändern von Einstellungen hinzuzufügen:
//
// this.SettingChanging += this.SettingChangingEventHandler;
//
// this.SettingsSaving += this.SettingsSavingEventHandler;
//
}
private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
// Fügen Sie hier Code zum Behandeln des SettingChangingEvent-Ereignisses hinzu.
}
private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
// Fügen Sie hier Code zum Behandeln des SettingsSaving-Ereignisses hinzu.
}
}
}