From efaa2c05772f8c81012b6d4a0c4ef778415e753c Mon Sep 17 00:00:00 2001 From: ZestyTS Date: Wed, 15 Jun 2022 20:06:43 -0700 Subject: [PATCH 001/102] Added something, idk pls advise --- .../Configurations/WiiConfig.xaml | 4 +- .../Configurations/WiiConfig.xaml.cs | 69 ++++++++++++++++++- 2 files changed, 70 insertions(+), 3 deletions(-) diff --git a/UWUVCI AIO WPF/UI/Frames/InjectFrames/Configurations/WiiConfig.xaml b/UWUVCI AIO WPF/UI/Frames/InjectFrames/Configurations/WiiConfig.xaml index 3001d80..ef9e860 100644 --- a/UWUVCI AIO WPF/UI/Frames/InjectFrames/Configurations/WiiConfig.xaml +++ b/UWUVCI AIO WPF/UI/Frames/InjectFrames/Configurations/WiiConfig.xaml @@ -15,7 +15,7 @@ - diff --git a/UWUVCI AIO WPF/UI/Frames/StartFrame.xaml b/UWUVCI AIO WPF/UI/Frames/StartFrame.xaml index 904cf3d..4e757db 100644 --- a/UWUVCI AIO WPF/UI/Frames/StartFrame.xaml +++ b/UWUVCI AIO WPF/UI/Frames/StartFrame.xaml @@ -9,7 +9,7 @@ Title="SettingsFrame" > - + From 94bfdde67e906a947ac4a2f54cfc5d264598de99 Mon Sep 17 00:00:00 2001 From: ZestyTS Date: Wed, 24 Aug 2022 00:01:22 -0700 Subject: [PATCH 068/102] Simple thing that really bothered me --- UWUVCI AIO WPF/UI/Windows/Custom Message.xaml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UWUVCI AIO WPF/UI/Windows/Custom Message.xaml.cs b/UWUVCI AIO WPF/UI/Windows/Custom Message.xaml.cs index 539895c..187ce4b 100644 --- a/UWUVCI AIO WPF/UI/Windows/Custom Message.xaml.cs +++ b/UWUVCI AIO WPF/UI/Windows/Custom Message.xaml.cs @@ -166,7 +166,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows Close(); var containNintendont = Message.Content.ToString().ToLower().Contains("nintendont"); - SDSetup sd = new SDSetup(containNintendont ? true : false, path); + SDSetup sd = new SDSetup(containNintendont, path); try { sd.Owner = (FindResource("mvm") as MainViewModel).mw; From 2857dca0291d44f93e0763faf0375c7777e54648 Mon Sep 17 00:00:00 2001 From: ZestyTS Date: Wed, 24 Aug 2022 00:01:35 -0700 Subject: [PATCH 069/102] Simplified code --- UWUVCI AIO WPF/Classes/Injection.cs | 231 +++++++++++----------------- 1 file changed, 91 insertions(+), 140 deletions(-) diff --git a/UWUVCI AIO WPF/Classes/Injection.cs b/UWUVCI AIO WPF/Classes/Injection.cs index 20cdba2..e45026d 100644 --- a/UWUVCI AIO WPF/Classes/Injection.cs +++ b/UWUVCI AIO WPF/Classes/Injection.cs @@ -1617,36 +1617,27 @@ namespace UWUVCI_AIO_WPF int i = 0; while (Directory.Exists(outputPath)) { - outputPath = Path.Combine(Properties.Settings.Default.OutPath, $"[WUP]{reg.Replace(gameName, "").Replace("|", " ")}_{i}"); + outputPath = Path.Combine(Settings.Default.OutPath, $"[WUP]{reg.Replace(gameName, "").Replace("|", " ")}_{i}"); mvvm.foldername = $"[WUP]{reg.Replace(gameName, "").Replace("|", " ")}_{i}"; i++; } - var oldpath = Directory.GetCurrentDirectory(); mvm.Progress = 40; mvm.msg = "Packing..."; - try - { - Directory.Delete(Environment.GetEnvironmentVariable("LocalAppData") + @"\temp\.net\CNUSPACKER", true); - } - catch { } - if (Environment.Is64BitOperatingSystem) CNUSPACKER.Program.Main(new string[] { "-in", baseRomPath, "-out", outputPath, "-encryptKeyWidth", Settings.Default.Ckey }); else { - using (Process cnuspacker = new Process()) + using var cnuspacker = new Process(); + if (!mvm.debug) { - 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 {Properties.Settings.Default.Ckey}"; - cnuspacker.Start(); - cnuspacker.WaitForExit(); + 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(); } mvm.Progress = 90; mvm.msg = "Cleaning..."; @@ -1678,7 +1669,7 @@ namespace UWUVCI_AIO_WPF if (mvm.GameConfiguration.Console == GameConsoles.WII || mvm.GameConfiguration.Console == GameConsoles.GCN) { mvm.Progress += 10; - foreach (string sFile in Directory.GetFiles(Path.Combine(Properties.Settings.Default.BasePath, $"{b.Name.Replace(":", "")} [{b.Region}]", "content"), "*.nfs")) + foreach (string sFile in Directory.GetFiles(Path.Combine(Settings.Default.BasePath, $"{b.Name.Replace(":", "")} [{b.Region}]", "content"), "*.nfs")) File.Delete(sFile); mvm.Progress += 15; @@ -1710,7 +1701,7 @@ namespace UWUVCI_AIO_WPF { string gameName = string.Empty; //This line of code gives me cancer - if (gameNameOr != null || !String.IsNullOrWhiteSpace(gameNameOr)) + if (gameNameOr != null || !string.IsNullOrWhiteSpace(gameNameOr)) { gameName = gameNameOr; @@ -1725,12 +1716,12 @@ namespace UWUVCI_AIO_WPF string metaXml = Path.Combine(baseRomPath, "meta", "meta.xml"); string appXml = Path.Combine(baseRomPath, "code", "app.xml"); - Random random = new Random(); + Random random = new(); string ID = $"{random.Next(0x3000, 0x10000):X4}{random.Next(0x3000, 0x10000):X4}"; string ID2 = $"{random.Next(0x3000, 0x10000):X4}"; mvvm.prodcode = ID2; - XmlDocument doc = new XmlDocument(); + XmlDocument doc = new(); try { doc.Load(metaXml); @@ -1861,17 +1852,15 @@ namespace UWUVCI_AIO_WPF else { //creating pkg file including the TG16 rom - using (Process TurboInject = new Process()) - { - mvvm.msg = "Creating Turbo16 Pkg..."; - TurboInject.StartInfo.UseShellExecute = false; - TurboInject.StartInfo.CreateNoWindow = true; - TurboInject.StartInfo.FileName = Path.Combine(toolsPath, "BuildPcePkg.exe"); - TurboInject.StartInfo.Arguments = $"\"{injectRomPath}\""; - TurboInject.Start(); - TurboInject.WaitForExit(); - mvvm.Progress = 70; - } + using Process TurboInject = new Process(); + mvvm.msg = "Creating Turbo16 Pkg..."; + TurboInject.StartInfo.UseShellExecute = false; + TurboInject.StartInfo.CreateNoWindow = true; + TurboInject.StartInfo.FileName = Path.Combine(toolsPath, "BuildPcePkg.exe"); + TurboInject.StartInfo.Arguments = $"\"{injectRomPath}\""; + TurboInject.Start(); + TurboInject.WaitForExit(); + mvvm.Progress = 70; } mvvm.msg = "Injecting ROM..."; //replacing tg16 rom @@ -1889,22 +1878,18 @@ namespace UWUVCI_AIO_WPF mvvm.Progress = 20; if (mvvm.pixelperfect) { - using (Process retroinject = new Process()) - { - mvvm.msg = "Applying Pixel Perfect Patches..."; - retroinject.StartInfo.UseShellExecute = false; - retroinject.StartInfo.CreateNoWindow = true; - retroinject.StartInfo.RedirectStandardOutput = true; - retroinject.StartInfo.RedirectStandardError = true; - retroinject.StartInfo.FileName = Path.Combine(toolsPath, "ChangeAspectRatio.exe"); - retroinject.StartInfo.Arguments = $"\"{rpxFile}\""; + using Process retroinject = new Process(); + mvvm.msg = "Applying Pixel Perfect Patches..."; + retroinject.StartInfo.UseShellExecute = false; + retroinject.StartInfo.CreateNoWindow = true; + retroinject.StartInfo.RedirectStandardOutput = true; + retroinject.StartInfo.RedirectStandardError = true; + retroinject.StartInfo.FileName = Path.Combine(toolsPath, "ChangeAspectRatio.exe"); + retroinject.StartInfo.Arguments = $"\"{rpxFile}\""; - retroinject.Start(); - retroinject.WaitForExit(); - mvvm.Progress = 30; - - - } + retroinject.Start(); + retroinject.WaitForExit(); + mvvm.Progress = 30; } using (Process retroinject = new Process()) { @@ -1939,7 +1924,7 @@ namespace UWUVCI_AIO_WPF if (!new FileInfo(injectRomPath).Extension.Contains("gba")) { //it's a GBC or GB rom so it needs to be copied into goomba.gba and then padded to 32Mb (16 would work too but just ot be save) - using (Process goomba = new Process()) + using (Process goomba = new()) { mvvm.msg = "Injecting GB/GBC ROM into goomba..."; goomba.StartInfo.UseShellExecute = false; @@ -1975,7 +1960,7 @@ namespace UWUVCI_AIO_WPF } - using (Process psb = new Process()) + using (Process psb = new()) { mvvm.msg = "Injecting ROM..."; psb.StartInfo.UseShellExecute = false; @@ -2153,8 +2138,8 @@ namespace UWUVCI_AIO_WPF } - File.Copy(Path.Combine(tempPath, "tempd", "code", "font.bin"), Path.Combine(Properties.Settings.Default.BasePath, $"vwiisys", "code", "font.bin")); - File.Copy(Path.Combine(tempPath, "tempd", "code", "deint.txt"), Path.Combine(Properties.Settings.Default.BasePath, $"vwiisys", "code", "deint.txt")); + File.Copy(Path.Combine(tempPath, "tempd", "code", "font.bin"), Path.Combine(Settings.Default.BasePath, $"vwiisys", "code", "font.bin")); + File.Copy(Path.Combine(tempPath, "tempd", "code", "deint.txt"), Path.Combine(Settings.Default.BasePath, $"vwiisys", "code", "deint.txt")); File.Delete(Path.Combine(Properties.Settings.Default.BasePath, $"vwiisys", "code", "app.xml")); } } @@ -2191,7 +2176,7 @@ namespace UWUVCI_AIO_WPF { string mainRomPath = Directory.GetFiles(Path.Combine(baseRomPath, "content", "rom"))[0]; string mainIni = Path.Combine(baseRomPath, "content", "config", $"{Path.GetFileName(mainRomPath)}.ini"); - using (Process n64convert = new Process()) + using (Process n64convert = new()) { mvvm.msg = "Injecting ROM..."; n64convert.StartInfo.UseShellExecute = false; @@ -2326,16 +2311,12 @@ namespace UWUVCI_AIO_WPF mvvm.msg = "Copying INI..."; if (config.INIBin == null) { + File.Delete(mainIni); + if (config.INIPath == null) - { - File.Delete(mainIni); File.Copy(Path.Combine(toolsPath, "blank.ini"), mainIni); - } else - { - File.Delete(mainIni); File.Copy(config.INIPath, mainIni); - } } else { @@ -2366,16 +2347,14 @@ namespace UWUVCI_AIO_WPF private static void RPXcomp(string rpxpath) { - using (Process rpxtool = new Process()) - { - rpxtool.StartInfo.UseShellExecute = false; - rpxtool.StartInfo.CreateNoWindow = true; - rpxtool.StartInfo.FileName = Path.Combine(toolsPath, "wiiurpxtool.exe"); - rpxtool.StartInfo.Arguments = $"-c \"{rpxpath}\""; + using Process rpxtool = new Process(); + rpxtool.StartInfo.UseShellExecute = false; + rpxtool.StartInfo.CreateNoWindow = true; + rpxtool.StartInfo.FileName = Path.Combine(toolsPath, "wiiurpxtool.exe"); + rpxtool.StartInfo.Arguments = $"-c \"{rpxpath}\""; - rpxtool.Start(); - rpxtool.WaitForExit(); - } + rpxtool.Start(); + rpxtool.WaitForExit(); } private static void ReadFileFromBin(byte[] bin, string output) @@ -2388,8 +2367,6 @@ namespace UWUVCI_AIO_WPF bool readbin = false; try { - - //is an image embedded? yes => export them and check for issues //no => using path if (Directory.Exists(imgPath)) // sanity check @@ -2409,17 +2386,11 @@ namespace UWUVCI_AIO_WPF } else { - if (File.Exists(Path.Combine(toolsPath, "iconTex.tga"))) - { + var fileExists = File.Exists(Path.Combine(toolsPath, "iconTex.tga")); + if (fileExists) CopyAndConvertImage(Path.Combine(toolsPath, "iconTex.tga"), Path.Combine(imgPath), false, 128, 128, 32, "iconTex.tga"); - Images.Add(true); - } - else - { - Images.Add(false); - } - + Images.Add(fileExists); } } else @@ -2439,17 +2410,13 @@ namespace UWUVCI_AIO_WPF } else { - if (File.Exists(Path.Combine(toolsPath, "bootTvTex.png"))) + var fileExists = File.Exists(Path.Combine(toolsPath, "bootTvTex.png"); + if (fileExists) { CopyAndConvertImage(Path.Combine(toolsPath, "bootTvTex.png"), Path.Combine(imgPath), false, 1280, 720, 24, "bootTvTex.tga"); usetemp = true; - Images.Add(true); - - } - else - { - Images.Add(false); } + Images.Add(fileExists); } } else @@ -2474,60 +2441,55 @@ namespace UWUVCI_AIO_WPF { if (Images[1]) { - using (Process conv = new Process()) + using Process conv = new Process(); + + if (!mvvm.debug) + { + conv.StartInfo.UseShellExecute = false; + conv.StartInfo.CreateNoWindow = true; + } + if (usetemp) + { + File.Copy(Path.Combine(toolsPath, "bootTvTex.png"), Path.Combine(tempPath, "bootDrcTex.png")); + } + else { - if (!mvvm.debug) + conv.StartInfo.FileName = Path.Combine(toolsPath, "tga2png.exe"); + if (!readbin) { - conv.StartInfo.UseShellExecute = false; - conv.StartInfo.CreateNoWindow = true; - } - if (usetemp) - { - File.Copy(Path.Combine(toolsPath, "bootTvTex.png"), Path.Combine(tempPath, "bootDrcTex.png")); + conv.StartInfo.Arguments = $"-i \"{config.TGATv.ImgPath}\" -o \"{Path.Combine(tempPath)}\""; } else { - - conv.StartInfo.FileName = Path.Combine(toolsPath, "tga2png.exe"); - if (!readbin) + if (config.TGATv.extension.Contains("tga")) { - conv.StartInfo.Arguments = $"-i \"{config.TGATv.ImgPath}\" -o \"{Path.Combine(tempPath)}\""; + ReadFileFromBin(config.TGATv.ImgBin, $"bootTvTex.{config.TGATv.extension}"); + conv.StartInfo.Arguments = $"-i \"bootTvTex.{config.TGATv.extension}\" -o \"{Path.Combine(tempPath)}\""; } else { - if (config.TGATv.extension.Contains("tga")) - { - ReadFileFromBin(config.TGATv.ImgBin, $"bootTvTex.{config.TGATv.extension}"); - conv.StartInfo.Arguments = $"-i \"bootTvTex.{config.TGATv.extension}\" -o \"{Path.Combine(tempPath)}\""; - } - else - { - ReadFileFromBin(config.TGATv.ImgBin, Path.Combine(tempPath, "bootTvTex.png")); - } - - } - if (!readbin || config.TGATv.extension.Contains("tga")) - { - conv.Start(); - conv.WaitForExit(); + ReadFileFromBin(config.TGATv.ImgBin, Path.Combine(tempPath, "bootTvTex.png")); } - File.Copy(Path.Combine(tempPath, "bootTvTex.png"), Path.Combine(tempPath, "bootDrcTex.png")); - if (File.Exists(Path.Combine(tempPath, "bootTvTex.png"))) File.Delete(Path.Combine(tempPath, "bootTvTex.png")); - if (File.Exists($"bootTvTex.{config.TGATv.extension}")) File.Delete($"bootTvTex.{config.TGATv.extension}"); + } + if (!readbin || config.TGATv.extension.Contains("tga")) + { + conv.Start(); + conv.WaitForExit(); } + File.Copy(Path.Combine(tempPath, "bootTvTex.png"), Path.Combine(tempPath, "bootDrcTex.png")); - CopyAndConvertImage(Path.Combine(tempPath, "bootDrcTex.png"), Path.Combine(imgPath), false, 854, 480, 24, "bootDrcTex.tga"); - Images.Add(true); + if (File.Exists(Path.Combine(tempPath, "bootTvTex.png"))) + File.Delete(Path.Combine(tempPath, "bootTvTex.png")); + + if (File.Exists($"bootTvTex.{config.TGATv.extension}")) + File.Delete($"bootTvTex.{config.TGATv.extension}"); } + CopyAndConvertImage(Path.Combine(tempPath, "bootDrcTex.png"), Path.Combine(imgPath), false, 854, 480, 24, "bootDrcTex.tga"); } - else - { - Images.Add(false); - } - + Images.Add(Images[1]); } } else @@ -2542,30 +2504,26 @@ namespace UWUVCI_AIO_WPF //logo + var addBool = true; if (config.TGALog.ImgBin == null) { //use path if (config.TGALog.ImgPath != null) - { - Images.Add(true); CopyAndConvertImage(config.TGALog.ImgPath, Path.Combine(imgPath), false, 170, 42, 32, "bootLogoTex.tga"); - } else - { - Images.Add(false); - } + addBool = false; } else { ReadFileFromBin(config.TGALog.ImgBin, $"bootLogoTex.{config.TGALog.extension}"); CopyAndConvertImage($"bootLogoTex.{config.TGALog.extension}", Path.Combine(imgPath), true, 170, 42, 32, "bootLogoTex.tga"); - Images.Add(true); } + Images.Add(addBool); //Fixing Images + Injecting them if (Images[0] || Images[1] || Images[2] || Images[3]) { - using (Process checkIfIssue = new Process()) + using (Process checkIfIssue = new()) { checkIfIssue.StartInfo.UseShellExecute = false; checkIfIssue.StartInfo.CreateNoWindow = false; @@ -2647,18 +2605,13 @@ namespace UWUVCI_AIO_WPF png2tga.StartInfo.UseShellExecute = false; png2tga.StartInfo.CreateNoWindow = true; var extension = new FileInfo(inputPath).Extension; + if (extension.Contains("png")) - { png2tga.StartInfo.FileName = Path.Combine(toolsPath, "png2tga.exe"); - } else if (extension.Contains("jpg") || extension.Contains("jpeg")) - { png2tga.StartInfo.FileName = Path.Combine(toolsPath, "jpg2tga.exe"); - } else if (extension.Contains("bmp")) - { png2tga.StartInfo.FileName = Path.Combine(toolsPath, "bmp2tga.exe"); - } png2tga.StartInfo.Arguments = $"-i \"{inputPath}\" -o \"{outputPath}\" --width={widht} --height={height} --tga-bpp={bit} --tga-compression=none"; @@ -2691,10 +2644,8 @@ namespace UWUVCI_AIO_WPF return filePath; string newFilePath = Path.Combine(tempPath, Path.GetFileName(filePath)); - using (FileStream outStream = new FileStream(newFilePath, FileMode.OpenOrCreate)) - { + using (FileStream outStream = new(newFilePath, FileMode.OpenOrCreate)) inStream.CopyTo(outStream); - } return newFilePath; } From cdbccad65c7c40efc7e2aa52fac7fc1ee1f48ffe Mon Sep 17 00:00:00 2001 From: ZestyTS Date: Wed, 24 Aug 2022 01:29:06 -0700 Subject: [PATCH 070/102] Formatting --- UWUVCI AIO WPF/Models/MainViewModel.cs | 540 ++++++++----------------- 1 file changed, 170 insertions(+), 370 deletions(-) diff --git a/UWUVCI AIO WPF/Models/MainViewModel.cs b/UWUVCI AIO WPF/Models/MainViewModel.cs index 5845de3..623ac97 100644 --- a/UWUVCI AIO WPF/Models/MainViewModel.cs +++ b/UWUVCI AIO WPF/Models/MainViewModel.cs @@ -1,7 +1,6 @@ using GameBaseClassLibrary; using System; using System.Collections.Generic; -using System.Configuration; using System.IO; using System.IO.Compression; using System.Linq; @@ -14,7 +13,6 @@ using System.Windows.Controls; using System.Windows.Forms; using UWUVCI_AIO_WPF.Classes; using UWUVCI_AIO_WPF.Properties; -using UWUVCI_AIO_WPF.UI; using UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Bases; using UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations; using UWUVCI_AIO_WPF.UI.Windows; @@ -24,12 +22,10 @@ using System.Windows.Threading; using System.Diagnostics; using Microsoft.WindowsAPICodePack.Dialogs; using System.Text.RegularExpressions; -using MaterialDesignThemes.Wpf; using NAudio.Wave; using System.Timers; using NAudio.Utils; using System.Security.Cryptography; -using System.Drawing; using System.Net.Http; namespace UWUVCI_AIO_WPF @@ -233,7 +229,7 @@ namespace UWUVCI_AIO_WPF public string ReadCkeyFromOtp() { string ret = ""; - using (var dialog = new System.Windows.Forms.OpenFileDialog()) + using (var dialog = new OpenFileDialog()) { dialog.Filter = "OTP.bin | otp.bin"; DialogResult res = dialog.ShowDialog(); @@ -416,25 +412,7 @@ namespace UWUVCI_AIO_WPF FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location); string version = fvi.FileVersion; - AutoUpdater.Start("https://raw.githubusercontent.com/Hotbrawl20/testing/master/update.xml"); - if (Properties.Settings.Default.UpgradeRequired) - { - Properties.Settings.Default.Upgrade(); - Properties.Settings.Default.UpgradeRequired = false; - Properties.Settings.Default.Save(); - } - if (button && Convert.ToInt32(version.Split('.')[3]) >= Task.Run(() => GetNewVersionAsync()).GetAwaiter().GetResult()) - { - Custom_Message cm = new Custom_Message("No Updates available", " You are currently using the newest version of UWUVCI AIO "); - try - { - cm.Owner = mw; - } - catch (Exception) { } - cm.ShowDialog(); - - } - else if (button) + if (button) { var client = new Octokit.GitHubClient(new Octokit.ProductHeaderValue("UWUVCI-AIO-WPF")); var releases = Task.Run(() => client.Repository.Release.GetAll("stuff-by-3-random-dudes", "UWUVCI-AIO-WPF")).GetAwaiter().GetResult(); @@ -485,28 +463,6 @@ namespace UWUVCI_AIO_WPF } } } - private async Task GetNewVersionAsync() - { - try - { - WebRequest request = WebRequest.Create("https://uwuvciapi.azurewebsites.net/GetVersionNum"); - - var response = await request.GetResponseAsync(); - using (Stream dataStream = response.GetResponseStream()) - { - // Open the stream using a StreamReader for easy access. - StreamReader reader = new StreamReader(dataStream); - // Read the content. - string responseFromServer = reader.ReadToEnd(); - // Display the content. - return Convert.ToInt32(responseFromServer); - } - } - catch (Exception) - { - return 100000; - } - } public bool ConfirmRiffWave(string path) { using (var reader = new BinaryReader(File.OpenRead(path))) @@ -561,10 +517,10 @@ namespace UWUVCI_AIO_WPF if (!Directory.Exists("bin\\BaseGames")) Directory.CreateDirectory("bin\\BaseGames"); - if (Properties.Settings.Default.OutPath == "" || Properties.Settings.Default.OutPath == null) + if (Settings.Default.OutPath == "" || Settings.Default.OutPath == null) Settings.Default.OutPath = Path.Combine(Directory.GetCurrentDirectory(), "InjectedGames"); - if (Settings.Default.BasePath == "" || Properties.Settings.Default.BasePath == null) + if (Settings.Default.BasePath == "" || Settings.Default.BasePath == null) Settings.Default.BasePath = Path.Combine(Directory.GetCurrentDirectory(), "bin", "BaseGames"); Settings.Default.Save(); @@ -632,7 +588,6 @@ namespace UWUVCI_AIO_WPF } catch (Exception) { } cm.ShowDialog(); - } else { @@ -650,9 +605,7 @@ namespace UWUVCI_AIO_WPF } catch (Exception) { } cm.ShowDialog(); - } - } } } @@ -1072,10 +1025,12 @@ namespace UWUVCI_AIO_WPF public void Inject(bool force) { ValidatePathsStillExist(); - /* var task = new Task(() => runInjectThread(true)); - task.Start();*/ + Task.Run(() => { + Injected = false; + Injected2 = false; + if (Injection.Inject(GameConfiguration, RomPath, this, force)) { Injected = true; @@ -1084,11 +1039,6 @@ namespace UWUVCI_AIO_WPF if (GameConfiguration.Console == GameConsoles.WII || GameConfiguration.Console == GameConsoles.GCN) injected2 = false; } - else - { - Injected = false; - injected2 = false; - } }); DownloadWait dw = new DownloadWait("Injecting Game - Please Wait", "", this); try @@ -1390,47 +1340,47 @@ namespace UWUVCI_AIO_WPF break; hash2 = ((hash2 << 5) + hash2) ^ str[i + 1]; } - return hash1 + (hash2 * 1566083941); } } public bool checkSysKey(string key) { - if (GetDeterministicHashCode(key) == -589797700) - { - Properties.Settings.Default.SysKey = key; - Properties.Settings.Default.Save(); - return true; - } - return false; + if (GetDeterministicHashCode(key) != -589797700) + return false; + + Settings.Default.SysKey = key; + Settings.Default.Save(); + return true; } public bool SysKey1set() { - return checkSysKey1(Properties.Settings.Default.SysKey1); + return checkSysKey1(Settings.Default.SysKey1); } public bool checkSysKey1(string key) { - if (GetDeterministicHashCode(key) == -1230232583) - { - Properties.Settings.Default.SysKey1 = key; - Properties.Settings.Default.Save(); - return true; - } - return false; + if (GetDeterministicHashCode(key) != -1230232583) + return false; + + Settings.Default.SysKey1 = key; + Settings.Default.Save(); + return true; } public bool SysKeyset() { - return checkSysKey(Properties.Settings.Default.SysKey); + return checkSysKey(Settings.Default.SysKey); } public bool GetConsoleOfConfig(string configPath, GameConsoles console) { FileInfo fn = new FileInfo(configPath); if (fn.Extension.Contains("uwuvci")) { - FileStream inputConfigStream = new FileStream(configPath, FileMode.Open, FileAccess.Read); - GZipStream decompressedConfigStream = new GZipStream(inputConfigStream, CompressionMode.Decompress); - IFormatter formatter = new BinaryFormatter(); - GameConfig check = (GameConfig)formatter.Deserialize(decompressedConfigStream); + GameConfig check; + using (FileStream inputConfigStream = new FileStream(configPath, FileMode.Open, FileAccess.Read)) + using (GZipStream decompressedConfigStream = new GZipStream(inputConfigStream, CompressionMode.Decompress)) + { + IFormatter formatter = new BinaryFormatter(); + check = (GameConfig)formatter.Deserialize(decompressedConfigStream); + } return check.Console == console; } @@ -1438,36 +1388,33 @@ namespace UWUVCI_AIO_WPF } public void selectConfig(GameConsoles console) { - string ret = string.Empty; - using (var dialog = new System.Windows.Forms.OpenFileDialog()) + using var dialog = new OpenFileDialog(); + dialog.InitialDirectory = Path.Combine(Directory.GetCurrentDirectory(), "configs"); + dialog.Filter = "UWUVCI Config (*.uwuvci) | *.uwuvci"; + DialogResult res = dialog.ShowDialog(); + if (res == DialogResult.OK) { - dialog.InitialDirectory = Path.Combine(Directory.GetCurrentDirectory(), "configs"); - dialog.Filter = "UWUVCI Config (*.uwuvci) | *.uwuvci"; - DialogResult res = dialog.ShowDialog(); - if (res == DialogResult.OK) + string ret = dialog.FileName; + if (GetConsoleOfConfig(ret, console)) { - ret = dialog.FileName; - if (GetConsoleOfConfig(ret, console)) + ImportConfig(ret); + Custom_Message cm = new Custom_Message("Import Complete", " Importing of Config completed. \n Please reselect a Base!"); + try { - ImportConfig(ret); - Custom_Message cm = new Custom_Message("Import Complete", " Importing of Config completed. \n Please reselect a Base!"); - try - { - cm.Owner = mw; - } - catch (Exception) { } - cm.ShowDialog(); + cm.Owner = mw; } - else + catch (Exception) { } + cm.ShowDialog(); + } + else + { + Custom_Message cm = new Custom_Message("Import Failed", $" The config you are trying to import is not made for {console} Injections. \n Please choose a config made for these kind of Injections or choose a different kind of Injection"); + try { - Custom_Message cm = new Custom_Message("Import Failed", $" The config you are trying to import is not made for {console.ToString()} Injections. \n Please choose a config made for these kind of Injections or choose a different kind of Injection"); - try - { - cm.Owner = mw; - } - catch (Exception) { } - cm.ShowDialog(); + cm.Owner = mw; } + catch (Exception) { } + cm.ShowDialog(); } } } @@ -1505,7 +1452,7 @@ namespace UWUVCI_AIO_WPF cm.Owner = mw; } catch (Exception) { } - if (!Properties.Settings.Default.ndsw) + if (!Settings.Default.ndsw) { cm.ShowDialog(); } @@ -1517,7 +1464,7 @@ namespace UWUVCI_AIO_WPF cm.Owner = mw; } catch (Exception) { } - if (!Properties.Settings.Default.snesw) + if (!Settings.Default.snesw) { cm.ShowDialog(); } @@ -1598,7 +1545,7 @@ namespace UWUVCI_AIO_WPF { } - if (!Properties.Settings.Default.gczw) + if (!Settings.Default.gczw) { cm1.ShowDialog(); } @@ -1613,12 +1560,6 @@ namespace UWUVCI_AIO_WPF } return ret; } - public GameConsoles test; - private static void CopyBase(string console) - { - File.Copy(console, $@"bin\bases\{console}"); - File.Delete(console); - } private static void DeleteTool(string tool) { File.Delete($@"bin\Tools\{tool}"); @@ -1632,38 +1573,31 @@ namespace UWUVCI_AIO_WPF List ret = new List(); string prefix = @"bases.vcb"; var location = Path.Combine(Directory.GetCurrentDirectory(), "bin", "bases", prefix); + if (!File.Exists(location + "nds")) - { ret.Add(prefix + "nds"); - } + if (!File.Exists(location + "nes")) - { ret.Add(prefix + "nes"); - } + if (!File.Exists(location + "n64")) - { ret.Add(prefix + "n64"); - } + if (!File.Exists(location + "snes")) - { ret.Add(prefix + "snes"); - } + if (!File.Exists(location + "gba")) - { ret.Add(prefix + "gba"); - } + if (!File.Exists(location + "tg16")) - { ret.Add(prefix + "tg16"); - } + if (!File.Exists(location + "msx")) - { ret.Add(prefix + "msx"); - } + if (!File.Exists(location + "wii")) - { ret.Add(prefix + "wii"); - } + return ret; } public static async Task DownloadBaseAsync(string name, MainViewModel mvm) @@ -1694,17 +1628,17 @@ namespace UWUVCI_AIO_WPF var filePath = Path.Combine(Directory.GetCurrentDirectory(), "bin", "Tools", name); try { - do + while (true) { - if (File.Exists(filePath)) - File.Delete(filePath); + var isToolRight = await ToolCheck.IsToolRightAsync(name); + if (isToolRight) + break; using var httpClient = new HttpClient(); using var response = await httpClient.GetStreamAsync(getDownloadLink(name, true)); using var fs = new FileStream(filePath, FileMode.Create); await response.CopyToAsync(fs); - - } while (!Task.Run(() => ToolCheck.IsToolRightAsync(name)).GetAwaiter().GetResult()); + } } catch (Exception e) { @@ -1833,20 +1767,15 @@ namespace UWUVCI_AIO_WPF toolCheckAsync(); } } - public void UpdatePathSet() { - PathsSet = Settings.Default.PathsSet; if (BaseStore != Settings.Default.BasePath) - { BaseStore = Settings.Default.BasePath; - } + if (InjectStore != Settings.Default.BasePath) - { InjectStore = Settings.Default.OutPath; - } } public bool ValidatePathsStillExist() @@ -1856,12 +1785,10 @@ namespace UWUVCI_AIO_WPF try { if (Directory.Exists(Settings.Default.BasePath)) - { basep = true; - } else { - if (!Directory.Exists(Path.Combine(Directory.GetCurrentDirectory(), "bin", "BaseGames"))) Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(), "bin", "BaseGames")); + Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(), "bin", "BaseGames")); Settings.Default.BasePath = Path.Combine(Directory.GetCurrentDirectory(), "bin", "BaseGames"); Settings.Default.PathsSet = true; Settings.Default.Save(); @@ -1869,13 +1796,11 @@ namespace UWUVCI_AIO_WPF if (Directory.Exists(Settings.Default.OutPath)) { if (basep) - { ret = true; - } } else { - if (!Directory.Exists(Path.Combine(Directory.GetCurrentDirectory(), "InjectedGames"))) Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(), "InjectedGames")); + Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(), "InjectedGames")); Settings.Default.OutPath = Path.Combine(Directory.GetCurrentDirectory(), "InjectedGames"); Settings.Default.PathsSet = true; Settings.Default.Save(); @@ -1898,23 +1823,16 @@ namespace UWUVCI_AIO_WPF custom.Name = "Custom"; custom.Region = Regions.EU; LBases.Add(custom); + foreach (GameBases gb in lTemp) - { LBases.Add(gb); - } + lGameBasesString.Clear(); foreach (GameBases gb in LBases) - { if (gb.Name == "Custom") - { LGameBasesString.Add($"{gb.Name}"); - } else - { LGameBasesString.Add($"{gb.Name} {gb.Region}"); - } - - } } public GameBases getBasefromName(string Name) @@ -1922,61 +1840,37 @@ namespace UWUVCI_AIO_WPF string NameWORegion = Name.Remove(Name.Length - 3, 3); string Region = Name.Remove(0, Name.Length - 2); foreach (GameBases b in LNDS) - { if (b.Name == NameWORegion && b.Region.ToString() == Region) - { return b; - } - } + foreach (GameBases b in LN64) - { if (b.Name == NameWORegion && b.Region.ToString() == Region) - { return b; - } - } + foreach (GameBases b in LNES) - { if (b.Name == NameWORegion && b.Region.ToString() == Region) - { return b; - } - } + foreach (GameBases b in LSNES) - { if (b.Name == NameWORegion && b.Region.ToString() == Region) - { return b; - } - } + foreach (GameBases b in LGBA) - { if (b.Name == NameWORegion && b.Region.ToString() == Region) - { return b; - } - } + foreach (GameBases b in LTG16) - { if (b.Name == NameWORegion && b.Region.ToString() == Region) - { return b; - } - } + foreach (GameBases b in LMSX) - { if (b.Name == NameWORegion && b.Region.ToString() == Region) - { return b; - } - } + foreach (GameBases b in LWII) - { if (b.Name == NameWORegion && b.Region.ToString() == Region) - { return b; - } - } + return null; } @@ -2031,9 +1925,7 @@ namespace UWUVCI_AIO_WPF KeyFile.ExportFile(temp, console); } else - { FixupKeys(l, console); - } } private void FixupKeys(List l, GameConsoles console) @@ -2041,22 +1933,21 @@ namespace UWUVCI_AIO_WPF string file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $@"bin\keys\{console.ToString().ToLower()}.vck"); var save = KeyFile.ReadBasesFromKeyFile(file); List temp = new List(); + foreach (TKeys a in save) - { temp.Add(a); - } + foreach (GameBases gb in l) { TKeys tempkey = new TKeys(); bool check = false; foreach (TKeys a in save) - { if (a.Base.Name == gb.Name && a.Base.Region == gb.Region) { check = true; break; } - } + if (!check) { tempkey.Base = gb; @@ -2084,7 +1975,8 @@ namespace UWUVCI_AIO_WPF newTK.Add(tk); inOld = true; } - if (inOld) break; + if (inOld) + break; } if (!inOld) { @@ -2146,24 +2038,16 @@ namespace UWUVCI_AIO_WPF Settings.Default.Ckey = key.ToLower(); ckeys = true; Settings.Default.Save(); - - return true; } - ckeys = false; - return false; + else + ckeys = false; + + return ckeys; } public bool isCkeySet() { - if (GetDeterministicHashCode(Settings.Default.Ckey.ToLower()) == -485504051) - { - ckeys = true; - return true; - } - else - { - ckeys = false; - return false; - } + ckeys = GetDeterministicHashCode(Settings.Default.Ckey.ToLower()) == -485504051; + return ckeys; } public bool checkKey(string key) { @@ -2181,12 +2065,9 @@ namespace UWUVCI_AIO_WPF { var temp = KeyFile.ReadBasesFromKeyFile(file); foreach (TKeys t in temp) - { if (t.Base.Name == Base.Name && t.Base.Region == Base.Region) - { t.Tkey = key; - } - } + File.Delete(file); KeyFile.ExportFile(temp, console); } @@ -2196,15 +2077,10 @@ namespace UWUVCI_AIO_WPF string file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $@"bin\keys\{GetConsoleOfBase(bases).ToString().ToLower()}.vck"); var temp = KeyFile.ReadBasesFromKeyFile(file); foreach (TKeys t in temp) - { if (t.Base.Name == bases.Name && t.Base.Region == bases.Region) - { if (t.Tkey != null) - { return true; - } - } - } + return false; } @@ -2271,90 +2147,68 @@ namespace UWUVCI_AIO_WPF GameConsoles ret = new GameConsoles(); bool cont = false; foreach (GameBases b in lNDS) - { if (b.Name == gb.Name && b.Region == gb.Region) { ret = GameConsoles.NDS; cont = true; } - } + if (!cont) - { foreach (GameBases b in lN64) - { if (b.Name == gb.Name && b.Region == gb.Region) { ret = GameConsoles.N64; cont = true; } - } - } + if (!cont) - { foreach (GameBases b in lNES) - { if (b.Name == gb.Name && b.Region == gb.Region) { ret = GameConsoles.NES; cont = true; } - } - } + if (!cont) - { foreach (GameBases b in lSNES) - { if (b.Name == gb.Name && b.Region == gb.Region) { ret = GameConsoles.SNES; cont = true; } - } - } + if (!cont) - { foreach (GameBases b in lGBA) - { if (b.Name == gb.Name && b.Region == gb.Region) { ret = GameConsoles.GBA; cont = true; } - } - } + if (!cont) - { foreach (GameBases b in lTG16) - { if (b.Name == gb.Name && b.Region == gb.Region) { ret = GameConsoles.TG16; cont = true; } - } - } + if (!cont) - { foreach (GameBases b in lMSX) - { if (b.Name == gb.Name && b.Region == gb.Region) { ret = GameConsoles.MSX; cont = true; } - } - } + if (!cont) - { foreach (GameBases b in lWii) - { if (b.Name == gb.Name && b.Region == gb.Region) { ret = GameConsoles.WII; cont = true; } - } - } + return ret; } public List getInfoOfBase(GameBases gb) @@ -2375,7 +2229,6 @@ namespace UWUVCI_AIO_WPF dialog.IsFolderPicker = true; CommonFileDialogResult result = dialog.ShowDialog(); if (result == CommonFileDialogResult.Ok) - { try { if (DirectoryIsEmpty(dialog.FileName)) @@ -2418,8 +2271,6 @@ namespace UWUVCI_AIO_WPF catch (Exception) { } cm.ShowDialog(); } - - } } ArePathsSet(); } @@ -2430,7 +2281,6 @@ namespace UWUVCI_AIO_WPF dialog.IsFolderPicker = true; CommonFileDialogResult result = dialog.ShowDialog(); if (result == CommonFileDialogResult.Ok) - { try { if (DirectoryIsEmpty(dialog.FileName)) @@ -2473,7 +2323,6 @@ namespace UWUVCI_AIO_WPF catch (Exception) { } cm.ShowDialog(); } - } } ArePathsSet(); } @@ -2545,9 +2394,7 @@ namespace UWUVCI_AIO_WPF { await GetRepoImages(SystemType, repoid); await checkForAdditionalFiles(GameConsoles.SNES, repoids); - } - } public async Task getBootIMGMSX(string rom) { @@ -2563,7 +2410,6 @@ namespace UWUVCI_AIO_WPF await GetRepoImages(SystemType, repoid); await checkForAdditionalFiles(GameConsoles.MSX, repoids); } - } public async Task getBootIMGTG(string rom) { @@ -2577,51 +2423,43 @@ namespace UWUVCI_AIO_WPF { await GetRepoImages(SystemType, repoid); await checkForAdditionalFiles(GameConsoles.TG16, repoids); - } - } private string GetFakeMSXTGProdcode(string v, bool msx) { Regex rgx = new Regex("[^a-zA-Z0-9 -]"); Regex rgx2 = new Regex("[^0-9]"); byte[] procode = new byte[0x210]; + var hash = ""; using (var md5 = MD5.Create()) { - using (var fs = new FileStream(v, - FileMode.Open, - FileAccess.Read)) - { - + using (var fs = new FileStream(v, FileMode.Open, FileAccess.Read)) fs.Read(procode, 0, 0x210); - fs.Close(); - } - string hash = GetMd5Hash(md5, procode); - //var number = /*hash.GetHashCode();*/ gamename.GetHashCode(); - if (msx) Console.Write("MSX"); - else Console.Write("TG16"); - Console.WriteLine(" PRODCODE:"); - Console.WriteLine("File Name: " + new FileInfo(v).Name); - Console.WriteLine("MD5 of Code Snippet: " + hash); - string hashonlynumbers = rgx2.Replace(hash, ""); - do - { - if (hashonlynumbers.Length < 10) - { - hashonlynumbers += 0; - } - } while (hashonlynumbers.Length < 10); - - string first10 = new string(new char[] { hashonlynumbers[0], hashonlynumbers[1], hashonlynumbers[2], hashonlynumbers[3], hashonlynumbers[4], hashonlynumbers[5], hashonlynumbers[6], hashonlynumbers[7], hashonlynumbers[8] }); - string prodcode = getCodeOfNumbers(Convert.ToInt32(first10)); - if (msx) prodcode += "SX"; - else prodcode += "TG"; - //Console.WriteLine("NumberHash of GameName: "+ number); - Console.WriteLine("Fake ProdCode: " + prodcode); - Console.WriteLine("---------------------------------------------------"); - return prodcode; + hash = GetMd5Hash(md5, procode); } + //var number = /*hash.GetHashCode();*/ gamename.GetHashCode(); + if (msx) Console.Write("MSX"); + else Console.Write("TG16"); + Console.WriteLine(" PRODCODE:"); + Console.WriteLine("File Name: " + new FileInfo(v).Name); + Console.WriteLine("MD5 of Code Snippet: " + hash); + string hashonlynumbers = rgx2.Replace(hash, ""); + do + { + if (hashonlynumbers.Length < 10) + hashonlynumbers += 0; + + } while (hashonlynumbers.Length < 10); + + string first10 = new string(new char[] { hashonlynumbers[0], hashonlynumbers[1], hashonlynumbers[2], hashonlynumbers[3], hashonlynumbers[4], hashonlynumbers[5], hashonlynumbers[6], hashonlynumbers[7], hashonlynumbers[8] }); + string prodcode = getCodeOfNumbers(Convert.ToInt32(first10)); + if (msx) prodcode += "SX"; + else prodcode += "TG"; + //Console.WriteLine("NumberHash of GameName: "+ number); + Console.WriteLine("Fake ProdCode: " + prodcode); + Console.WriteLine("---------------------------------------------------"); + return prodcode; } private string GetFakeSNESProdcode(string path) { @@ -2630,9 +2468,7 @@ namespace UWUVCI_AIO_WPF using (var md5 = MD5.Create()) { var name = new byte[] { }; - using (var fs = new FileStream(path, - FileMode.Open, - FileAccess.Read)) + using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read)) { byte[] procode = new byte[4]; fs.Seek(0x7FB2, SeekOrigin.Begin); @@ -2677,14 +2513,9 @@ namespace UWUVCI_AIO_WPF } while (hashonlynumbers.Length < 10); string first10 = new string(new char[] { hashonlynumbers[0], hashonlynumbers[1], hashonlynumbers[2], hashonlynumbers[3], hashonlynumbers[4], hashonlynumbers[5], hashonlynumbers[6], hashonlynumbers[7], hashonlynumbers[8] }); - - //Console.WriteLine("NumberHash of GameName: "+ number); Console.WriteLine("Fake ProdCode: " + getCodeOfNumbers(Convert.ToInt32(first10))); Console.WriteLine("---------------------------------------------------"); return getCodeOfNumbers(Convert.ToInt32(first10)); - // Console.WriteLine(md5.ComputeHash(name)); - // Console.WriteLine("NumberCode: "+hash.GetHashCode()); - } } public async Task getBootIMGNES(string rom) @@ -2714,9 +2545,7 @@ namespace UWUVCI_AIO_WPF // Loop through each byte of the hashed data // and format each one as a hexadecimal string. for (int i = 0; i < data.Length; i++) - { sBuilder.Append(data[i].ToString("x2")); - } // Return the hexadecimal string. return sBuilder.ToString(); @@ -2734,9 +2563,7 @@ namespace UWUVCI_AIO_WPF // Loop through each byte of the hashed data // and format each one as a hexadecimal string. for (int i = 0; i < data.Length; i++) - { sBuilder.Append(data[i].ToString("x2")); - } // Return the hexadecimal string. return sBuilder.ToString(); @@ -2748,15 +2575,10 @@ namespace UWUVCI_AIO_WPF byte[] procode = new byte[0xB0]; using (var md5 = MD5.Create()) { - using (var fs = new FileStream(path, - FileMode.Open, - FileAccess.Read)) + using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read)) { - fs.Seek(0x8000, SeekOrigin.Begin); fs.Read(procode, 0, 0xB0); - - fs.Close(); } string hash = GetMd5Hash(md5, procode); //var number = /*hash.GetHashCode();*/ gamename.GetHashCode(); @@ -2773,7 +2595,6 @@ namespace UWUVCI_AIO_WPF string first10 = new string(new char[] { hashonlynumbers[0], hashonlynumbers[1], hashonlynumbers[2], hashonlynumbers[3], hashonlynumbers[4], hashonlynumbers[5], hashonlynumbers[6], hashonlynumbers[7], hashonlynumbers[8] }); - //Console.WriteLine("NumberHash of GameName: "+ number); Console.WriteLine("Fake ProdCode: " + getCodeOfNumbers(Convert.ToInt32(first10))); Console.WriteLine("---------------------------------------------------"); return getCodeOfNumbers(Convert.ToInt32(first10)); @@ -2819,11 +2640,8 @@ namespace UWUVCI_AIO_WPF { string repoid = ""; string SystemType = "nds/"; - using (var fs = new FileStream(rom, - FileMode.Open, - FileAccess.Read)) + using (var fs = new FileStream(rom, FileMode.Open, FileAccess.Read)) { - byte[] procode = new byte[4]; fs.Seek(0xC, SeekOrigin.Begin); fs.Read(procode, 0, 4); @@ -2831,8 +2649,6 @@ namespace UWUVCI_AIO_WPF Regex rgx = new Regex("[^a-zA-Z0-9 -]"); repoid = rgx.Replace(repoid, ""); Console.WriteLine("prodcode before scramble: " + repoid); - - fs.Close(); Console.WriteLine("prodcode after scramble: " + repoid); } List repoids = new List(); @@ -2844,7 +2660,6 @@ namespace UWUVCI_AIO_WPF repoids.Add(SystemType + repoid.Substring(0, 3) + "J"); await GetRepoImages(SystemType, repoid); await checkForAdditionalFiles(GameConsoles.NDS, repoids); - } } public async Task getBootIMGN64(string rom) @@ -2852,9 +2667,7 @@ namespace UWUVCI_AIO_WPF string repoid = ""; string SystemType = "n64/"; List repoids = new List(); - using (var fs = new FileStream(rom, - FileMode.Open, - FileAccess.Read)) + using (var fs = new FileStream(rom, FileMode.Open, FileAccess.Read)) { byte[] procode = new byte[6]; fs.Seek(0x3A, SeekOrigin.Begin); @@ -2863,8 +2676,6 @@ namespace UWUVCI_AIO_WPF Regex rgx = new Regex("[^a-zA-Z0-9 -]"); repoid = rgx.Replace(repoid, ""); Console.WriteLine("prodcode before scramble: " + repoid); - - fs.Close(); Console.WriteLine("prodcode after scramble: " + repoid); } if (await CheckForInternetConnectionWOWarningAsync()) @@ -2886,53 +2697,47 @@ namespace UWUVCI_AIO_WPF string ret = ""; try { - using (var reader = new BinaryReader(File.OpenRead(OpenGame))) + using var reader = new BinaryReader(File.OpenRead(OpenGame)); + string TempString = ""; + string SystemType = "wii/"; + + if (gc) + SystemType = "gcn/"; + + var repoid = ""; + reader.BaseStream.Position = 0x00; + char TempChar; + //WBFS Check + List repoids = new List(); + if (new FileInfo(OpenGame).Extension.Contains("wbfs")) //Performs actions if the header indicates a WBFS file { - string TempString = ""; - string SystemType = "wii/"; - - if (gc) - SystemType = "gcn/"; - - var repoid = ""; + reader.BaseStream.Position = 0x200; + reader.BaseStream.Position = 0x218; + reader.BaseStream.Position = 0x220; + while ((int)(TempChar = reader.ReadChar()) != 0) ret = ret + TempChar; + reader.BaseStream.Position = 0x200; + while ((int)(TempChar = reader.ReadChar()) != 0) TempString = TempString + TempChar; + repoid = TempString; + } + else + { + reader.BaseStream.Position = 0x18; + reader.BaseStream.Position = 0x20; + while ((int)(TempChar = reader.ReadChar()) != 0) ret = ret + TempChar; reader.BaseStream.Position = 0x00; - char TempChar; - //WBFS Check - List repoids = new List(); - if (new FileInfo(OpenGame).Extension.Contains("wbfs")) //Performs actions if the header indicates a WBFS file - { + while ((int)(TempChar = reader.ReadChar()) != 0) TempString = TempString + TempChar; + repoid = TempString; + } - reader.BaseStream.Position = 0x200; + if (Task.Run(() => CheckForInternetConnectionWOWarningAsync()).GetAwaiter().GetResult()) + { + repoids.Add(SystemType + repoid); + repoids.Add(SystemType + repoid.Substring(0, 3) + "E" + repoid.Substring(4, 2)); + repoids.Add(SystemType + repoid.Substring(0, 3) + "P" + repoid.Substring(4, 2)); + repoids.Add(SystemType + repoid.Substring(0, 3) + "J" + repoid.Substring(4, 2)); - reader.BaseStream.Position = 0x218; - - reader.BaseStream.Position = 0x220; - while ((int)(TempChar = reader.ReadChar()) != 0) ret = ret + TempChar; - reader.BaseStream.Position = 0x200; - while ((int)(TempChar = reader.ReadChar()) != 0) TempString = TempString + TempChar; - repoid = TempString; - } - else - { - reader.BaseStream.Position = 0x18; - - reader.BaseStream.Position = 0x20; - while ((int)(TempChar = reader.ReadChar()) != 0) ret = ret + TempChar; - reader.BaseStream.Position = 0x00; - while ((int)(TempChar = reader.ReadChar()) != 0) TempString = TempString + TempChar; - repoid = TempString; - } - - if (Task.Run(() => CheckForInternetConnectionWOWarningAsync()).GetAwaiter().GetResult()) - { - repoids.Add(SystemType + repoid); - repoids.Add(SystemType + repoid.Substring(0, 3) + "E" + repoid.Substring(4, 2)); - repoids.Add(SystemType + repoid.Substring(0, 3) + "P" + repoid.Substring(4, 2)); - repoids.Add(SystemType + repoid.Substring(0, 3) + "J" + repoid.Substring(4, 2)); - - GetRepoImages(SystemType, repoid, repoids); - checkForAdditionalFiles(test == GameConsoles.GCN ? GameConsoles.GCN : GameConsoles.WII, repoids); - } + GetRepoImages(SystemType, repoid, repoids); + checkForAdditionalFiles(test == GameConsoles.GCN ? GameConsoles.GCN : GameConsoles.WII, repoids); } } catch (Exception) @@ -2944,7 +2749,6 @@ namespace UWUVCI_AIO_WPF } catch (Exception) { } cm.ShowDialog(); - } return ret; } @@ -3012,7 +2816,6 @@ namespace UWUVCI_AIO_WPF bool ini = false; bool btsnd = false; string inip = ""; - string btsndp = ""; string exten = ""; string linkbase = "https://raw.githubusercontent.com/Flumpster/UWUVCI-Images/master/"; if (console == GameConsoles.N64) @@ -3035,7 +2838,7 @@ namespace UWUVCI_AIO_WPF if (await RemoteFileExists(linkbase + repoid + "/BootSound." + e)) { btsnd = true; - btsndp = linkbase + repoid + "/BootSound." + e; + string btsndp = linkbase + repoid + "/BootSound." + e; exten = e; break; } @@ -3075,7 +2878,6 @@ namespace UWUVCI_AIO_WPF } if (btsnd) { - using var response = await client.GetStreamAsync(inip); using var fs = new FileStream(Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo", $"bootSound.{exten}"), FileMode.Create); await response.CopyToAsync(fs); @@ -3097,13 +2899,9 @@ namespace UWUVCI_AIO_WPF break; case GameConsoles.WII: if (test == GameConsoles.GCN) - { (Thing as GCConfig).sound.Text = Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo", $"bootSound.{exten}"); - } else - { (Thing as WiiConfig).sound.Text = Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo", $"bootSound.{exten}"); - } break; case GameConsoles.TG16: (Thing as TurboGrafX).sound.Text = Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo", $"bootSound.{exten}"); @@ -3130,6 +2928,8 @@ namespace UWUVCI_AIO_WPF public bool passtrough = true; internal bool enableWii = true; internal bool backupenableWii = true; + private GameConsoles test; + public void PlaySound() { Task ts = new Task(() => From e06ee8dd0776342813719561986112a4e9d69c82 Mon Sep 17 00:00:00 2001 From: NicoAICP Date: Wed, 24 Aug 2022 22:26:37 +0200 Subject: [PATCH 071/102] Changed Kofi Buttons --- UWUVCI AIO WPF/UI/Frames/SettingsFrame.xaml.cs | 2 +- UWUVCI AIO WPF/UI/Frames/StartFrame.xaml | 10 +++++++--- UWUVCI AIO WPF/UI/Frames/StartFrame.xaml.cs | 4 ++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/UWUVCI AIO WPF/UI/Frames/SettingsFrame.xaml.cs b/UWUVCI AIO WPF/UI/Frames/SettingsFrame.xaml.cs index b969f26..c46bf98 100644 --- a/UWUVCI AIO WPF/UI/Frames/SettingsFrame.xaml.cs +++ b/UWUVCI AIO WPF/UI/Frames/SettingsFrame.xaml.cs @@ -143,7 +143,7 @@ namespace UWUVCI_AIO_WPF.UI.Frames private void Button_Click_13(object sender, RoutedEventArgs e) { - Process.Start("https://ko-fi.com/uwuvci"); + Process.Start("https://ko-fi.com/zestyts"); } } } diff --git a/UWUVCI AIO WPF/UI/Frames/StartFrame.xaml b/UWUVCI AIO WPF/UI/Frames/StartFrame.xaml index 4e757db..e0e1209 100644 --- a/UWUVCI AIO WPF/UI/Frames/StartFrame.xaml +++ b/UWUVCI AIO WPF/UI/Frames/StartFrame.xaml @@ -7,12 +7,16 @@ mc:Ignorable="d" d:DesignHeight="480" d:DesignWidth="1130" Title="SettingsFrame" > - - + + - + \ No newline at end of file diff --git a/UWUVCI AIO WPF/UI/Frames/StartFrame.xaml.cs b/UWUVCI AIO WPF/UI/Frames/StartFrame.xaml.cs index 7f50409..4298777 100644 --- a/UWUVCI AIO WPF/UI/Frames/StartFrame.xaml.cs +++ b/UWUVCI AIO WPF/UI/Frames/StartFrame.xaml.cs @@ -19,5 +19,9 @@ namespace UWUVCI_AIO_WPF.UI.Frames { Process.Start("https://ko-fi.com/uwuvci"); } + private void Button_Click2(object sender, RoutedEventArgs e) + { + Process.Start("https://ko-fi.com/zestyts"); + } } } \ No newline at end of file From 32e3ac13d36efeea484eca4f6fab4d7f52884b0c Mon Sep 17 00:00:00 2001 From: ZestyTS Date: Thu, 25 Aug 2022 00:11:39 -0700 Subject: [PATCH 072/102] Fixed build error --- UWUVCI AIO WPF/Classes/Injection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UWUVCI AIO WPF/Classes/Injection.cs b/UWUVCI AIO WPF/Classes/Injection.cs index e45026d..4787787 100644 --- a/UWUVCI AIO WPF/Classes/Injection.cs +++ b/UWUVCI AIO WPF/Classes/Injection.cs @@ -2410,7 +2410,7 @@ namespace UWUVCI_AIO_WPF } else { - var fileExists = File.Exists(Path.Combine(toolsPath, "bootTvTex.png"); + var fileExists = File.Exists(Path.Combine(toolsPath, "bootTvTex.png")); if (fileExists) { CopyAndConvertImage(Path.Combine(toolsPath, "bootTvTex.png"), Path.Combine(imgPath), false, 1280, 720, 24, "bootTvTex.tga"); From 7cb09eb07b808e577a2c9195448f9177905f0b39 Mon Sep 17 00:00:00 2001 From: ZestyTS Date: Thu, 25 Aug 2022 00:17:43 -0700 Subject: [PATCH 073/102] fixing build --- UWUVCI AIO WPF/Models/MainViewModel.cs | 28 ++++++++++++-------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/UWUVCI AIO WPF/Models/MainViewModel.cs b/UWUVCI AIO WPF/Models/MainViewModel.cs index 623ac97..eb97330 100644 --- a/UWUVCI AIO WPF/Models/MainViewModel.cs +++ b/UWUVCI AIO WPF/Models/MainViewModel.cs @@ -2928,7 +2928,7 @@ namespace UWUVCI_AIO_WPF public bool passtrough = true; internal bool enableWii = true; internal bool backupenableWii = true; - private GameConsoles test; + public GameConsoles test; public void PlaySound() { @@ -2995,22 +2995,20 @@ namespace UWUVCI_AIO_WPF } public void RestartIntoBypass() { - using (Process p = new Process()) - { - var fileName = System.Windows.Application.ResourceAssembly.Location; - foreach (var file in Directory.GetFiles(Directory.GetCurrentDirectory(), "*.exe")) - if (Path.GetFileName(file).Contains(Path.GetFileNameWithoutExtension(fileName))) - { - fileName = file; - break; - } + using Process p = new Process(); + var fileName = System.Windows.Application.ResourceAssembly.Location; + foreach (var file in Directory.GetFiles(Directory.GetCurrentDirectory(), "*.exe")) + if (Path.GetFileName(file).Contains(Path.GetFileNameWithoutExtension(fileName))) + { + fileName = file; + break; + } - p.StartInfo.FileName = fileName; + p.StartInfo.FileName = fileName; - p.StartInfo.Arguments = (debug ? "--debug " : "") + "--skip" + (saveworkaround ? " --spacebypass" : ""); - p.Start(); - Environment.Exit(0); - } + p.StartInfo.Arguments = (debug ? "--debug " : "") + "--skip" + (saveworkaround ? " --spacebypass" : ""); + p.Start(); + Environment.Exit(0); } From 31f8b9955f6eb353045e1f59c2eaf7b4941c8d94 Mon Sep 17 00:00:00 2001 From: ZestyTS Date: Thu, 25 Aug 2022 00:17:59 -0700 Subject: [PATCH 074/102] Nico, test before you commit, these don't work! --- UWUVCI AIO WPF/UI/Frames/SettingsFrame.xaml.cs | 8 +++++++- UWUVCI AIO WPF/UI/Frames/StartFrame.xaml.cs | 14 ++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/UWUVCI AIO WPF/UI/Frames/SettingsFrame.xaml.cs b/UWUVCI AIO WPF/UI/Frames/SettingsFrame.xaml.cs index c46bf98..83ee36b 100644 --- a/UWUVCI AIO WPF/UI/Frames/SettingsFrame.xaml.cs +++ b/UWUVCI AIO WPF/UI/Frames/SettingsFrame.xaml.cs @@ -15,6 +15,7 @@ using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using UWUVCI_AIO_WPF.UI.Windows; +using static System.Net.WebRequestMethods; namespace UWUVCI_AIO_WPF.UI.Frames @@ -143,7 +144,12 @@ namespace UWUVCI_AIO_WPF.UI.Frames private void Button_Click_13(object sender, RoutedEventArgs e) { - Process.Start("https://ko-fi.com/zestyts"); + Process.Start(new ProcessStartInfo() + { + FileName = "https://ko-fi.com/zestyts", + UseShellExecute = true, + Verb = "open" + }); } } } diff --git a/UWUVCI AIO WPF/UI/Frames/StartFrame.xaml.cs b/UWUVCI AIO WPF/UI/Frames/StartFrame.xaml.cs index 4298777..de0e9de 100644 --- a/UWUVCI AIO WPF/UI/Frames/StartFrame.xaml.cs +++ b/UWUVCI AIO WPF/UI/Frames/StartFrame.xaml.cs @@ -17,11 +17,21 @@ namespace UWUVCI_AIO_WPF.UI.Frames private void Button_Click(object sender, RoutedEventArgs e) { - Process.Start("https://ko-fi.com/uwuvci"); + Process.Start(new ProcessStartInfo() + { + FileName = "https://ko-fi.com/uwuvci", + UseShellExecute = true, + Verb = "open" + }); } private void Button_Click2(object sender, RoutedEventArgs e) { - Process.Start("https://ko-fi.com/zestyts"); + Process.Start(new ProcessStartInfo() + { + FileName = "https://ko-fi.com/zestyts", + UseShellExecute = true, + Verb = "open" + }); } } } \ No newline at end of file From 9e94ae486e8d9a408ac580c5a351365e240705bd Mon Sep 17 00:00:00 2001 From: ZestyTS Date: Thu, 25 Aug 2022 00:18:15 -0700 Subject: [PATCH 075/102] Added WiiUDownloader as package instead of dll --- UWUVCI AIO WPF/UWUVCI AIO WPF.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/UWUVCI AIO WPF/UWUVCI AIO WPF.csproj b/UWUVCI AIO WPF/UWUVCI AIO WPF.csproj index da2aada..3ce48c5 100644 --- a/UWUVCI AIO WPF/UWUVCI AIO WPF.csproj +++ b/UWUVCI AIO WPF/UWUVCI AIO WPF.csproj @@ -174,6 +174,7 @@ + From 11c226a10ea4bf277b585a4d92deec12c98b7376 Mon Sep 17 00:00:00 2001 From: ZestyTS Date: Fri, 26 Aug 2022 14:24:39 -0700 Subject: [PATCH 076/102] Updated path to point to Net6 folder --- UWUVCI AIO WPF/GameBaseClassLibrary.dll | Bin 0 -> 6144 bytes UWUVCI AIO WPF/Models/MainViewModel.cs | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 UWUVCI AIO WPF/GameBaseClassLibrary.dll diff --git a/UWUVCI AIO WPF/GameBaseClassLibrary.dll b/UWUVCI AIO WPF/GameBaseClassLibrary.dll new file mode 100644 index 0000000000000000000000000000000000000000..7ae2622f7c3f99e0c6a131379a75986fd6c99083 GIT binary patch literal 6144 zcmeHLYiu0V6+ZLudgC}7+vMdC!h|H13CZFY#GxVBUcWZ@h1YRXh_GjO$Ijr{on>a6 z*x@15v=oHsgQB*oP*qT=Ku{G_q*4l~RB8oMQKh!1P@xK`MO9l>kg95F)k42>W_P`Q z6s7&qA64&azB#XZ?m73KduL{cZu~51M5N>T-~*y(ap%@4_~Eb!b?nmTV)V?qS9d+D z48FQ+{FLn*1<#%F%$$)i^LaNg(w5=P zM@yr@aCPEhjR91{xLHs%BU%jQEYoP}lj4N^urs-rZ!DyJ z@H@gpC(-LX5i8piQ7vRaoTy`^?!$P4C|aS9f*+{haJjgyqV_}jbl@(ikw}DdjpXo z(tjUzs<)x5zV9+syF&;F5K1Tz0s_o)C=dbyBozvTfS{@*5Mrm=gr%$5hj1=x*62Fi z;k(|ihpTd?M#m6kvtoOG9tKDtD09F^*ME1d#PDkMj zVb$wRF%*&Rt%HY+%KKXoi0U@N+T9Llx)`u+n>gINRXo;+$B63gfGXl%!ln%Sy49wg zxF4uin=ZxuBm2tHcc+eaE5(`RbvoT1Z;rP$x3wGs!*dTjjD&aJN%R=*CzwtJo}HiZ z*@D)GrLy~2iVVtHFg(rFM{lln&dm4eOZZ3;xiq)0pNRcSOBkkI)l>o^q4Ek-mXxi_n*qH?#=t zQW;gj2Lx{xJR|tD*xaq;;UO#dwn%=Y{7#L~KlIb+n^f5U9U9XLokA?L+Sft4{TT5?k-J8z17{Ywk89t=YS~5Ze(f1> zUXk0Y?Z?S@w#db`I&kNT+&S8h1LnRWcONp<>A@nmL3<7r@lcU#L={xgqanBL7}hC5 zPYL%0+DR{h`+JE~UZ!dq+eK)fqelHTtV>3?yQLor7m>fh#riMtAPx!zo0Mzta;%0% zZ;SmE`Z_wMLj#OZBd~@p2i8%G;32^-!KB~~f*%t!ft$$|`c}aO!Fz!bx=XND@Ntnp zO<%&?eTROkH`7ayT!nQ$rXQi-ip_a?L+wK^U2KMQw*0ex1D&TIt0(9UN+=QfE4`yn z0tc$HcslH$0BFzxa1Y%H+%J-5k+h4XgU&&InC<~~(*3|5dH^^;Ujz=)L+F1S>~{&q zaYX!v;@H{m0xzbGN}P7nHsBT13TzYns9-|m*HZ`NDUsYHn4wWfX6Y=@r%x%J;<-z3 zO3)Ns6ue9DtAY;;eoyc%K~gw2L$FhDJ7QL`mPALCUvNcezXY~wOn-(LFVTJ_78pHXLOro^qR|Nuig^PNT}C4cdM% z)k4Epx6^ok%hhyv$j#0<))DIO?xHcv%yyf;<@b4RZX(f5$CF9wPYhFP!4IrlJUK!~ zM`^exMXBN56ydDyJw`*R6Li{i=B&v{%J~`BbL@1fL&9|&D-+mm-jDZNdCRjiG-Cym z<93$(;{7m~BeRo}-DYMMkAptjan=5#h@54y=-uZ&-1+1nFLUwWIXgL-MSBQk;`e9etd6JbGSlO-sPqXw~U{U{^ zUBUHO>A9I1GwoPQ78rNJ_U&b|F5kCuX=h>F4k}H{V$aN4In$e6@-l9Eh^`Osqt+R> zQc>!|iA-1?r?=Frq)fQ^X?teQGkJAZt9vXzN7T%5A2-9V`7}N?btzuRw|BCs3_C1&sv0d%d|TeOqVLK z=p|m92NW2MyWxw6tZlKPWO++8uQ?Z#2!+62KoF;>A9KwcB;lC8KWL{t(_4sV9fx2r z?z#@~l*7Aa=BWQhyHF&Fl00PZd|>5yu}ZNgN8%L~T9TGBD&;PV zP*z&g#SJH+B=gg57?W&ZVS8*3ThjFwghTyjFvFBMWo2f&^4UInzRz{CmPga!E!pRK zIWq_#>9+I8cZnZ&2i-G}$Jt#ef*#wP$-91FXZ(_=6mc>SFKz*WpSCmBDs@<0mRHt? zTL(+Vo70!cN7eGS3>i79u!-}5Y3F^MUcB3V$+s(m0etG6$8qPgNyZFlBz+4qUm4Z1 zd5o8{^W$NR@vd0(+h!GWrr%mfX2k=09%fXHVhdRvkf!0H9&6$?8WnI;RSL0fRs$1}Jf*;Y4 zLObHaz2oIWbbs-jxE3EU2ji`XIku^+?6LiVV=nMhU=#N;${ItgB?G)&|Ku+ZGszj@ zbBCV9_w|$fK~vFIur!wHNsYXB{`^<2_}Rb<54`u?nD_EMoN(VYC;eb03_XthR7yt!WT1WYaWO{8Hus9i|PYR=3g@b*Pz4xL%Lr3}N$y z4}Qy%voO?tuoqrdrn%bXe@(*QHbnSHUR*vT7bd}RX?~zk5BXJa##o1r%*Nr=$l?lnj z2R(?G(~_Tu_iJv=I760vPQcoO-BQjiIA@#77a@j5*z>FfVw=YpPDP{_I(D40=*RzD za2+(j=OFyeh&P_00^;Ktp27D!|KGJ*X3*o<1O~MtKECju9K2Ne30E=;zd88z@NH6> zZK4|`kCEaSypo(pX>OV06(agi@;NH&Gz#A?vYf-SE2x;E3-^iPsa@7*xv!P0v~rC) sq)!*J<<-w&#U1{dLgg=C-Ie`#ybEqd_`lC$X~SJ`$NwAtFU-I{0arjLj{pDw literal 0 HcmV?d00001 diff --git a/UWUVCI AIO WPF/Models/MainViewModel.cs b/UWUVCI AIO WPF/Models/MainViewModel.cs index eb97330..2ad0061 100644 --- a/UWUVCI AIO WPF/Models/MainViewModel.cs +++ b/UWUVCI AIO WPF/Models/MainViewModel.cs @@ -1661,7 +1661,7 @@ namespace UWUVCI_AIO_WPF if (tool) return $"{ToolCheck.backupulr}{toolname}"; else - return $@"https://github.com/Hotbrawl20/UWUVCI-VCB/raw/master/" + toolname.Replace("bin\\bases\\", ""); + return $@"https://github.com/Hotbrawl20/UWUVCI-VCB/raw/master/Net6/" + toolname.Replace("bin\\bases\\", ""); } catch (Exception) { @@ -1670,7 +1670,7 @@ namespace UWUVCI_AIO_WPF else { var name = toolname.Replace("bin\\bases\\", ""); - return $@"https://github.com/Hotbrawl20/UWUVCI-VCB/raw/master/" + name; + return $@"https://github.com/Hotbrawl20/UWUVCI-VCB/raw/master/Net6/" + name; } } } From bf007bd421021120462c730df9401854a97b4eeb Mon Sep 17 00:00:00 2001 From: ZestyTS Date: Fri, 26 Aug 2022 14:28:48 -0700 Subject: [PATCH 077/102] TitleKeys will be checked again --- UWUVCI AIO WPF/Models/MainViewModel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UWUVCI AIO WPF/Models/MainViewModel.cs b/UWUVCI AIO WPF/Models/MainViewModel.cs index 2ad0061..04be9cf 100644 --- a/UWUVCI AIO WPF/Models/MainViewModel.cs +++ b/UWUVCI AIO WPF/Models/MainViewModel.cs @@ -2052,7 +2052,7 @@ namespace UWUVCI_AIO_WPF public bool checkKey(string key) { var hashCode = GetDeterministicHashCode(key.ToLower()); - if (GbTemp.KeyHash != hashCode) + if (GbTemp.KeyHash == hashCode) { UpdateKeyInFile(key, $@"bin\keys\{GetConsoleOfBase(gbTemp).ToString().ToLower()}.vck", GbTemp, GetConsoleOfBase(gbTemp)); return true; From bde9d800b92f29ce6d570f8b771d1b298690024f Mon Sep 17 00:00:00 2001 From: ZestyTS Date: Fri, 26 Aug 2022 14:35:30 -0700 Subject: [PATCH 078/102] Added support for x64 tools --- UWUVCI AIO WPF/Classes/ToolCheck.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/UWUVCI AIO WPF/Classes/ToolCheck.cs b/UWUVCI AIO WPF/Classes/ToolCheck.cs index 6a5ab3f..3de2969 100644 --- a/UWUVCI AIO WPF/Classes/ToolCheck.cs +++ b/UWUVCI AIO WPF/Classes/ToolCheck.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.IO; using System.IO.Compression; -using System.Net; using System.Net.Http; using System.Security.Cryptography; using System.Threading; @@ -13,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/"; + public static string backupulr = @"https://github.com/Hotbrawl20/UWUVCI-Tools/raw/master/" + (Environment.Is64BitProcess ? "x64/" : ""); public static string[] ToolNames = { "N64Converter.exe", @@ -31,7 +30,6 @@ namespace UWUVCI_AIO_WPF.Classes "nintendont.dol", "nintendont_force.dol", "GetExtTypePatcher.exe", - //"wbfs_file.exe", "wit.exe", "cygwin1.dll", "cygz.dll", From 1c4b7a972278f1853ddfcb5f1c37ce9f982a19e0 Mon Sep 17 00:00:00 2001 From: ZestyTS Date: Fri, 26 Aug 2022 16:39:49 -0700 Subject: [PATCH 079/102] Removed unnecessary reference --- UWUVCI AIO WPF/Models/MainViewModel.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/UWUVCI AIO WPF/Models/MainViewModel.cs b/UWUVCI AIO WPF/Models/MainViewModel.cs index 04be9cf..5034d55 100644 --- a/UWUVCI AIO WPF/Models/MainViewModel.cs +++ b/UWUVCI AIO WPF/Models/MainViewModel.cs @@ -16,7 +16,6 @@ using UWUVCI_AIO_WPF.Properties; using UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Bases; using UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations; using UWUVCI_AIO_WPF.UI.Windows; -using AutoUpdaterDotNET; using System.Threading; using System.Windows.Threading; using System.Diagnostics; @@ -1633,7 +1632,7 @@ namespace UWUVCI_AIO_WPF var isToolRight = await ToolCheck.IsToolRightAsync(name); if (isToolRight) break; - + using var httpClient = new HttpClient(); using var response = await httpClient.GetStreamAsync(getDownloadLink(name, true)); using var fs = new FileStream(filePath, FileMode.Create); From 2f7f2a3b99d65c572d7e514430be5777142c29d2 Mon Sep 17 00:00:00 2001 From: ZestyTS Date: Fri, 26 Aug 2022 16:40:20 -0700 Subject: [PATCH 080/102] Fixed naming issue plus made code more efficient --- UWUVCI AIO WPF/Classes/ToolCheck.cs | 46 ++++++++++------------------- 1 file changed, 15 insertions(+), 31 deletions(-) diff --git a/UWUVCI AIO WPF/Classes/ToolCheck.cs b/UWUVCI AIO WPF/Classes/ToolCheck.cs index 3de2969..8ef581a 100644 --- a/UWUVCI AIO WPF/Classes/ToolCheck.cs +++ b/UWUVCI AIO WPF/Classes/ToolCheck.cs @@ -64,44 +64,28 @@ namespace UWUVCI_AIO_WPF.Classes public static async Task IsToolRightAsync(string name) { - bool ret = false; - string md5Name = FolderName + "\\" + name + ".md5"; - + string md5Name = name + ".md5"; + string md5Path = FolderName + "\\" + md5Name; + using (var httpClient = new HttpClient()) { - using (var response = await httpClient.GetStreamAsync(backupulr + md5Name)) - using (var fs = new FileStream(md5Name, FileMode.Create)) - await response.CopyToAsync(fs); + using var response = await httpClient.GetStreamAsync(backupulr + md5Name); + using var fs = new FileStream(md5Path, FileMode.Create); + await response.CopyToAsync(fs); + } + + var md5 = ""; + using (var sr = new StreamReader(md5Path)) + md5 = await sr.ReadToEndAsync(); - using var sr = new StreamReader(md5Name); - var md5 = await sr.ReadLineAsync(); - if (CalculateMD5(name) == md5) - ret = true; - } - - //Dumb solution but whatever, hopefully this deletes the md5file - try - { - File.Delete(md5Name); - } - catch { } - try - { - File.Delete(new FileInfo(System.Reflection.Assembly.GetEntryAssembly().Location).DirectoryName + "\\bin\\Tools\\" + md5Name); - } - catch { } - try - { - File.Delete(new FileInfo(System.Reflection.Assembly.GetEntryAssembly().Location).DirectoryName + "\\bin\\bases\\" + md5Name); - } - catch { } - return ret; + return CalculateMD5(md5Path) == md5; } static string CalculateMD5(string filename) { + var ret = ""; using var md5 = MD5.Create(); - using var stream = File.OpenRead(filename); - string ret = BitConverter.ToString(md5.ComputeHash(stream)).Replace("-", "").ToLower(); + using (var stream = File.OpenRead(filename)) + ret = BitConverter.ToString(md5.ComputeHash(stream)).Replace("-", "").ToLower(); return ret; } From c3a0bdb46456508c55006cddd47d0501c59305c6 Mon Sep 17 00:00:00 2001 From: ZestyTS Date: Fri, 26 Aug 2022 19:04:06 -0700 Subject: [PATCH 081/102] Writing better code --- UWUVCI AIO WPF/UI/Frames/StartFrame.xaml.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/UWUVCI AIO WPF/UI/Frames/StartFrame.xaml.cs b/UWUVCI AIO WPF/UI/Frames/StartFrame.xaml.cs index de0e9de..893b4fa 100644 --- a/UWUVCI AIO WPF/UI/Frames/StartFrame.xaml.cs +++ b/UWUVCI AIO WPF/UI/Frames/StartFrame.xaml.cs @@ -17,18 +17,17 @@ namespace UWUVCI_AIO_WPF.UI.Frames private void Button_Click(object sender, RoutedEventArgs e) { - Process.Start(new ProcessStartInfo() - { - FileName = "https://ko-fi.com/uwuvci", - UseShellExecute = true, - Verb = "open" - }); + OpenKofiLink("uwuvci"); } private void Button_Click2(object sender, RoutedEventArgs e) + { + OpenKofiLink("zestyts"); + } + private void OpenKofiLink(string urlSuffix) { Process.Start(new ProcessStartInfo() { - FileName = "https://ko-fi.com/zestyts", + FileName = "https://ko-fi.com/" + urlSuffix, UseShellExecute = true, Verb = "open" }); From a23a379cb2b358d36613ec1c4e18de875f14d5f4 Mon Sep 17 00:00:00 2001 From: ZestyTS Date: Fri, 26 Aug 2022 19:16:43 -0700 Subject: [PATCH 082/102] Moving version number up --- UWUVCI AIO WPF/Properties/AssemblyInfo.cs | 4 ++-- UWUVCI AIO WPF/UI/Frames/SettingsFrame.xaml | 2 +- UWUVCI AIO WPF/UI/Frames/StartFrame.xaml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/UWUVCI AIO WPF/Properties/AssemblyInfo.cs b/UWUVCI AIO WPF/Properties/AssemblyInfo.cs index 08e8590..68fd7fc 100644 --- a/UWUVCI AIO WPF/Properties/AssemblyInfo.cs +++ b/UWUVCI AIO WPF/Properties/AssemblyInfo.cs @@ -51,5 +51,5 @@ using System.Windows; // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, // indem Sie "*" wie unten gezeigt eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.9.0.0")] -[assembly: AssemblyFileVersion("3.9.0.0")] +[assembly: AssemblyVersion("3.99.0.0")] +[assembly: AssemblyFileVersion("3.99.0.0")] diff --git a/UWUVCI AIO WPF/UI/Frames/SettingsFrame.xaml b/UWUVCI AIO WPF/UI/Frames/SettingsFrame.xaml index 72c0f7f..4f451fc 100644 --- a/UWUVCI AIO WPF/UI/Frames/SettingsFrame.xaml +++ b/UWUVCI AIO WPF/UI/Frames/SettingsFrame.xaml @@ -46,7 +46,7 @@ -