diff --git a/UWUVCI AIO WPF.sln b/UWUVCI AIO WPF.sln index e2432d2..5b3b817 100644 --- a/UWUVCI AIO WPF.sln +++ b/UWUVCI AIO WPF.sln @@ -1,32 +1,20 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.2.32630.192 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29806.167 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UWUVCI AIO WPF", "UWUVCI AIO WPF\UWUVCI AIO WPF.csproj", "{6A60AB0E-4597-4ECA-AEFB-D63A26CA7B54}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UWUVCI AIO WPF", "UWUVCI AIO WPF\UWUVCI AIO WPF.csproj", "{6A60AB0E-4597-4ECA-AEFB-D63A26CA7B54}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {6A60AB0E-4597-4ECA-AEFB-D63A26CA7B54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6A60AB0E-4597-4ECA-AEFB-D63A26CA7B54}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6A60AB0E-4597-4ECA-AEFB-D63A26CA7B54}.Debug|x64.ActiveCfg = Debug|x64 - {6A60AB0E-4597-4ECA-AEFB-D63A26CA7B54}.Debug|x64.Build.0 = Debug|x64 - {6A60AB0E-4597-4ECA-AEFB-D63A26CA7B54}.Debug|x86.ActiveCfg = Debug|x86 - {6A60AB0E-4597-4ECA-AEFB-D63A26CA7B54}.Debug|x86.Build.0 = Debug|x86 {6A60AB0E-4597-4ECA-AEFB-D63A26CA7B54}.Release|Any CPU.ActiveCfg = Release|Any CPU {6A60AB0E-4597-4ECA-AEFB-D63A26CA7B54}.Release|Any CPU.Build.0 = Release|Any CPU - {6A60AB0E-4597-4ECA-AEFB-D63A26CA7B54}.Release|x64.ActiveCfg = Release|x64 - {6A60AB0E-4597-4ECA-AEFB-D63A26CA7B54}.Release|x64.Build.0 = Release|x64 - {6A60AB0E-4597-4ECA-AEFB-D63A26CA7B54}.Release|x86.ActiveCfg = Release|x86 - {6A60AB0E-4597-4ECA-AEFB-D63A26CA7B54}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/UWUVCI AIO WPF/App.config b/UWUVCI AIO WPF/App.config index 88f9bb4..183a96b 100644 --- a/UWUVCI AIO WPF/App.config +++ b/UWUVCI AIO WPF/App.config @@ -49,9 +49,9 @@ False - - - + + + diff --git a/UWUVCI AIO WPF/App.xaml.cs b/UWUVCI AIO WPF/App.xaml.cs index 07e9ec5..631e9b9 100644 --- a/UWUVCI AIO WPF/App.xaml.cs +++ b/UWUVCI AIO WPF/App.xaml.cs @@ -105,7 +105,7 @@ namespace UWUVCI_AIO_WPF { //wnd.is32(); - 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. "); + 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 or @ZestyTS in #wiiu-assistance in the Nintendo Homebrew discord. "); cm.ShowDialog(); } diff --git a/UWUVCI AIO WPF/Classes/BootImage.cs b/UWUVCI AIO WPF/Classes/BootImage.cs index 5d8e1a9..0c58775 100644 --- a/UWUVCI AIO WPF/Classes/BootImage.cs +++ b/UWUVCI AIO WPF/Classes/BootImage.cs @@ -128,7 +128,7 @@ namespace UWUVCI_AIO_WPF.Classes //if rectangle isn't able to get set then H4V3 should be used. rectangle = _rectangleH4V3; } - + if (TitleScreen != null) g.DrawImage(TitleScreen, rectangle); else @@ -141,11 +141,12 @@ namespace UWUVCI_AIO_WPF.Classes if (!string.IsNullOrEmpty(NameLine1) || !string.IsNullOrEmpty(NameLine2)) { - var regex= "^[a-zA-Z0-9\\d\\s\\.\\'\\&\\\\(\\)\\-\\:\\;\\.\\,\\?\\^\\¿]*$"; + var regex = "^[a-zA-Z0-9\\d\\s\\.\\'\\&\\\\(\\)\\-\\:\\;\\.\\,\\?\\^\\¿]*$"; var match = Regex.Match(NameLine1, regex); var match2 = Regex.Match(NameLine2, regex); if (!match.Success || !match2.Success) - isNotEnglish = true; + if (!NameLine1.Contains("é") || !NameLine2.Contains("é")) + isNotEnglish = true; Pen outlineBold = new Pen(Color.FromArgb(222, 222, 222), 5.0F); Pen shadowBold = new Pen(Color.FromArgb(190, 190, 190), 7.0F); @@ -207,11 +208,11 @@ namespace UWUVCI_AIO_WPF.Classes pStr = "Players: " + pStr; GraphicsPath p = new GraphicsPath(); - + p.AddString(pStr, font.FontFamily, (int)(FontStyle.Regular), g.DpiY * 25.0F / 72.0F, new Rectangle(586, 496, 600, 40), format); - + g.DrawPath(shadow, p); g.DrawPath(outline, p); g.FillPath(brush, p); diff --git a/UWUVCI AIO WPF/Classes/Injection.cs b/UWUVCI AIO WPF/Classes/Injection.cs index e492cde..c795758 100644 --- a/UWUVCI AIO WPF/Classes/Injection.cs +++ b/UWUVCI AIO WPF/Classes/Injection.cs @@ -1,15 +1,23 @@ using GameBaseClassLibrary; +using GMWare.M2.MArchive; +using GMWare.M2.Psb; +using NAudio.Wave; using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.IO.Compression; using System.Linq; +using System.Net; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text; using System.Text.RegularExpressions; using System.Threading; +using System.Threading.Tasks; using System.Windows; +using System.Windows.Forms; +using System.Windows.Media.Imaging; using System.Windows.Threading; using System.Xml; using UWUVCI_AIO_WPF.Classes; @@ -17,9 +25,7 @@ using UWUVCI_AIO_WPF.Properties; using UWUVCI_AIO_WPF.UI.Windows; using Newtonsoft.Json; using MessageBox = System.Windows.MessageBox; -using WiiUDownloaderLibrary; -using System.Threading.Tasks; -using WiiUDownloaderLibrary.Models; +using Newtonsoft.Json.Linq; namespace UWUVCI_AIO_WPF { @@ -48,10 +54,10 @@ namespace UWUVCI_AIO_WPF [DllImport("user32.dll", SetLastError = true)] static extern bool PostMessage(IntPtr hWnd, int Msg, System.Windows.Forms.Keys wParam, int lParam); private static Int32 WM_KEYUP = 0x101; - private static readonly string tempPath = Path.Combine(Directory.GetCurrentDirectory(), "bin", "temp"); + private static readonly string tempPath = Path.Combine(Directory.GetCurrentDirectory(),"bin", "temp"); private static readonly string baseRomPath = Path.Combine(tempPath, "baserom"); private static readonly string imgPath = Path.Combine(tempPath, "img"); - private static readonly string toolsPath = Path.Combine(Directory.GetCurrentDirectory(), "bin", "Tools"); + private static readonly string toolsPath = Path.Combine(Directory.GetCurrentDirectory(),"bin", "Tools"); static string code = null; static MainViewModel mvvm; @@ -131,7 +137,7 @@ namespace UWUVCI_AIO_WPF } } - catch (Exception) + catch (Exception ) { } @@ -155,15 +161,15 @@ namespace UWUVCI_AIO_WPF [STAThread] public static bool Inject(GameConfig Configuration, string RomPath, MainViewModel mvm, bool force) { - + mvm.failed = false; - + DispatcherTimer timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromSeconds(1); timer.Tick += tick; - + Clean(); - + long freeSpaceInBytes = 0; if (!mvm.saveworkaround) { @@ -176,27 +182,29 @@ namespace UWUVCI_AIO_WPF done = true; freeSpaceInBytes = drive.AvailableFreeSpace; } - catch (Exception) + catch(Exception) { mvm.saveworkaround = true; } + + } long neededspace = 0; - + mvvm = mvm; - + Directory.CreateDirectory(tempPath); + - - + mvm.msg = "Checking Tools..."; mvm.InjcttoolCheck(); - + mvm.Progress = 5; - + mvm.msg = "Copying Base..."; try { @@ -209,7 +217,7 @@ namespace UWUVCI_AIO_WPF } else { - neededspace = 25000000000; + neededspace = 15000000000; } if (freeSpaceInBytes < neededspace) { @@ -217,7 +225,7 @@ namespace UWUVCI_AIO_WPF } } - if (Configuration.BaseRom == null || Configuration.BaseRom.Name == null) + if(Configuration.BaseRom == null || Configuration.BaseRom.Name == null) { throw new Exception("BASE"); } @@ -231,7 +239,7 @@ namespace UWUVCI_AIO_WPF //Custom Base Functionality here CopyBase($"Custom", Configuration.CBasePath); } - if (!Directory.Exists(Path.Combine(baseRomPath, "code")) || !Directory.Exists(Path.Combine(baseRomPath, "content")) || !Directory.Exists(Path.Combine(baseRomPath, "meta"))) + if(!Directory.Exists(Path.Combine(baseRomPath, "code")) || !Directory.Exists(Path.Combine(baseRomPath, "content")) || !Directory.Exists(Path.Combine(baseRomPath, "meta"))) { throw new Exception("MISSINGF"); } @@ -256,80 +264,60 @@ namespace UWUVCI_AIO_WPF mvm.msg = "Adding BootSound..."; bootsound(mvm.BootSound); } - - + + mvm.Progress = 100; - - + + code = null; return true; - } - catch (Exception e) + }catch(Exception e) { mvm.Progress = 100; + code = null; - if (e.Message == "Failed this shit") + if(e.Message == "Failed this shit") { Clean(); return false; } + + var errorMessage = "Injection Failed due to unknown circumstances, please contact us on the UWUVCI discord"; + if (e.Message == "MISSINGF") - { - MessageBox.Show("Injection Failed because there are base files missing. \nPlease redownload the base, or redump if you used a custom base! ", "Injection Failed", MessageBoxButton.OK, MessageBoxImage.Error); - - } + errorMessage = "Injection Failed because there are base files missing. \nPlease redownload the base, or redump if you used a custom base!"; else if (e.Message.Contains("Images")) - { - var extraInfo = "TgaIco: " + Path.GetFileName(Configuration.TGAIco.ImgPath) + "\nTgaTv: " + Path.GetFileName(Configuration.TGATv.ImgPath) + "\nTgaDrc:" + Path.GetFileName(Configuration.TGADrc.ImgPath); - MessageBox.Show("Injection Failed due to wrong BitDepth, please check if your Files are in a different bitdepth than 32bit or 24bit\n\nExtra Info:\n" + extraInfo, "Injection Failed", MessageBoxButton.OK, MessageBoxImage.Error); - } + errorMessage = "Injection Failed due to wrong BitDepth, please check if your Files are in a different bitdepth than 32bit or 24bit\n\nIf the image/s that's being used is automatically grabbed for you, then don't use them." + + "\nFAQ: #28"; else if (e.Message.Contains("Size")) - { - MessageBox.Show("Injection Failed due to Image Issues.Please check if your Images are made using following Information:\n\niconTex: \nDimensions: 128x128\nBitDepth: 32\n\nbootDrcTex: \nDimensions: 854x480\nBitDepth: 24\n\nbootTvTex: \nDimensions: 1280x720\nBitDepth: 24\n\nbootLogoTex: \nDimensions: 170x42\nBitDepth: 32", "Injection Failed", MessageBoxButton.OK, MessageBoxImage.Error); - - } + errorMessage = "Injection Failed due to Image Issues.Please check if your Images are made using following Information:\n\niconTex: \nDimensions: 128x128\nBitDepth: 32\n\nbootDrcTex: \nDimensions: 854x480\nBitDepth: 24\n\nbootTvTex: \nDimensions: 1280x720\nBitDepth: 24\n\nbootLogoTex: \nDimensions: 170x42\nBitDepth: 32"; else if (e.Message.Contains("retro")) - { - MessageBox.Show("The ROM you want to Inject is to big for selected Base!\nPlease try again with different Base", "Injection Failed", MessageBoxButton.OK, MessageBoxImage.Error); - } + errorMessage = "The ROM you want to Inject is to big for selected Base!\nPlease try again with different Base"; else if (e.Message.Contains("BASE")) - { - MessageBox.Show("If you import a config you NEED to reselect a base", "Injection Failed", MessageBoxButton.OK, MessageBoxImage.Error); - } + errorMessage = "If you import a config you NEED to reselect a base"; else if (e.Message.Contains("WII")) - { - MessageBox.Show($"{e.Message.Replace("WII", "")}\nPlease make sure that your ROM isn't flawed and that you have atleast 12 GB of free Storage left.", "Injection Failed", MessageBoxButton.OK, MessageBoxImage.Error); - } + errorMessage = $"{e.Message.Replace("WII", "")}\nPlease make sure that your ROM isn't flawed and that you have atleast 12 GB of free Storage left."; else if (e.Message.Contains("12G")) - { - MessageBox.Show($" Please make sure to have atleast {FormatBytes(25000000000)} of storage left on the drive where you stored the Injector.", "Injection Failed", MessageBoxButton.OK, MessageBoxImage.Error); - } + errorMessage = $" Please make sure to have atleast {FormatBytes(15000000000)} of storage left on the drive where you stored the Injector."; else if (e.Message.Contains("nkit")) - { - MessageBox.Show($"There is an issue with your NKIT.\nPlease try the original ISO, or redump your game and try again with that dump.", "Injection Failed", MessageBoxButton.OK, MessageBoxImage.Error); + errorMessage = $"There is an issue with your NKIT.\nPlease try the original ISO, or redump your game and try again with that dump."; + else if (e.Message.Contains("meta.xml")) + errorMessage = "Looks to be your meta.xml file isn't missing from your directory. If you downloaded your base, redownload it, if it's a custom base then the folder selected might be wrong or the layout is messed up."; + else if (e.Message.Contains("pre.iso")) + errorMessage = "Looks to be that there is something about your game that UWUVCI doesn't like, you are most likely injecting with a wbfs or nkit.iso file, this file has data trimmed." + + "\nFAQ: #17, #27, #29"; + else if (e.Message.Contains("temp\\temp") || e.Message.Contains("temp/temp")) + errorMessage = "Looks to be your images are the problem" + + "\nFAQ: #28"; - } - else - { - var romName = Path.GetFileName(mvm.RomPath); - var errorMessage = "Rom Name: " + romName; + MessageBox.Show(errorMessage + "\n\nDon't forget that there's an FAQ in the ReadMe.txt file and on the UWUVCI Discord\n\nError Message:\n" + e.Message, "Injection Failed", MessageBoxButton.OK, MessageBoxImage.Error); - if (romName.Contains("nkit") && Configuration.Console == GameConsoles.GCN) - errorMessage += "\n\nLooks like you're using a compressed game, try either redumping or using the iso version instead."; - else if (!romName.Contains("iso") && (Configuration.Console == GameConsoles.WII || Configuration.Console == GameConsoles.GCN)) - errorMessage += "\n\nLooks like you're using a compressed game, try either redumping or using the iso version instead."; - else - errorMessage += "\n\nIf you're using a compressed or trimmed version, try it with the uncompressed or untrimmed version instead."; - - MessageBox.Show("Injection Failed due to unknown circumstances, please contact us on the UWUVCI discord\n\nError Message:\n" + e.Message + "\n\nExtra Info:\n" + errorMessage, "Injection Failed", MessageBoxButton.OK, MessageBoxImage.Error); - - } Clean(); return false; } finally { - + mvm.Index = -1; mvm.LR = false; mvm.msg = ""; @@ -355,7 +343,7 @@ namespace UWUVCI_AIO_WPF { string btsndPath = Path.Combine(baseRomPath, "meta", "bootSound.btsnd"); FileInfo soundFile = new FileInfo(sound); - if (soundFile.Extension.Contains("mp3") || soundFile.Extension.Contains("wav")) + if(soundFile.Extension.Contains("mp3") || soundFile.Extension.Contains("wav")) { // Convert input file to 6 second .wav using (Process sox = new Process()) @@ -386,21 +374,21 @@ namespace UWUVCI_AIO_WPF using (FileStream output = new FileStream(outputBtsnd, FileMode.OpenOrCreate)) using (BinaryWriter writer = new BinaryWriter(output)) { - writer.Write(new byte[] { 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0 }); + writer.Write(new byte[] {0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0x0}); for (int i = 0x2C; i < buffer.Length; i += 2) { - writer.Write(new[] { buffer[i + 1], buffer[i] }); + writer.Write(new[] {buffer[i+1], buffer[i]}); } } } static void timer_Tick(object sender, EventArgs e) { - if (mvvm.Progress < 50) + if(mvvm.Progress < 50) { mvvm.Progress += 1; } - + } private static void RunSpecificInjection(GameConfig cfg, GameConsoles console, string RomPath, bool force, MainViewModel mvm) { @@ -411,7 +399,7 @@ namespace UWUVCI_AIO_WPF break; case GameConsoles.N64: - N64(RomPath, cfg.N64Stuff); + N64(RomPath, cfg.N64Stuff); break; case GameConsoles.GBA: @@ -434,8 +422,7 @@ namespace UWUVCI_AIO_WPF if (RomPath.ToLower().EndsWith(".dol")) { WiiHomebrew(RomPath, mvm); - } - else if (RomPath.ToLower().EndsWith(".wad")) + }else if (RomPath.ToLower().EndsWith(".wad")) { WiiForwarder(RomPath, mvm); } @@ -443,7 +430,7 @@ namespace UWUVCI_AIO_WPF { WII(RomPath, mvm); } - + break; case GameConsoles.GCN: GC(RomPath, mvm, force); @@ -457,15 +444,14 @@ namespace UWUVCI_AIO_WPF } private static void WiiForwarder(string romPath, MainViewModel mvm) { + string savedir = Directory.GetCurrentDirectory(); mvvm.msg = "Extracting Forwarder Base..."; - - if (Directory.Exists(Path.Combine(tempPath, "TempBase"))) - Directory.Delete(Path.Combine(tempPath, "TempBase"), true); - + if (Directory.Exists(Path.Combine(tempPath, "TempBase"))) Directory.Delete(Path.Combine(tempPath, "TempBase"), true); Directory.CreateDirectory(Path.Combine(tempPath, "TempBase")); - ZipFile.ExtractToDirectory(Path.Combine(toolsPath, "BASE.zip"), Path.Combine(tempPath)); - + var zipLocation = Path.Combine(toolsPath, "BASE.zip"); + ZipFile.ExtractToDirectory(zipLocation, Path.Combine(tempPath)); + DirectoryCopy(Path.Combine(tempPath, "BASE"), Path.Combine(tempPath, "TempBase"), true); mvvm.Progress = 20; mvvm.msg = "Setting up Forwarder..."; @@ -479,7 +465,7 @@ namespace UWUVCI_AIO_WPF } string[] id = { ByteArrayToString(test) }; - File.WriteAllLines(Path.Combine(tempPath, "TempBase", "files", "title.txt"), id); + File.WriteAllLines(Path.Combine(tempPath, "TempBase", "files","title.txt"), id); mvm.Progress = 30; mvm.msg = "Copying Forwarder..."; File.Copy(Path.Combine(toolsPath, "forwarder.dol"), Path.Combine(tempPath, "TempBase", "sys", "main.dol")); @@ -534,23 +520,33 @@ namespace UWUVCI_AIO_WPF { File.Delete(sFile); } - - string gamePath = Path.Combine(baseRomPath, "content", "game.iso"); - File.Move(Path.Combine(tempPath, "game.iso"), gamePath); - - string extra = ""; - if (mvm.Index == 2) + File.Move(Path.Combine(tempPath, "game.iso"), Path.Combine(baseRomPath, "content", "game.iso")); + File.Copy(Path.Combine(toolsPath, "nfs2iso2nfs.exe"), Path.Combine(baseRomPath, "content", "nfs2iso2nfs.exe")); + Directory.SetCurrentDirectory(Path.Combine(baseRomPath, "content")); + using (Process iso2nfs = new Process()) { - extra = "-horizontal "; + if (!mvm.debug) + { + + iso2nfs.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; + } + iso2nfs.StartInfo.FileName = "nfs2iso2nfs.exe"; + string extra = ""; + if (mvm.Index == 2) + { + extra = "-horizontal "; + } + if (mvm.Index == 3) { extra = "-wiimote "; } + if (mvm.Index == 4) { extra = "-instantcc "; } + if (mvm.Index == 5) { extra = "-nocc "; } + if (mvm.LR) { extra += "-lrpatch "; } + iso2nfs.StartInfo.Arguments = $"-enc -homebrew {extra}-iso game.iso"; + iso2nfs.Start(); + iso2nfs.WaitForExit(); + File.Delete("nfs2iso2nfs.exe"); + File.Delete("game.iso"); } - if (mvm.Index == 3) { extra = "-wiimote "; } - if (mvm.Index == 4) { extra = "-instantcc "; } - if (mvm.Index == 5) { extra = "-nocc "; } - if (mvm.LR) { extra += "-lrpatch "; } - - nfs2iso2nfs.Depreciated.Main(new string[] { "-enc", "-homebrew", extra, "-iso", gamePath, "-fwimg", Path.Combine(baseRomPath, "code", "fw.img"), "-key", Path.Combine(baseRomPath, "code", "htk.bin"), "-output", Path.Combine(baseRomPath, "content") + Path.DirectorySeparatorChar }); - - File.Delete(gamePath); + Directory.SetCurrentDirectory(savedir); mvm.Progress = 80; @@ -558,8 +554,10 @@ namespace UWUVCI_AIO_WPF private static void WiiHomebrew(string romPath, MainViewModel mvm) { + string savedir = Directory.GetCurrentDirectory(); mvvm.msg = "Extracting Homebrew Base..."; - if (Directory.Exists(Path.Combine(tempPath, "TempBase"))) + + if (Directory.Exists(Path.Combine(tempPath, "TempBase"))) Directory.Delete(Path.Combine(tempPath, "TempBase"), true); Directory.CreateDirectory(Path.Combine(tempPath, "TempBase")); @@ -622,23 +620,37 @@ namespace UWUVCI_AIO_WPF { File.Delete(sFile); } - string gamePath = Path.Combine(baseRomPath, "content", "game.iso"); - File.Move(Path.Combine(tempPath, "game.iso"), gamePath); - - string pass = "-passthrough "; - if (mvm.passtrough != true) + File.Move(Path.Combine(tempPath, "game.iso"), Path.Combine(baseRomPath, "content", "game.iso")); + File.Copy(Path.Combine(toolsPath, "nfs2iso2nfs.exe"), Path.Combine(baseRomPath, "content", "nfs2iso2nfs.exe")); + Directory.SetCurrentDirectory(Path.Combine(baseRomPath, "content")); + using (Process iso2nfs = new Process()) { - pass = ""; + if (!mvm.debug) + { + + iso2nfs.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; + } + iso2nfs.StartInfo.FileName = "nfs2iso2nfs.exe"; + string pass = "-passthrough "; + if(mvm.passtrough != true) + { + pass = ""; + } + iso2nfs.StartInfo.Arguments = $"-enc -homebrew {pass}-iso game.iso"; + iso2nfs.Start(); + iso2nfs.WaitForExit(); + File.Delete("nfs2iso2nfs.exe"); + File.Delete("game.iso"); } - nfs2iso2nfs.Depreciated.Main(new string[] { "-enc", "-homebrew", pass, "-iso", gamePath, "-fwimg", Path.Combine(baseRomPath, "code", "fw.img"), "-key", Path.Combine(baseRomPath, "code", "htk.bin"), "-output", Path.Combine(baseRomPath, "content") + Path.DirectorySeparatorChar }); - - File.Delete(gamePath); - + Directory.SetCurrentDirectory(savedir); mvm.Progress = 80; - } + + + } private static void WII(string romPath, MainViewModel mvm) { + string savedir = Directory.GetCurrentDirectory(); if (mvm.NKITFLAG || romPath.Contains("nkit")) { using (Process toiso = new Process()) @@ -649,12 +661,12 @@ namespace UWUVCI_AIO_WPF toiso.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; // toiso.StartInfo.CreateNoWindow = true; } - toiso.StartInfo.FileName = Path.Combine(toolsPath, "ConvertToIso.exe"); - toiso.StartInfo.Arguments = $"\"{romPath}\""; + toiso.StartInfo.FileName = Path.Combine(toolsPath, "wit.exe"); + toiso.StartInfo.Arguments = $"copy --source \"{romPath}\" --dest \"{Path.Combine(tempPath, "pre.iso")}\" -I"; toiso.Start(); toiso.WaitForExit(); - if (!File.Exists(Path.Combine(toolsPath, "out.iso"))) + if(!File.Exists(Path.Combine(toolsPath, "out.iso"))) { throw new Exception("nkit"); } @@ -693,10 +705,9 @@ namespace UWUVCI_AIO_WPF mvm.msg = "Trying to change the Manual..."; //READ FIRST 4 BYTES byte[] chars = new byte[4]; - - using (FileStream fstrm = new FileStream(Path.Combine(tempPath, "pre.iso"), FileMode.Open)) - fstrm.Read(chars, 0, 4); - + FileStream fstrm = new FileStream(Path.Combine(tempPath, "pre.iso"), FileMode.Open); + fstrm.Read(chars, 0, 4); + fstrm.Close(); string procod = ByteArrayToString(chars); string neededformanual = procod.ToHex(); string metaXml = Path.Combine(baseRomPath, "meta", "meta.xml"); @@ -711,30 +722,41 @@ namespace UWUVCI_AIO_WPF { if (mvm.regionfrii) { - byte[] write1; - byte[] write2; if (mvm.regionfriius) { - write1 = new byte[] { 0x01 }; - write2 = new byte[] { 0x80, 0x06, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 }; + using (FileStream fs = new FileStream(Path.Combine(tempPath, "pre.iso"), FileMode.Open)) + { + fs.Seek(0x4E003, SeekOrigin.Begin); + fs.Write(new byte[] { 0x01 },0,1); + fs.Seek(0x4E010, SeekOrigin.Begin); + fs.Write(new byte[] { 0x80, 0x06, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 },0,16); + fs.Close(); + + } } - else if (mvm.regionfriijp) + else if(mvm.regionfriijp) { - write1 = new byte[] { 0x00 }; - write2 = new byte[] { 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 }; + using (FileStream fs = new FileStream(Path.Combine(tempPath, "pre.iso"), FileMode.Open)) + { + fs.Seek(0x4E003, SeekOrigin.Begin); + fs.Write(new byte[] { 0x00 }, 0, 1); + fs.Seek(0x4E010, SeekOrigin.Begin); + fs.Write(new byte[] { 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 },0, 16); + fs.Close(); + + } } else { - write1 = new byte[] { 0x02 }; - write2 = new byte[] { 0x80, 0x80, 0x80, 0x00, 0x03, 0x03, 0x04, 0x03, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 }; - } + using (FileStream fs = new FileStream(Path.Combine(tempPath, "pre.iso"), FileMode.Open)) + { + fs.Seek(0x4E003, SeekOrigin.Begin); + fs.Write(new byte[] { 0x02 }, 0, 1); + fs.Seek(0x4E010, SeekOrigin.Begin); + fs.Write(new byte[] { 0x80, 0x80, 0x80, 0x00, 0x03, 0x03, 0x04, 0x03, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 }, 0, 16); + fs.Close(); - using (FileStream fs = new FileStream(Path.Combine(tempPath, "pre.iso"), FileMode.Open)) - { - fs.Seek(0x4E003, SeekOrigin.Begin); - fs.Write(write1, 0, 1); - fs.Seek(0x4E010, SeekOrigin.Begin); - fs.Write(write2, 0, 16); + } } } using (Process trimm = new Process()) @@ -773,11 +795,11 @@ namespace UWUVCI_AIO_WPF } if (mvm.jppatch) { - + mvm.msg = "Language Patching ROM..."; using (BinaryWriter writer = new BinaryWriter(new FileStream(Path.Combine(tempPath, "TEMP", "sys", "main.dol"), FileMode.Open))) { - byte[] stuff = new byte[] { 0x38, 0x60 }; + byte[] stuff = new byte[] { 0x38, 0x60}; writer.Seek(0x4CBDAC, SeekOrigin.Begin); writer.Write(stuff); writer.Seek(0x4CBDAF, SeekOrigin.Begin); @@ -789,14 +811,15 @@ namespace UWUVCI_AIO_WPF } if (mvm.Patch) { - + mvm.msg = "Video Patching ROM..."; using (Process vmc = new Process()) { - var wiiVmcPath = Path.Combine(tempPath, "TEMP", "sys", "wii-vmc.exe"); - File.Copy(Path.Combine(toolsPath, "wii-vmc.exe"), wiiVmcPath); - vmc.StartInfo.FileName = wiiVmcPath; + File.Copy(Path.Combine(toolsPath, "wii-vmc.exe"), Path.Combine(tempPath, "TEMP", "sys", "wii-vmc.exe")); + + Directory.SetCurrentDirectory(Path.Combine(tempPath, "TEMP", "sys")); + vmc.StartInfo.FileName = "wii-vmc.exe"; vmc.StartInfo.Arguments = "main.dol"; vmc.StartInfo.UseShellExecute = false; vmc.StartInfo.CreateNoWindow = true; @@ -812,9 +835,10 @@ namespace UWUVCI_AIO_WPF Thread.Sleep(2000); vmc.StandardInput.WriteLine(); vmc.WaitForExit(); - File.Delete(wiiVmcPath); + File.Delete("wii-vmc.exe"); + Directory.SetCurrentDirectory(savedir); mvm.Progress = 40; } @@ -837,7 +861,7 @@ namespace UWUVCI_AIO_WPF } else { - if (mvm.Index == 4 || mvm.Patch) + if(mvm.Index == 4 || mvm.Patch) { using (Process trimm = new Process()) { @@ -860,7 +884,7 @@ namespace UWUVCI_AIO_WPF using (Process tik = new Process()) { tik.StartInfo.FileName = Path.Combine(toolsPath, "GetExtTypePatcher.exe"); - tik.StartInfo.Arguments = $"\"{Path.Combine(tempPath, "TEMP", "DATA", "sys", "main.dol")}\" -nc"; + tik.StartInfo.Arguments = $"\"{Path.Combine(tempPath, "TEMP","DATA", "sys", "main.dol")}\" -nc"; tik.StartInfo.UseShellExecute = false; tik.StartInfo.CreateNoWindow = true; tik.StartInfo.RedirectStandardOutput = true; @@ -878,10 +902,11 @@ namespace UWUVCI_AIO_WPF mvm.msg = "Video Patching ROM..."; using (Process vmc = new Process()) { - var wiiVmcPath = Path.Combine(tempPath, "TEMP", "DATA", "sys", "wii-vmc.exe"); - File.Copy(Path.Combine(toolsPath, "wii-vmc.exe"), wiiVmcPath); - vmc.StartInfo.FileName = wiiVmcPath; + File.Copy(Path.Combine(toolsPath, "wii-vmc.exe"), Path.Combine(tempPath, "TEMP", "DATA", "sys", "wii-vmc.exe")); + + Directory.SetCurrentDirectory(Path.Combine(tempPath, "TEMP", "DATA", "sys")); + vmc.StartInfo.FileName = "wii-vmc.exe"; vmc.StartInfo.Arguments = "main.dol"; vmc.StartInfo.UseShellExecute = false; vmc.StartInfo.CreateNoWindow = true; @@ -897,9 +922,10 @@ namespace UWUVCI_AIO_WPF Thread.Sleep(2000); vmc.StandardInput.WriteLine(); vmc.WaitForExit(); - File.Delete(wiiVmcPath); + File.Delete("wii-vmc.exe"); + Directory.SetCurrentDirectory(savedir); mvm.Progress = 40; } @@ -923,16 +949,17 @@ namespace UWUVCI_AIO_WPF else { File.Move(Path.Combine(tempPath, "pre.iso"), Path.Combine(tempPath, "game.iso")); - } - + } + } - + + mvm.Progress = 50; mvm.msg = "Replacing TIK and TMD..."; using (Process extract = new Process()) { if (!mvm.debug) { - + extract.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; } extract.StartInfo.FileName = Path.Combine(toolsPath, "wit.exe"); @@ -947,38 +974,50 @@ namespace UWUVCI_AIO_WPF File.Copy(Path.Combine(tempPath, "TIKTMD", "ticket.bin"), Path.Combine(baseRomPath, "code", "rvlt.tik")); Directory.Delete(Path.Combine(tempPath, "TIKTMD"), true); } + mvm.Progress = 60; mvm.msg = "Injecting ROM..."; foreach (string sFile in Directory.GetFiles(Path.Combine(baseRomPath, "content"), "*.nfs")) { File.Delete(sFile); } - string gamePath = Path.Combine(baseRomPath, "content", "game.iso"); - File.Move(Path.Combine(tempPath, "game.iso"), gamePath); - - string extra = ""; - if (mvm.Index == 2) + File.Move(Path.Combine(tempPath, "game.iso"), Path.Combine(baseRomPath, "content", "game.iso")); + File.Copy(Path.Combine(toolsPath, "nfs2iso2nfs.exe"), Path.Combine(baseRomPath, "content", "nfs2iso2nfs.exe")); + Directory.SetCurrentDirectory(Path.Combine(baseRomPath, "content")); + using (Process iso2nfs = new Process()) { - extra = "-horizontal "; + if (!mvm.debug) + { + + iso2nfs.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; + } + iso2nfs.StartInfo.FileName = "nfs2iso2nfs.exe"; + string extra = ""; + if (mvm.Index == 2) + { + extra = "-horizontal "; + } + if (mvm.Index == 3) { extra = "-wiimote "; } + if (mvm.Index == 4) { extra = "-instantcc "; } + if (mvm.Index == 5) { extra = "-nocc "; } + if (mvm.LR) { extra += "-lrpatch "; } + iso2nfs.StartInfo.Arguments = $"-enc {extra}-iso game.iso"; + iso2nfs.Start(); + iso2nfs.WaitForExit(); + File.Delete("nfs2iso2nfs.exe"); + File.Delete("game.iso"); } - if (mvm.Index == 3) { extra = "-wiimote "; } - if (mvm.Index == 4) { extra = "-instantcc "; } - if (mvm.Index == 5) { extra = "-nocc "; } - if (mvm.LR) { extra += "-lrpatch "; } - - nfs2iso2nfs.Depreciated.Main(new string[] { "-enc", "-homebrew", extra, "-iso", gamePath, "-fwimg", Path.Combine(baseRomPath, "code", "fw.img"), "-key", Path.Combine(baseRomPath, "code", "htk.bin"), "-output", Path.Combine(baseRomPath, "content") + Path.DirectorySeparatorChar}); - - File.Delete(gamePath); + Directory.SetCurrentDirectory(savedir); mvm.Progress = 80; - } private static void GC(string romPath, MainViewModel mvm, bool force) { + string savedir = Directory.GetCurrentDirectory(); mvvm.msg = "Extracting Nintendont Base..."; + if (Directory.Exists(Path.Combine(tempPath, "TempBase"))) Directory.Delete(Path.Combine(tempPath, "TempBase"), true); Directory.CreateDirectory(Path.Combine(tempPath, "TempBase")); - ZipFile.ExtractToDirectory(Path.Combine(toolsPath, "BASE.zip"), Path.Combine(tempPath)); DirectoryCopy(Path.Combine(tempPath, "BASE"), Path.Combine(tempPath, "TempBase"), true); @@ -1047,7 +1086,7 @@ namespace UWUVCI_AIO_WPF { File.Copy(romPath, Path.Combine(tempPath, "TempBase", "files", "game.iso")); } - + } } else @@ -1073,7 +1112,7 @@ namespace UWUVCI_AIO_WPF File.Move(Path.Combine(toolsPath, "out.nkit.iso"), Path.Combine(tempPath, "TempBase", "files", "game.iso")); } - + } else { @@ -1103,7 +1142,7 @@ namespace UWUVCI_AIO_WPF { File.Copy(romPath, Path.Combine(tempPath, "TempBase", "files", "game.iso")); } - + } } @@ -1113,37 +1152,36 @@ namespace UWUVCI_AIO_WPF if (mvm.donttrim) { if (mvm.gc2rom.Contains("nkit")) - { - using (Process wit = new Process()) - { - if (!mvm.debug) - { - - wit.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; - } - wit.StartInfo.FileName = Path.Combine(toolsPath, "ConvertToIso.exe"); - wit.StartInfo.Arguments = $"\"{mvm.gc2rom}\""; - wit.Start(); - wit.WaitForExit(); - if (!File.Exists(Path.Combine(toolsPath, "out(Disc 1).iso"))) - { - throw new Exception("nkit"); - } - File.Move(Path.Combine(toolsPath, "out(Disc 1).iso"), Path.Combine(tempPath, "TempBase", "files", "disc2.iso")); - - } - } - else - { - - - File.Copy(mvm.gc2rom, Path.Combine(tempPath, "TempBase", "files", "disc2.iso")); + { + using (Process wit = new Process()) + { + if (!mvm.debug) + { + wit.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; + } + wit.StartInfo.FileName = Path.Combine(toolsPath, "ConvertToIso.exe"); + wit.StartInfo.Arguments = $"\"{mvm.gc2rom}\""; + wit.Start(); + wit.WaitForExit(); + if (!File.Exists(Path.Combine(toolsPath, "out(Disc 1).iso"))) + { + throw new Exception("nkit"); + } + File.Move(Path.Combine(toolsPath, "out(Disc 1).iso"), Path.Combine(tempPath, "TempBase", "files", "disc2.iso")); + } + } + else + { + + + File.Copy(mvm.gc2rom, Path.Combine(tempPath, "TempBase", "files", "disc2.iso")); + + } } - else - { + else{ if (mvm.gc2rom.ToLower().Contains("iso") || mvm.gc2rom.ToLower().Contains("gcm")) { //convert to nkit @@ -1195,17 +1233,17 @@ namespace UWUVCI_AIO_WPF File.Copy(romPath, Path.Combine(tempPath, "TempBase", "files", "disc2.iso")); } } - + } - - - + + + } - using (Process wit = new Process()) + using(Process wit = new Process()) { if (!mvm.debug) { - + wit.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; } wit.StartInfo.FileName = Path.Combine(toolsPath, "wit.exe"); @@ -1267,14 +1305,26 @@ namespace UWUVCI_AIO_WPF { File.Delete(sFile); } - string gamePath = Path.Combine(baseRomPath, "content", "game.iso"); - File.Move(Path.Combine(tempPath, "game.iso"), gamePath); - - nfs2iso2nfs.Depreciated.Main(new string[] { "-enc", "-homebrew", "-passthrough", "-iso", gamePath, "-fwimg", Path.Combine(baseRomPath, "code", "fw.img"), "-key", Path.Combine(baseRomPath, "code", "htk.bin"), "-output", Path.Combine(baseRomPath, "content") + Path.DirectorySeparatorChar }); - - File.Delete(gamePath); - + File.Move(Path.Combine(tempPath, "game.iso"), Path.Combine(baseRomPath, "content", "game.iso")); + File.Copy(Path.Combine(toolsPath, "nfs2iso2nfs.exe"), Path.Combine(baseRomPath, "content", "nfs2iso2nfs.exe")); + Directory.SetCurrentDirectory(Path.Combine(baseRomPath, "content")); + using (Process iso2nfs = new Process()) + { + if (!mvm.debug) + { + + iso2nfs.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; + } + iso2nfs.StartInfo.FileName = "nfs2iso2nfs.exe"; + iso2nfs.StartInfo.Arguments = $"-enc -homebrew -passthrough -iso game.iso"; + iso2nfs.Start(); + iso2nfs.WaitForExit(); + File.Delete("nfs2iso2nfs.exe"); + File.Delete("game.iso"); + } + Directory.SetCurrentDirectory(savedir); mvm.Progress = 80; + } private static void WIIold(string romPath, MainViewModel mvm, bool force) { @@ -1312,8 +1362,8 @@ namespace UWUVCI_AIO_WPF mvvm.msg = "Converting WBFS to ISO..."; Console.WriteLine("Converting WBFS to ISO..."); - tik.StartInfo.FileName = Path.Combine(toolsPath, "wbfs_file.exe"); - tik.StartInfo.Arguments = $"\"{romPath}\" convert \"{Path.Combine(tempPath, "pre.iso")}\""; + tik.StartInfo.FileName = Path.Combine(toolsPath, "wit.exe"); + tik.StartInfo.Arguments = $"copy --source \"{romPath}\" --dest \"{Path.Combine(tempPath, "pre.iso")}\" -I"; tik.Start(); tik.WaitForExit(); if (!File.Exists(Path.Combine(tempPath, "pre.iso"))) @@ -1355,33 +1405,33 @@ namespace UWUVCI_AIO_WPF mvvm.msg = "Video Patching ROM..."; using (Process process = new Process()) { - process.StartInfo.FileName = Path.Combine(toolsPath, "wii-vmc.exe"); + process.StartInfo.FileName = Path.Combine(toolsPath,"wii-vmc.exe"); process.StartInfo.Arguments = $"\"{Path.Combine(tempPath, "IsoExt", "sys", "main.dol")}\""; //process.StartInfo.RedirectStandardInput = true; - // process.StartInfo.UseShellExecute = false; - // process.StartInfo.CreateNoWindow = true; - + // process.StartInfo.UseShellExecute = false; + // process.StartInfo.CreateNoWindow = true; + process.Start(); - /* Thread.Sleep(2000); - process.StandardInput.WriteLine("a"); - Thread.Sleep(2000); - if (mvm.toPal) - { - process.StandardInput.WriteLine("1"); - } - else - { - process.StandardInput.WriteLine("2"); - } + /* Thread.Sleep(2000); + process.StandardInput.WriteLine("a"); + Thread.Sleep(2000); + if (mvm.toPal) + { + process.StandardInput.WriteLine("1"); + } + else + { + process.StandardInput.WriteLine("2"); + } - Thread.Sleep(2000); - process.StandardInput.WriteLine(); - */ + Thread.Sleep(2000); + process.StandardInput.WriteLine(); + */ process.WaitForExit(); } mvvm.Progress = 50; } - + mvvm.msg = "Creating ISO from trimmed ROM..."; Console.WriteLine("Creating ISO from trimmed ROM..."); tik.StartInfo.Arguments = $"copy \"{Path.Combine(tempPath, "IsoExt")}\" --DEST \"{Path.Combine(tempPath, "game.iso")}\" -ovv --links --iso"; @@ -1398,6 +1448,7 @@ namespace UWUVCI_AIO_WPF else { mvvm.msg = "Extracting Nintendont Base..."; + if (Directory.Exists(Path.Combine(tempPath, "TempBase"))) Directory.Delete(Path.Combine(tempPath, "TempBase"), true); @@ -1465,7 +1516,8 @@ namespace UWUVCI_AIO_WPF mvvm.msg = "Injecting ROM..."; Console.WriteLine("Converting Game to NFS format..."); string olddir = Directory.GetCurrentDirectory(); - + Directory.SetCurrentDirectory(Path.Combine(baseRomPath, "content")); + tik.StartInfo.FileName = Path.Combine(toolsPath, "nfs2iso2nfs.exe"); if (!mvm.GC) { string extra = ""; @@ -1479,24 +1531,26 @@ namespace UWUVCI_AIO_WPF if (mvm.LR) { extra += "-lrpatch "; } Console.WriteLine(extra); Console.ReadLine(); - - nfs2iso2nfs.Depreciated.Main(new string[] { "-enc", extra, "-iso", romPath, "-fwimg", Path.Combine(baseRomPath, "code", "fw.img"), "-key", Path.Combine(baseRomPath, "code", "htk.bin"), "-output", Path.Combine(baseRomPath, "content") + Path.DirectorySeparatorChar }); + tik.StartInfo.Arguments = $"-enc {extra}-iso \"{romPath}\""; } else { - nfs2iso2nfs.Depreciated.Main(new string[] { "-enc", "-homebrew", "-passthrough", "-iso", romPath, "-fwimg", Path.Combine(baseRomPath, "code", "fw.img"), "-key", Path.Combine(baseRomPath, "code", "htk.bin"), "-output", Path.Combine(baseRomPath, "content") + Path.DirectorySeparatorChar }); + tik.StartInfo.Arguments = $"-enc -homebrew -passthrough -iso \"{romPath}\""; } + tik.Start(); + tik.WaitForExit(); Console.WriteLine("Finished Conversion"); mvvm.Progress = 80; + Directory.SetCurrentDirectory(olddir); } } - + public static void MSX(string injectRomPath) { mvvm.msg = "Reading Header from Base..."; byte[] test = new byte[0x580B3]; - using (var fs = new FileStream(Path.Combine(baseRomPath, "content", "msx", "msx.pkg"), + using (var fs = new FileStream(Path.Combine(baseRomPath, "content" , "msx", "msx.pkg"), FileMode.Open, FileAccess.ReadWrite)) { @@ -1576,7 +1630,7 @@ namespace UWUVCI_AIO_WPF gameName = gameName.Replace("|", " "); Regex reg = new Regex("[^a-zA-Z0-9 é -]"); //string outputPath = Path.Combine(Properties.Settings.Default.InjectionPath, gameName); - string outputPath = Path.Combine(Properties.Settings.Default.OutPath, $"[LOADIINE]{reg.Replace(gameName, "")} [{mvvm.prodcode}]"); + string outputPath = Path.Combine(Properties.Settings.Default.OutPath, $"[LOADIINE]{reg.Replace(gameName,"")} [{mvvm.prodcode}]"); mvvm.foldername = $"[LOADIINE]{reg.Replace(gameName, "")} [{mvvm.prodcode}]"; int i = 0; while (Directory.Exists(outputPath)) @@ -1585,15 +1639,14 @@ namespace UWUVCI_AIO_WPF mvvm.foldername = $"[LOADIINE]{reg.Replace(gameName, "")} [{mvvm.prodcode}]_{i}"; i++; } - - DirectoryCopy(baseRomPath, outputPath, true); + + DirectoryCopy(baseRomPath,outputPath, true); Custom_Message cm = new Custom_Message("Injection Complete", $"To Open the Location of the Inject press Open Folder.\nIf you want the inject to be put on your SD now, press Copy to SD.", Settings.Default.OutPath); try { cm.Owner = mvvm.mw; - } - catch (Exception) + }catch(Exception ) { } @@ -1609,98 +1662,228 @@ namespace UWUVCI_AIO_WPF mvm.msg = "Creating Outputfolder..."; Regex reg = new Regex("[^a-zA-Z0-9 -]"); if (gameName == null || gameName == string.Empty) gameName = "NoName"; - + //string outputPath = Path.Combine(Properties.Settings.Default.InjectionPath, gameName); - string outputPath = Path.Combine(Properties.Settings.Default.OutPath, $"[WUP]{reg.Replace(gameName, "").Replace("|", " ")}"); + string outputPath = Path.Combine(Properties.Settings.Default.OutPath, $"[WUP]{reg.Replace(gameName,"").Replace("|", " ")}"); outputPath = outputPath.Replace("|", " "); - mvvm.foldername = $"[WUP]{reg.Replace(gameName, "").Replace("|", " ")}"; + mvvm.foldername = $"[WUP]{reg.Replace(gameName, "").Replace("|"," ")}"; int i = 0; while (Directory.Exists(outputPath)) { - outputPath = Path.Combine(Settings.Default.OutPath, $"[WUP]{reg.Replace(gameName, "").Replace("|", " ")}_{i}"); + outputPath = Path.Combine(Properties.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..."; - if (Environment.Is64BitProcess) - CNUSPACKER.Program.Main(new string[] { "-in", baseRomPath, "-out", outputPath, "-encryptKeyWith", Properties.Settings.Default.Ckey }); - else + try + { + Directory.Delete(Environment.GetEnvironmentVariable("LocalAppData") + @"\temp\.net\CNUSPACKER", true); + } + catch { } + using (Process cnuspacker = new Process()) { - 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 {Properties.Settings.Default.Ckey}"; + if (Environment.Is64BitOperatingSystem) + { + cnuspacker.StartInfo.FileName = Path.Combine(toolsPath, "CNUSPACKER.exe"); + 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.WaitForExit(); + Directory.SetCurrentDirectory(oldpath); } mvm.Progress = 90; mvm.msg = "Cleaning..."; Clean(); mvm.Progress = 100; - + mvm.msg = ""; } - public static async Task Download(MainViewModel mvm) + public static void Download(MainViewModel mvm) + { - mvm.InjcttoolCheck(); - GameBases b = mvm.getBasefromName(mvm.SelectedBaseAsString); + + mvm.InjcttoolCheck(); + GameBases b = mvm.getBasefromName(mvm.SelectedBaseAsString); - //GetKeyOfBase - TKeys key = mvm.getTkey(b); + //GetKeyOfBase + TKeys key = mvm.getTkey(b); + if (mvm.GameConfiguration.Console == GameConsoles.WII || mvm.GameConfiguration.Console == GameConsoles.GCN) + { + using (Process zip = new Process()) + { - if (Directory.Exists(tempPath)) Directory.Delete(tempPath, true); - Directory.CreateDirectory(tempPath); + if (Directory.Exists(tempPath)) Directory.Delete(tempPath, true); + Directory.CreateDirectory(tempPath); + using (Process download = new Process()) + { + if (!mvm.debug) + { + download.StartInfo.UseShellExecute = false; + download.StartInfo.CreateNoWindow = true; + } - var titleData = new TitleData(b.Tid, key.Tkey); - var downloadFolder = Path.Combine(tempPath, "download"); - await WiiUDownloaderLibrary.Downloader.DownloadAsync(titleData, downloadFolder); - - mvm.Progress = 75; + download.StartInfo.FileName = Path.Combine(toolsPath, "WiiUDownloader.exe"); + download.StartInfo.Arguments = $"{b.Tid} {key.Tkey} \"{Path.Combine(tempPath, "download")}\""; - CSharpDecrypt.CSharpDecrypt.Decrypt(new string[] { Settings.Default.Ckey, Path.Combine(downloadFolder, b.Tid), Path.Combine(Settings.Default.BasePath, $"{b.Name.Replace(":", "")} [{b.Region}]") }); + download.Start(); + download.WaitForExit(); + } + mvm.Progress = 96; - if (mvm.GameConfiguration.Console == GameConsoles.WII || mvm.GameConfiguration.Console == GameConsoles.GCN) - { - mvm.Progress += 10; - foreach (string sFile in Directory.GetFiles(Path.Combine(Settings.Default.BasePath, $"{b.Name.Replace(":", "")} [{b.Region}]", "content"), "*.nfs")) - File.Delete(sFile); + using (Process decrypt = new Process()) + { + if (!mvm.debug) + { + decrypt.StartInfo.UseShellExecute = false; + decrypt.StartInfo.CreateNoWindow = true; + } - mvm.Progress += 15; - } - else - mvm.Progress = 100; + decrypt.StartInfo.FileName = Path.Combine(toolsPath, "Cdecrypt.exe"); + decrypt.StartInfo.Arguments = $"{Properties.Settings.Default.Ckey} \"{Path.Combine(tempPath, "download")}\" \"{Path.Combine(Properties.Settings.Default.BasePath, $"{b.Name.Replace(":", "")} [{b.Region.ToString()}]")}\""; + decrypt.Start(); + decrypt.WaitForExit(); + } + mvm.Progress = 99; + foreach (string sFile in Directory.GetFiles(Path.Combine(Properties.Settings.Default.BasePath, $"{b.Name.Replace(":", "")} [{b.Region.ToString()}]", "content"), "*.nfs")) + File.Delete(sFile); + + /* File.Delete(Path.Combine(Properties.Settings.Default.BasePath, $"{b.Name.Replace(":", "")} [{b.Region.ToString()}]", "code", "fw.img")); + + File.Delete(Path.Combine(Properties.Settings.Default.BasePath, $"{b.Name.Replace(":", "")} [{b.Region.ToString()}]", "code", "fw.tmd")); + + if (Directory.Exists(Path.Combine(toolsPath, "IKVM"))) { Directory.Delete(Path.Combine(toolsPath, "IKVM"), true); } + if (!mvm.debug) + { + zip.StartInfo.UseShellExecute = false; + zip.StartInfo.CreateNoWindow = true; + } + + zip.StartInfo.FileName = Path.Combine(toolsPath, "7za.exe"); + zip.StartInfo.Arguments = $"x \"{Path.Combine(toolsPath, "IKVM.zip")}\" -o\"{Path.Combine(toolsPath, "IKVM")}\""; + zip.Start(); + zip.WaitForExit(); + mvm.Progress += 10; + string[] JNUSToolConfig = { "http://ccs.cdn.wup.shop.nintendo.net/ccs/download", Properties.Settings.Default.Ckey }; + string savedir = Directory.GetCurrentDirectory(); + File.WriteAllLines(Path.Combine(toolsPath, "IKVM", "config"), JNUSToolConfig); + Directory.SetCurrentDirectory(Path.Combine(toolsPath, "IKVM")); + zip.StartInfo.FileName = "JNUSTool.exe"; + zip.StartInfo.Arguments = $"{b.Tid} {key.Tkey} -file /code/fw.img"; + zip.Start(); + zip.WaitForExit(); + + zip.StartInfo.Arguments = $"{b.Tid} {key.Tkey} -file /code/fw.tmd"; + zip.Start(); + zip.WaitForExit(); + + Directory.SetCurrentDirectory(savedir); + var directories = Directory.GetDirectories(Path.Combine(toolsPath, "IKVM")); + string name = ""; + foreach (var s in directories) + { + if (s.Contains(b.Name)) + { + var split = s.Split('\\'); + name = split[split.Length - 1]; + + } + + } + File.Copy(Path.Combine(toolsPath, "IKVM", name, "code", "fw.img"), Path.Combine(Properties.Settings.Default.BasePath, $"{b.Name.Replace(":", "")} [{b.Region.ToString()}]", "code", "fw.img")); + + File.Copy(Path.Combine(toolsPath, "IKVM", name, "code", "fw.tmd"), Path.Combine(Properties.Settings.Default.BasePath, $"{b.Name.Replace(":", "")} [{b.Region.ToString()}]", "code", "fw.tmd")); + + Directory.Delete(Path.Combine(toolsPath, "IKVM"), true);*/ + mvm.Progress = 100; + } + } + else + { + + + + if (Directory.Exists(tempPath)) Directory.Delete(tempPath, true); + Directory.CreateDirectory(tempPath); + using (Process download = new Process()) + { + if (!mvm.debug) + { + download.StartInfo.UseShellExecute = false; + download.StartInfo.CreateNoWindow = true; + } + + download.StartInfo.FileName = Path.Combine(toolsPath, "WiiUDownloader.exe"); + download.StartInfo.Arguments = $"{b.Tid} {key.Tkey} \"{Path.Combine(tempPath, "download")}\""; + + download.Start(); + download.WaitForExit(); + } + mvm.Progress = 75; + using (Process decrypt = new Process()) + { + if (!mvm.debug) + { + decrypt.StartInfo.UseShellExecute = false; + decrypt.StartInfo.CreateNoWindow = true; + } + decrypt.StartInfo.FileName = Path.Combine(toolsPath, "Cdecrypt.exe"); + decrypt.StartInfo.Arguments = $"{Properties.Settings.Default.Ckey} \"{Path.Combine(tempPath, "download")}\" \"{Path.Combine(Properties.Settings.Default.BasePath, $"{b.Name.Replace(":", "")} [{b.Region.ToString()}]")}\""; + + decrypt.Start(); + decrypt.WaitForExit(); + } + mvm.Progress = 100; + } + + + //GetCurrentSelectedBase + } public static string ExtractBase(string path, GameConsoles console) { - if (!Directory.Exists(Path.Combine(Settings.Default.BasePath, "CustomBases"))) + if(!Directory.Exists(Path.Combine(Properties.Settings.Default.BasePath, "CustomBases"))) { - Directory.CreateDirectory(Path.Combine(Settings.Default.BasePath, "CustomBases")); + Directory.CreateDirectory(Path.Combine(Properties.Settings.Default.BasePath, "CustomBases")); } - string outputPath = Path.Combine(Settings.Default.BasePath, "CustomBases", $"[{console}] Custom"); + string outputPath = Path.Combine(Properties.Settings.Default.BasePath, "CustomBases", $"[{console.ToString()}] Custom"); int i = 0; while (Directory.Exists(outputPath)) { - outputPath = Path.Combine(Settings.Default.BasePath, $"[{console}] Custom_{i}"); + outputPath = Path.Combine(Properties.Settings.Default.BasePath, $"[{console.ToString()}] Custom_{i}"); i++; } + using (Process decrypt = new Process()) + { + + decrypt.StartInfo.UseShellExecute = false; + decrypt.StartInfo.CreateNoWindow = true; + decrypt.StartInfo.FileName = Path.Combine(toolsPath, "Cdecrypt.exe"); + decrypt.StartInfo.Arguments = $"{Properties.Settings.Default.Ckey} \"{path}\" \"{outputPath}"; - CSharpDecrypt.CSharpDecrypt.Decrypt(new string[] { Settings.Default.Ckey, path, outputPath }); - + decrypt.Start(); + decrypt.WaitForExit(); + } return outputPath; } // This function changes TitleID, ProductCode and GameName in app.xml (ID) and meta.xml (ID, ProductCode, Name) private static void EditXML(string gameNameOr, int index, string code) { 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; @@ -1711,96 +1894,87 @@ 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 = new Random(); 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(); - try - { - doc.Load(metaXml); - if (gameName != null && gameName != string.Empty) + XmlDocument doc = new XmlDocument(); + try { - doc.SelectSingleNode("menu/longname_ja").InnerText = gameName.Replace(",", "\n"); - doc.SelectSingleNode("menu/longname_en").InnerText = gameName.Replace(",", "\n"); - doc.SelectSingleNode("menu/longname_fr").InnerText = gameName.Replace(",", "\n"); - doc.SelectSingleNode("menu/longname_de").InnerText = gameName.Replace(",", "\n"); - doc.SelectSingleNode("menu/longname_it").InnerText = gameName.Replace(",", "\n"); - doc.SelectSingleNode("menu/longname_es").InnerText = gameName.Replace(",", "\n"); - doc.SelectSingleNode("menu/longname_zhs").InnerText = gameName.Replace(",", "\n"); - doc.SelectSingleNode("menu/longname_ko").InnerText = gameName.Replace(",", "\n"); - doc.SelectSingleNode("menu/longname_nl").InnerText = gameName.Replace(",", "\n"); - doc.SelectSingleNode("menu/longname_pt").InnerText = gameName.Replace(",", "\n"); - doc.SelectSingleNode("menu/longname_ru").InnerText = gameName.Replace(",", "\n"); - doc.SelectSingleNode("menu/longname_zht").InnerText = gameName.Replace(",", "\n"); - } + doc.Load(metaXml); + if (gameName != null && gameName != string.Empty) + { + doc.SelectSingleNode("menu/longname_ja").InnerText = gameName.Replace(",", "\n" ); + doc.SelectSingleNode("menu/longname_en").InnerText = gameName.Replace(",", "\n"); + doc.SelectSingleNode("menu/longname_fr").InnerText = gameName.Replace(",", "\n"); + doc.SelectSingleNode("menu/longname_de").InnerText = gameName.Replace(",", "\n"); + doc.SelectSingleNode("menu/longname_it").InnerText = gameName.Replace(",", "\n"); + doc.SelectSingleNode("menu/longname_es").InnerText = gameName.Replace(",", "\n"); + doc.SelectSingleNode("menu/longname_zhs").InnerText = gameName.Replace(",", "\n"); + doc.SelectSingleNode("menu/longname_ko").InnerText = gameName.Replace(",", "\n"); + doc.SelectSingleNode("menu/longname_nl").InnerText = gameName.Replace(",", "\n"); + doc.SelectSingleNode("menu/longname_pt").InnerText = gameName.Replace(",", "\n"); + doc.SelectSingleNode("menu/longname_ru").InnerText = gameName.Replace(",", "\n"); + doc.SelectSingleNode("menu/longname_zht").InnerText = gameName.Replace(",", "\n"); + } - /* if(code != null) - { - doc.SelectSingleNode("menu/product_code").InnerText = $"WUP-N-{code}"; - } - else - {*/ - doc.SelectSingleNode("menu/product_code").InnerText = $"WUP-N-{ID2}"; - //} - if (index > 0) - { + /* if(code != null) + { + doc.SelectSingleNode("menu/product_code").InnerText = $"WUP-N-{code}"; + } + else + {*/ + doc.SelectSingleNode("menu/product_code").InnerText = $"WUP-N-{ID2}"; + //} + if (index > 0) + { doc.SelectSingleNode("menu/drc_use").InnerText = "65537"; - } + } doc.SelectSingleNode("menu/title_id").InnerText = $"00050002{ID}"; - doc.SelectSingleNode("menu/group_id").InnerText = $"0000{ID2}"; - if (gameName != null && gameName != string.Empty) + doc.SelectSingleNode("menu/group_id").InnerText = $"0000{ID2}"; + if (gameName != null && gameName != string.Empty) + { + doc.SelectSingleNode("menu/shortname_ja").InnerText = gameName.Split(',')[0]; + doc.SelectSingleNode("menu/shortname_fr").InnerText = gameName.Split(',')[0]; + doc.SelectSingleNode("menu/shortname_de").InnerText = gameName.Split(',')[0]; + doc.SelectSingleNode("menu/shortname_en").InnerText = gameName.Split(',')[0]; + doc.SelectSingleNode("menu/shortname_it").InnerText = gameName.Split(',')[0]; + doc.SelectSingleNode("menu/shortname_es").InnerText = gameName.Split(',')[0]; + doc.SelectSingleNode("menu/shortname_zhs").InnerText = gameName.Split(',')[0]; + doc.SelectSingleNode("menu/shortname_ko").InnerText = gameName.Split(',')[0]; + doc.SelectSingleNode("menu/shortname_nl").InnerText = gameName.Split(',')[0]; + doc.SelectSingleNode("menu/shortname_pt").InnerText = gameName.Split(',')[0]; + doc.SelectSingleNode("menu/shortname_ru").InnerText = gameName.Split(',')[0]; + doc.SelectSingleNode("menu/shortname_zht").InnerText = gameName.Split(',')[0]; + } + + doc.Save(metaXml); + } + catch (NullReferenceException) { - doc.SelectSingleNode("menu/shortname_ja").InnerText = gameName.Split(',')[0]; - doc.SelectSingleNode("menu/shortname_fr").InnerText = gameName.Split(',')[0]; - doc.SelectSingleNode("menu/shortname_de").InnerText = gameName.Split(',')[0]; - doc.SelectSingleNode("menu/shortname_en").InnerText = gameName.Split(',')[0]; - doc.SelectSingleNode("menu/shortname_it").InnerText = gameName.Split(',')[0]; - doc.SelectSingleNode("menu/shortname_es").InnerText = gameName.Split(',')[0]; - doc.SelectSingleNode("menu/shortname_zhs").InnerText = gameName.Split(',')[0]; - doc.SelectSingleNode("menu/shortname_ko").InnerText = gameName.Split(',')[0]; - doc.SelectSingleNode("menu/shortname_nl").InnerText = gameName.Split(',')[0]; - doc.SelectSingleNode("menu/shortname_pt").InnerText = gameName.Split(',')[0]; - doc.SelectSingleNode("menu/shortname_ru").InnerText = gameName.Split(',')[0]; - doc.SelectSingleNode("menu/shortname_zht").InnerText = gameName.Split(',')[0]; + } - doc.Save(metaXml); - } - catch (NullReferenceException) - { - - } - - try - { try { doc.Load(appXml); - } - catch (Exception) - { - if (appXml.Contains("���լ�}�") || appXml.Contains("???լ?}?")) - appXml = appXml[..^7] + ">\r\n"; - doc.Load(appXml); - } doc.SelectSingleNode("app/title_id").InnerText = $"00050002{ID}"; //doc.SelectSingleNode("app/title_id").InnerText = $"0005000247414645"; - - doc.SelectSingleNode("app/group_id").InnerText = $"0000{ID2}"; - doc.Save(appXml); - } - catch (NullReferenceException) - { - - } - - + + doc.SelectSingleNode("app/group_id").InnerText = $"0000{ID2}"; + doc.Save(appXml); + } + catch (NullReferenceException) + { + + } + + } //This function copies the custom or normal Base to the working directory @@ -1817,14 +1991,6 @@ namespace UWUVCI_AIO_WPF else { DirectoryCopy(Path.Combine(Properties.Settings.Default.BasePath, baserom), baseRomPath, true); - var c2wPath = Path.Combine(Directory.GetCurrentDirectory(), "bin", "temp", "C2W"); - if (Directory.Exists(c2wPath)) - try - { - File.Copy(Path.Combine(c2wPath, "c2w.img"), Path.Combine(baseRomPath, "code", "c2w.img"), true); - Directory.Delete(c2wPath, true); - } - catch { } } } @@ -1851,15 +2017,17 @@ 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 @@ -1877,18 +2045,22 @@ 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()) { @@ -1920,10 +2092,10 @@ namespace UWUVCI_AIO_WPF private static void GBA(string injectRomPath, N64Conf config) { bool delete = false; - if (!new FileInfo(injectRomPath).Extension.Contains("gba")) + 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()) + using (Process goomba = new Process()) { mvvm.msg = "Injecting GB/GBC ROM into goomba..."; goomba.StartInfo.UseShellExecute = false; @@ -1959,7 +2131,7 @@ namespace UWUVCI_AIO_WPF } - using (Process psb = new()) + using (Process psb = new Process()) { mvvm.msg = "Injecting ROM..."; psb.StartInfo.UseShellExecute = false; @@ -2111,7 +2283,7 @@ namespace UWUVCI_AIO_WPF mvvm.Progress += 15; } - Directory.Delete(Path.Combine(baseRomPath, "content", "alldata.psb.m_extracted"), true); + Directory.Delete(Path.Combine(baseRomPath, "content", "alldata.psb.m_extracted"),true); File.Delete(Path.Combine(baseRomPath, "content", "alldata.psb")); } @@ -2121,29 +2293,51 @@ namespace UWUVCI_AIO_WPF if (File.Exists(Path.Combine(toolsPath, "goombamenu.gba"))) File.Delete(Path.Combine(toolsPath, "goombamenu.gba")); } } - private static async Task DownloadSysTitle(MainViewModel mvm) + private static void DownloadSysTitle(MainViewModel mvm) { if (mvm.SysKeyset() && mvm.SysKey1set()) { - var titleIds = new string[] { "0005001010004001", "0005001010004000" }; - var paths = new string[] { Path.Combine(Settings.Default.BasePath, $"vwiisys"), Path.Combine(tempPath, "tempd") }; - var downloadFolder = Path.Combine(tempPath, "download"); - - for (var i = 0; i < titleIds.Length; i++) + using (Process download = new Process()) { - var titleData = new TitleData(titleIds[i], Settings.Default.SysKey); - await WiiUDownloaderLibrary.Downloader.DownloadAsync(titleData, downloadFolder); - CSharpDecrypt.CSharpDecrypt.Decrypt(new string[] { Settings.Default.Ckey, Path.Combine(downloadFolder, titleIds[i]), paths[i] }); + download.StartInfo.FileName = Path.Combine(toolsPath, "WiiUDownloader.exe"); + download.StartInfo.Arguments = $"0005001010004001 {Properties.Settings.Default.SysKey} \"{Path.Combine(tempPath, "download")}\""; + download.Start(); + download.WaitForExit(); } + using (Process decrypt = new Process()) + { + decrypt.StartInfo.FileName = Path.Combine(toolsPath, "Cdecrypt.exe"); + decrypt.StartInfo.Arguments = $"{Properties.Settings.Default.Ckey} \"{Path.Combine(tempPath, "download")}\" \"{Path.Combine(Properties.Settings.Default.BasePath, $"vwiisys")}\""; - 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")); + decrypt.Start(); + decrypt.WaitForExit(); + } + using (Process download = new Process()) + { + Directory.Delete(Path.Combine(tempPath, "download"), true); + download.StartInfo.FileName = Path.Combine(toolsPath, "WiiUDownloader.exe"); + download.StartInfo.Arguments = $"0005001010004000 {Properties.Settings.Default.SysKey1} \"{Path.Combine(tempPath, "download")}\""; + + download.Start(); + download.WaitForExit(); + } + using (Process decrypt = new Process()) + { + decrypt.StartInfo.FileName = Path.Combine(toolsPath, "Cdecrypt.exe"); + decrypt.StartInfo.Arguments = $"{Properties.Settings.Default.Ckey} \"{Path.Combine(tempPath, "download")}\" \"{Path.Combine(tempPath, "tempd")}\""; + + decrypt.Start(); + decrypt.WaitForExit(); + 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.Delete(Path.Combine(Properties.Settings.Default.BasePath, $"vwiisys", "code", "app.xml")); + } } } private static void NDS(string injectRomPath) { + string RomName = string.Empty; mvvm.msg = "Getting BaseRom Name..."; var zipLocation = Path.Combine(baseRomPath, "content", "0010", "rom.zip"); @@ -2170,12 +2364,12 @@ namespace UWUVCI_AIO_WPF File.Delete(RomName); } - + private static void N64(string injectRomPath, N64Conf config) { 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()) + using (Process n64convert = new Process()) { mvvm.msg = "Injecting ROM..."; n64convert.StartInfo.UseShellExecute = false; @@ -2308,14 +2502,18 @@ namespace UWUVCI_AIO_WPF } mvvm.msg = "Copying INI..."; - if (config.INIBin == null) + 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 { @@ -2324,9 +2522,9 @@ namespace UWUVCI_AIO_WPF File.Move("custom.ini", mainIni); } mvvm.Progress = 80; + - - + } //Compressed or decompresses the RPX using wiiurpxtool @@ -2346,14 +2544,16 @@ 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) @@ -2366,6 +2566,8 @@ 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 @@ -2381,15 +2583,21 @@ namespace UWUVCI_AIO_WPF if (config.TGAIco.ImgPath != null) { Images.Add(true); - CopyAndConvertImage(config.TGAIco.ImgPath, Path.Combine(imgPath), false, 128, 128, 32, "iconTex.tga"); + CopyAndConvertImage(config.TGAIco.ImgPath, Path.Combine(imgPath), false, 128,128,32, "iconTex.tga"); } else { - var fileExists = File.Exists(Path.Combine(toolsPath, "iconTex.tga")); - if (fileExists) + if(File.Exists(Path.Combine(toolsPath, "iconTex.tga"))) + { CopyAndConvertImage(Path.Combine(toolsPath, "iconTex.tga"), Path.Combine(imgPath), false, 128, 128, 32, "iconTex.tga"); - - Images.Add(fileExists); + + Images.Add(true); + } + else + { + Images.Add(false); + } + } } else @@ -2409,13 +2617,17 @@ namespace UWUVCI_AIO_WPF } else { - var fileExists = File.Exists(Path.Combine(toolsPath, "bootTvTex.png")); - if (fileExists) + if (File.Exists(Path.Combine(toolsPath, "bootTvTex.png"))) { 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 @@ -2434,101 +2646,110 @@ namespace UWUVCI_AIO_WPF if (config.TGADrc.ImgPath != null) { Images.Add(true); - CopyAndConvertImage(config.TGADrc.ImgPath, Path.Combine(imgPath), false, 854, 480, 24, "bootDrcTex.tga"); + CopyAndConvertImage(config.TGADrc.ImgPath, Path.Combine(imgPath), false, 854,480,24, "bootDrcTex.tga"); } else { if (Images[1]) { - using Process conv = new Process(); - - if (!mvvm.debug) + using(Process conv = new Process()) { - conv.StartInfo.UseShellExecute = false; - conv.StartInfo.CreateNoWindow = true; - } - if (usetemp) - { - File.Copy(Path.Combine(toolsPath, "bootTvTex.png"), Path.Combine(tempPath, "bootDrcTex.png")); - } - else - { - - conv.StartInfo.FileName = Path.Combine(toolsPath, "tga2png.exe"); - if (!readbin) + + if (!mvvm.debug) { - conv.StartInfo.Arguments = $"-i \"{config.TGATv.ImgPath}\" -o \"{Path.Combine(tempPath)}\""; + conv.StartInfo.UseShellExecute = false; + conv.StartInfo.CreateNoWindow = true; + } + if (usetemp) + { + File.Copy(Path.Combine(toolsPath, "bootTvTex.png"), Path.Combine(tempPath, "bootDrcTex.png")); } else { - if (config.TGATv.extension.Contains("tga")) + + conv.StartInfo.FileName = Path.Combine(toolsPath, "tga2png.exe"); + if (!readbin) { - ReadFileFromBin(config.TGATv.ImgBin, $"bootTvTex.{config.TGATv.extension}"); - conv.StartInfo.Arguments = $"-i \"bootTvTex.{config.TGATv.extension}\" -o \"{Path.Combine(tempPath)}\""; + conv.StartInfo.Arguments = $"-i \"{config.TGATv.ImgPath}\" -o \"{Path.Combine(tempPath)}\""; } else { - ReadFileFromBin(config.TGATv.ImgBin, Path.Combine(tempPath, "bootTvTex.png")); + 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(); + } + + 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")); - - 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"); + Images.Add(true); } - CopyAndConvertImage(Path.Combine(tempPath, "bootDrcTex.png"), Path.Combine(imgPath), false, 854, 480, 24, "bootDrcTex.tga"); } - Images.Add(Images[1]); + else + { + Images.Add(false); + } + } } else { ReadFileFromBin(config.TGADrc.ImgBin, $"bootDrcTex.{config.TGADrc.extension}"); - CopyAndConvertImage($"bootDrcTex.{config.TGADrc.extension}", Path.Combine(imgPath), true, 854, 480, 24, "bootDrcTex.tga"); + CopyAndConvertImage($"bootDrcTex.{config.TGADrc.extension}", Path.Combine(imgPath), true,854,480,24, "bootDrcTex.tga"); Images.Add(true); } //tv - - + + //logo - var addBool = true; if (config.TGALog.ImgBin == null) { //use path if (config.TGALog.ImgPath != null) - CopyAndConvertImage(config.TGALog.ImgPath, Path.Combine(imgPath), false, 170, 42, 32, "bootLogoTex.tga"); + { + Images.Add(true); + CopyAndConvertImage(config.TGALog.ImgPath, Path.Combine(imgPath), false, 170,42,32, "bootLogoTex.tga"); + } else - addBool = false; + { + Images.Add(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()) + using (Process checkIfIssue = new Process()) { checkIfIssue.StartInfo.UseShellExecute = false; checkIfIssue.StartInfo.CreateNoWindow = false; checkIfIssue.StartInfo.RedirectStandardOutput = true; checkIfIssue.StartInfo.RedirectStandardError = true; - checkIfIssue.StartInfo.FileName = $"{Path.Combine(toolsPath, "tga_verify.exe")}"; + checkIfIssue.StartInfo.FileName = $"{Path.Combine(toolsPath,"tga_verify.exe")}"; Console.WriteLine(Directory.GetCurrentDirectory()); checkIfIssue.StartInfo.Arguments = $"\"{imgPath}\""; checkIfIssue.Start(); @@ -2555,7 +2776,7 @@ namespace UWUVCI_AIO_WPF checkIfIssue.Start(); checkIfIssue.WaitForExit(); } - // Console.ReadLine(); + // Console.ReadLine(); } if (Images[1]) @@ -2580,24 +2801,22 @@ namespace UWUVCI_AIO_WPF } } } - catch (Exception e) + catch(Exception e) { - if (!e.Message.Contains("Could not find")) + if (e.Message.Contains("Size")) { - if (e.Message.Contains("Size")) - { - throw e; - } - throw new Exception("Images"); + throw e; } + throw new Exception("Images"); } - } + } + private static void CopyAndConvertImage(string inputPath, string outputPath, bool delete, int widht, int height, int bit, string newname) { if (inputPath.EndsWith(".tga")) { - File.Copy(inputPath, Path.Combine(outputPath, newname)); + File.Copy(inputPath, Path.Combine(outputPath,newname)); } else { @@ -2606,21 +2825,24 @@ 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")) + }else if (extension.Contains("jpg") || extension.Contains("jpeg")) + { png2tga.StartInfo.FileName = Path.Combine(toolsPath, "jpg2tga.exe"); - else if (extension.Contains("bmp")) + }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"; png2tga.Start(); png2tga.WaitForExit(); } string name = Path.GetFileNameWithoutExtension(inputPath); - if (File.Exists(Path.Combine(outputPath, name + ".tga"))) + if(File.Exists(Path.Combine(outputPath , name + ".tga"))) { File.Move(Path.Combine(outputPath, name + ".tga"), Path.Combine(outputPath, newname)); } @@ -2645,8 +2867,10 @@ namespace UWUVCI_AIO_WPF return filePath; string newFilePath = Path.Combine(tempPath, Path.GetFileName(filePath)); - using (FileStream outStream = new(newFilePath, FileMode.OpenOrCreate)) + using (FileStream outStream = new FileStream(newFilePath, FileMode.OpenOrCreate)) + { inStream.CopyTo(outStream); + } return newFilePath; } @@ -2679,10 +2903,10 @@ namespace UWUVCI_AIO_WPF { foreach (DirectoryInfo subdir in dir.EnumerateDirectories()) { - DirectoryCopy(subdir.FullName, Path.Combine(destDirName, subdir.Name), copySubDirs); + DirectoryCopy(subdir.FullName, Path.Combine(destDirName, subdir.Name), copySubDirs); } } } - + } } diff --git a/UWUVCI AIO WPF/Classes/KeyFile.cs b/UWUVCI AIO WPF/Classes/KeyFile.cs index f0b456e..e3177aa 100644 --- a/UWUVCI AIO WPF/Classes/KeyFile.cs +++ b/UWUVCI AIO WPF/Classes/KeyFile.cs @@ -33,7 +33,7 @@ namespace UWUVCI_AIO_WPF.Classes public static void ExportFile(List precomp, GameConsoles console) { CheckAndFixFolder("bin\\keys"); - Stream createConfigStream = new FileStream(Path.Combine(Directory.GetCurrentDirectory(), $@"bin\keys\{console.ToString().ToLower()}.vck"), FileMode.Create, FileAccess.Write); + Stream createConfigStream = new FileStream($@"bin\keys\{console.ToString().ToLower()}.vck", FileMode.Create, FileAccess.Write); GZipStream compressedStream = new GZipStream(createConfigStream, CompressionMode.Compress); IFormatter formatter = new BinaryFormatter(); formatter.Serialize(compressedStream, precomp); diff --git a/UWUVCI AIO WPF/Classes/ToolCheck.cs b/UWUVCI AIO WPF/Classes/ToolCheck.cs index 75b620d..83e3029 100644 --- a/UWUVCI AIO WPF/Classes/ToolCheck.cs +++ b/UWUVCI AIO WPF/Classes/ToolCheck.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.IO.Compression; using System.Net; @@ -10,15 +11,18 @@ 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/" : ""); + static string FolderName = "bin\\Tools"; + public static string backupulr = @"https://github.com/Hotbrawl20/UWUVCI-Tools/raw/master/"; public static string[] ToolNames = { + "CDecrypt.exe", + "CNUSPACKER.exe", "N64Converter.exe", "png2tga.exe", "psb.exe", "RetroInject.exe", "tga_verify.exe", + "WiiUDownloader.exe", "wiiurpxtool.exe", "INICreator.exe", "blank.ini", @@ -26,6 +30,7 @@ namespace UWUVCI_AIO_WPF.Classes "BuildPcePkg.exe", "BuildTurboCdPcePkg.exe", "goomba.gba", + "nfs2iso2nfs.exe", "nintendont.dol", "nintendont_force.dol", "GetExtTypePatcher.exe", @@ -59,45 +64,48 @@ namespace UWUVCI_AIO_WPF.Classes public static bool DoesToolsFolderExist() { - return Directory.Exists(FolderName); + if (Directory.Exists(FolderName)) + { + return true; + } + return false; } - public static bool IsToolRightAsync(string name) + public static bool IsToolRight(string name) { - var result = false; - string md5Name = name + ".md5"; - string md5Path = FolderName + "\\" + md5Name; - string filePath = FolderName + "\\" + name; - - if (!File.Exists(filePath)) - return result; - - using (var webClient = new WebClient()) - webClient.DownloadFile(backupulr + md5Name, md5Path); - + bool ret = false; var md5 = ""; - using (var sr = new StreamReader(md5Path)) - md5 = sr.ReadLine(); + using (WebClient client = new WebClient()) + { + client.DownloadFile(backupulr + name + ".md5", name + ".md5"); + using (StreamReader sr = new StreamReader(name + ".md5")) + md5 = sr.ReadLine(); + } - result = CalculateMD5(filePath) == md5.ToLower(); + if(CalculateMD5(name) == md5) + { + ret = true; + } - File.Delete(md5Path); - - return result; + File.Delete(name + ".md5"); + return ret; } static string CalculateMD5(string filename) { - var ret = ""; - using var md5 = MD5.Create(); - using (var stream = File.OpenRead(filename)) - ret = BitConverter.ToString(md5.ComputeHash(stream)).Replace("-", "").ToLower(); - - return ret; + using (var md5 = MD5.Create()) + { + using (var stream = File.OpenRead(filename)) + { + string ret = BitConverter.ToString(md5.ComputeHash(stream)).Replace("-", "").ToLower(); + stream.Close(); + return ret; + } + } } public static List CheckForMissingTools() { List ret = new List(); - foreach (string s in ToolNames) + foreach(string s in ToolNames) { string path = $@"{FolderName}\{s}"; if (!DoesToolExist(path)) diff --git a/UWUVCI AIO WPF/FodyWeavers.xsd b/UWUVCI AIO WPF/FodyWeavers.xsd index 05e92c1..44a5374 100644 --- a/UWUVCI AIO WPF/FodyWeavers.xsd +++ b/UWUVCI AIO WPF/FodyWeavers.xsd @@ -17,16 +17,6 @@ A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. - - - A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks - - - - - A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. - - A list of unmanaged 32 bit assembly names to include, delimited with line breaks. @@ -53,16 +43,6 @@ Controls if .pdbs for reference assemblies are also embedded. - - - Controls if runtime assemblies are also embedded. - - - - - Controls whether the runtime assemblies are embedded with their full path or only with their assembly name. - - Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option. @@ -93,16 +73,6 @@ A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |. - - - A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with | - - - - - A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with |. - - A list of unmanaged 32 bit assembly names to include, delimited with |. diff --git a/UWUVCI AIO WPF/Models/MainViewModel.cs b/UWUVCI AIO WPF/Models/MainViewModel.cs index d9338f0..645ba81 100644 --- a/UWUVCI AIO WPF/Models/MainViewModel.cs +++ b/UWUVCI AIO WPF/Models/MainViewModel.cs @@ -1,6 +1,7 @@ using GameBaseClassLibrary; using System; using System.Collections.Generic; +using System.Configuration; using System.IO; using System.IO.Compression; using System.Linq; @@ -13,19 +14,24 @@ 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; +using AutoUpdaterDotNET; using System.Threading; 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.Runtime.InteropServices.WindowsRuntime; using System.Security.Cryptography; -using System.Net.Http; +using System.Drawing; +using System.Windows.Media.Animation; namespace UWUVCI_AIO_WPF { @@ -36,12 +42,14 @@ namespace UWUVCI_AIO_WPF private bool Injected2 = false; public bool injected2 { + get { return Injected2; } set { Injected2 = value; OnPropertyChanged(); } + } public string prodcode = ""; //public GameConfig GameConfiguration { get; set; } @@ -90,6 +98,7 @@ namespace UWUVCI_AIO_WPF set { selectedBaseAsString = value; } } + private List lGameBasesString = new List(); public List LGameBasesString @@ -156,6 +165,7 @@ namespace UWUVCI_AIO_WPF get { return thing; } set { thing = value; } } + public int OldIndex { get; set; } public bool RomSet { get; set; } @@ -217,6 +227,8 @@ namespace UWUVCI_AIO_WPF private List lSNES = new List(); + + public List LSNES { get { return lSNES; } @@ -228,7 +240,7 @@ namespace UWUVCI_AIO_WPF public string ReadCkeyFromOtp() { string ret = ""; - using (var dialog = new OpenFileDialog()) + using (var dialog = new System.Windows.Forms.OpenFileDialog()) { dialog.Filter = "OTP.bin | otp.bin"; DialogResult res = dialog.ShowDialog(); @@ -271,7 +283,9 @@ namespace UWUVCI_AIO_WPF public void RemoveCreatedIMG() { if (Directory.Exists(@"bin\createdIMG")) + { Directory.Delete(@"bin\createdIMG", true); + } } private List lWii = new List(); @@ -288,17 +302,36 @@ namespace UWUVCI_AIO_WPF var s = ByteArrayToString(procode); fs.Close(); + if (s.ToLower().Contains("nkit")) + { + NKITFLAG = true; - NKITFLAG = s.ToLower().Contains("nkit"); + } + else + { + NKITFLAG = false; + } } } + public bool CheckTime(DateTime creationTime) { DateTime curr = DateTime.Now; if (creationTime.Hour == curr.Hour || creationTime.Hour == curr.Hour - 1) - return creationTime.Minute == curr.Minute || creationTime.Minute == curr.Minute - 2; - - return false; + { + if (creationTime.Minute == curr.Minute || creationTime.Minute == curr.Minute - 2) + { + return true; + } + else + { + return false; + } + } + else + { + return false; + } } public List LWII @@ -318,6 +351,7 @@ namespace UWUVCI_AIO_WPF public bool BaseDownloaded { get; set; } = false; + private bool canInject = false; public bool CanInject @@ -329,6 +363,7 @@ namespace UWUVCI_AIO_WPF OnPropertyChanged(); } } + private string cBasePath; public string CBasePath @@ -341,6 +376,7 @@ namespace UWUVCI_AIO_WPF } } + public int Index = -1; public bool LR = false; public bool GC = false; @@ -384,6 +420,7 @@ namespace UWUVCI_AIO_WPF OnPropertyChanged(); } } + public System.Windows.Controls.ListViewItem curr = null; private bool ckeys; @@ -397,21 +434,40 @@ namespace UWUVCI_AIO_WPF OnPropertyChanged(); } } + public bool NKITFLAG { get; set; } = false; public MainWindow mw; private CustomBaseFrame cb = null; DispatcherTimer timer = new DispatcherTimer(); public bool PokePatch = false; - public void UpdateAsync(bool button) + public void Update(bool button) { - if (Task.Run(() => CheckForInternetConnectionAsync()).GetAwaiter().GetResult()) + if (CheckForInternetConnection()) { System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location); string version = fvi.FileVersion; - if (button) + 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]) >= GetNewVersion()) + { + 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) { 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(); @@ -434,24 +490,15 @@ namespace UWUVCI_AIO_WPF //Someone messed up versioning, so eff it just don't even bother then return; } + //You idiot, when tf did you flip this back? if (comparison < 0) { using (var webClient = new WebClient()) { webClient.Headers.Add(HttpRequestHeader.UserAgent, "MyUserAgent"); - Task.Run(() => webClient.DownloadFileTaskAsync(releases[0].ZipballUrl, "UWUVCI_INSTALLER.exe")).GetAwaiter(); + webClient.DownloadFile(releases[0].ZipballUrl, "UWUVCI_INSTALLER.exe"); } - var cm = new Custom_Message("Update Available!", "Latest version is currently being downloaded!\nPlease look for the file \"UWUVCI" + "_" + "INSTALLER.exe\" in\n" + Directory.GetCurrentDirectory()); - try - { - cm.Owner = mw; - } - catch (Exception) { } - cm.ShowDialog(); - } - else if (comparison > 0) - { - var cm = new Custom_Message("Possible Update Available", "It somehow looks like your version is newer than the public release version:\nhttps://github.com/stuff-by-3-random-dudes/UWUVCI-AIO-WPF/releases/latest\n\nNo update attempt will be made."); + var cm = new Custom_Message("Update Available!", "Latest version is currently being downloaded!\nPlease look for the file \"UWUVCI_INSTALLER.exe\" in\n" + Directory.GetCurrentDirectory()); try { cm.Owner = mw; @@ -461,7 +508,6 @@ namespace UWUVCI_AIO_WPF } else { - var cm = new Custom_Message("No Update Available", "This is currently the latest version."); try { @@ -472,7 +518,38 @@ namespace UWUVCI_AIO_WPF } } } + } + + private int GetNewVersion() + { + + try + { + WebRequest request; + //get download link from uwuvciapi + + request = WebRequest.Create("https://uwuvciapi.azurewebsites.net/GetVersionNum"); + + + var response = request.GetResponse(); + 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))) @@ -481,12 +558,20 @@ namespace UWUVCI_AIO_WPF long WAVHeader1 = reader.ReadInt32(); reader.BaseStream.Position = 0x08; long WAVHeader2 = reader.ReadInt32(); - - return WAVHeader1 == 1179011410 & WAVHeader2 == 1163280727; + if (WAVHeader1 == 1179011410 & WAVHeader2 == 1163280727) + { + return true; + } + else + { + return false; + } } } + public void OpenDialog(string title, string msg) { + Custom_Message cm = new Custom_Message(title, msg); try { @@ -497,48 +582,42 @@ namespace UWUVCI_AIO_WPF } public MainViewModel() { - if (true) + if (!Environment.Is64BitOperatingSystem) { List Tools = ToolCheck.ToolNames.ToList(); + Tools.Remove("CNUSPACKER.exe"); Tools.Add("NUSPacker.jar"); ToolCheck.ToolNames = Tools.ToArray(); } - if (Directory.Exists(@"bases")) - Directory.Delete(@"bases", true); - if (Directory.Exists(@"temp")) - Directory.Delete(@"temp", true); + //if (Directory.Exists(@"Tools")) Directory.Delete(@"Tools", true); + if (Directory.Exists(@"bases")) Directory.Delete(@"bases", true); + if (Directory.Exists(@"temp")) Directory.Delete(@"temp", true); if (Directory.Exists(@"keys")) { - if (Directory.Exists(@"bin\keys")) - Directory.Delete(@"bin\keys", true); - + if (Directory.Exists(@"bin\keys")) Directory.Delete(@"bin\keys", true); Injection.DirectoryCopy("keys", "bin/keys", true); Directory.Delete("keys", true); } - if (!Directory.Exists("InjectedGames")) - Directory.CreateDirectory("InjectedGames"); - - if (!Directory.Exists("SourceFiles")) - Directory.CreateDirectory("SourceFiles"); - - if (!Directory.Exists("bin\\BaseGames")) - Directory.CreateDirectory("bin\\BaseGames"); - - if (Settings.Default.OutPath == "" || Settings.Default.OutPath == null) + if (!Directory.Exists("InjectedGames")) Directory.CreateDirectory("InjectedGames"); + if (!Directory.Exists("SourceFiles")) Directory.CreateDirectory("SourceFiles"); + if (!Directory.Exists("bin\\BaseGames")) Directory.CreateDirectory("bin\\BaseGames"); + if (Properties.Settings.Default.OutPath == "" || Properties.Settings.Default.OutPath == null) + { Settings.Default.OutPath = Path.Combine(Directory.GetCurrentDirectory(), "InjectedGames"); - - if (Settings.Default.BasePath == "" || Settings.Default.BasePath == null) + } + if (Settings.Default.BasePath == "" || Properties.Settings.Default.BasePath == null) + { Settings.Default.BasePath = Path.Combine(Directory.GetCurrentDirectory(), "bin", "BaseGames"); - + } Settings.Default.Save(); ArePathsSet(); - UpdateAsync(false); + Update(false); - toolCheckAsync(); + toolCheck(); BaseCheck(); GameConfiguration = new GameConfig(); @@ -556,10 +635,13 @@ namespace UWUVCI_AIO_WPF cm.ShowDialog(); } UpdatePathSet(); + GetAllBases(); } public string turbocd() { + + string ret = string.Empty; Custom_Message cm = new Custom_Message("Information", " Please put a TurboGrafX CD ROM into a folder and select said folder. \n\n The Folder should at least contain: \n EXACTLY ONE *.hcd file \n One or more *.ogg files \n One or More *.bin files \n\n Not doing so will result in a faulty Inject. You have been warned! "); try @@ -598,6 +680,7 @@ namespace UWUVCI_AIO_WPF } catch (Exception) { } cm.ShowDialog(); + } else { @@ -615,7 +698,9 @@ namespace UWUVCI_AIO_WPF } catch (Exception) { } cm.ShowDialog(); + } + } } } @@ -624,14 +709,19 @@ namespace UWUVCI_AIO_WPF } } + } + + + + + return ret; } public GameConfig saveconf = null; public void resetCBASE() { - if (cb != null) - cb.Reset(); + if (cb != null) cb.Reset(); } public void removeCBASE() { @@ -673,7 +763,14 @@ namespace UWUVCI_AIO_WPF GameConfiguration.rf = regionfrii; GameConfiguration.rfjp = regionfriijp; GameConfiguration.rfus = regionfriius; - GameConfiguration.disgamepad = Index != -1; + if (Index != -1) + { + GameConfiguration.disgamepad = false; + } + else + { + GameConfiguration.disgamepad = true; + } GameConfiguration.fourbythree = cd; if (GameConfiguration.N64Stuff.INIPath != null || GameConfiguration.N64Stuff.INIPath == "") incp = String.Copy(GameConfiguration.N64Stuff.INIPath); ReadBootSoundIntoConfig(); @@ -730,6 +827,33 @@ namespace UWUVCI_AIO_WPF GameConfiguration.N64Stuff.INIBin = null; GameConfiguration.N64Stuff.INIPath = incp; } + /*if (GameConfiguration.Console == GameConsoles.N64) + { + (thing as N64Config).reset(); + } + else if (gameConfiguration.Console == GameConsoles.TG16) + { + (thing as TurboGrafX).reset(); + } + else if (gameConfiguration.Console == GameConsoles.WII && test != GameConsoles.GCN) + { + (thing as WiiConfig).reset(); + } + else if (test == GameConsoles.GCN) + { + (thing as GCConfig).reset(); + } + else + { + try + { + (thing as OtherConfigs).reset(); + } + catch (Exception e) + { + (thing as GCConfig).reset(); + } + }*/ } public void ImportConfig(string configPath) { @@ -792,6 +916,7 @@ namespace UWUVCI_AIO_WPF { ReadFileAsBin(GameConfiguration, bootsound, 6); } + public void ReadImagesIntoConfig() { ReadFileAsBin(GameConfiguration, GameConfiguration.TGAIco.ImgPath, 1); @@ -803,6 +928,7 @@ namespace UWUVCI_AIO_WPF { ReadFileAsBin(GameConfiguration, GameConfiguration.N64Stuff.INIPath, 5); } + private void ReadFileAsBin(GameConfig file, string FilePath, int scase) { if (FilePath != null) @@ -867,18 +993,25 @@ namespace UWUVCI_AIO_WPF } } } + + } public bool donttrim = false; private static void CheckAndFixConfigFolder() { - Directory.CreateDirectory(@"configs"); + if (!Directory.Exists(@"configs")) + { + Directory.CreateDirectory(@"configs"); + } } public void Pack(bool loadiine) { ValidatePathsStillExist(); if (loadiine) + { Injection.Loadiine(GameConfiguration.GameName); - + // + } else { if (gameConfiguration.GameName != null) @@ -932,6 +1065,7 @@ namespace UWUVCI_AIO_WPF foldername = ""; mw.ListView_Click(mw.listCONS, null); } + private void ClearImage() { switch (GameConfiguration.Console) @@ -1029,26 +1163,30 @@ namespace UWUVCI_AIO_WPF }); thread.SetApartmentState(ApartmentState.STA); thread.Start(); + + } public bool failed = false; 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; injected2 = true; - 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 @@ -1081,6 +1219,8 @@ namespace UWUVCI_AIO_WPF Inject(force); } } + + } private void BaseCheck() { @@ -1089,7 +1229,7 @@ namespace UWUVCI_AIO_WPF var test = GetMissingVCBs(); if (test.Count > 0) { - if (Task.Run(() => CheckForInternetConnectionAsync()).GetAwaiter().GetResult()) + if (CheckForInternetConnection()) { Progress = 0; Task.Run(() => @@ -1097,11 +1237,11 @@ namespace UWUVCI_AIO_WPF double stuff = 100 / test.Count; foreach (string s in test) { - Task.Run(() => DownloadBaseAsync(s, this)).GetAwaiter(); + DownloadBase(s, this); Progress += Convert.ToInt32(stuff); } + Progress = 100; }); - DownloadWait dw = new DownloadWait("Downloading needed Data - Please Wait", "", this); try { @@ -1123,26 +1263,28 @@ namespace UWUVCI_AIO_WPF dw.ShowDialog(); Environment.Exit(1); } + + + } } else { - if (Task.Run(() => CheckForInternetConnectionAsync()).GetAwaiter().GetResult()) + if (CheckForInternetConnection()) { Directory.CreateDirectory(@"bin\bases"); var test = GetMissingVCBs(); Progress = 0; - Task.Run(() => { double stuff = 100 / test.Count; foreach (string s in test) { - Task.Run(() => DownloadBaseAsync(s, this)).GetAwaiter(); + DownloadBase(s, this); Progress += Convert.ToInt32(stuff); } + Progress = 100; }); - DownloadWait dw = new DownloadWait("Downloading needed Data - Please Wait", "", this); try { @@ -1164,14 +1306,16 @@ namespace UWUVCI_AIO_WPF dw.ShowDialog(); Environment.Exit(1); } + + } + } - public void UpdateToolsAsync() + public void UpdateTools() { - if (Task.Run(() => CheckForInternetConnectionAsync()).GetAwaiter().GetResult()) + if (CheckForInternetConnection()) { string[] bases = ToolCheck.ToolNames; - Progress = 0; Task.Run(() => { Progress = 0; @@ -1179,10 +1323,9 @@ namespace UWUVCI_AIO_WPF foreach (string s in bases) { DeleteTool(s); - DownloadToolAsync(s, this); + DownloadTool(s, this); Progress += Convert.ToInt32(l); } - Progress = 100; }); @@ -1196,7 +1339,7 @@ namespace UWUVCI_AIO_WPF } dw.ShowDialog(); - toolCheckAsync(); + toolCheck(); Custom_Message cm = new Custom_Message("Finished Update", " Finished Updating Tools! Restarting UWUVCI AIO "); try { @@ -1204,21 +1347,32 @@ namespace UWUVCI_AIO_WPF } catch (Exception) { } cm.ShowDialog(); - 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))) + p.StartInfo.FileName = System.Windows.Application.ResourceAssembly.Location; + if (debug) + { + if (saveworkaround) { - fileName = file; - break; + p.StartInfo.Arguments = "--debug --skip --spacebypass"; + } + else + { + p.StartInfo.Arguments = "--debug --skip"; } - p.StartInfo.FileName = fileName; - p.StartInfo.Arguments = (debug ? "--debug " : "") + "--skip" + (saveworkaround ? " --spacebypass" : ""); + } + else + { + if (saveworkaround) + { + p.StartInfo.Arguments = "--skip --spacebypass"; + } + else + { + p.StartInfo.Arguments = "--skip"; + } + } p.Start(); - Environment.Exit(0); } @@ -1233,6 +1387,7 @@ namespace UWUVCI_AIO_WPF catch (Exception) { } cm.ShowDialog(); cm.Close(); + } public void ResetTitleKeys() { @@ -1252,38 +1407,33 @@ namespace UWUVCI_AIO_WPF catch (Exception) { } cm.ShowDialog(); mw.Close(); - 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.Arguments = (debug ? "--debug " : "") + "--skip"; + p.StartInfo.FileName = System.Windows.Application.ResourceAssembly.Location; + if (debug) + { + p.StartInfo.Arguments = "--debug --skip"; + } + else + { + p.StartInfo.Arguments = "--skip"; + } p.Start(); - Environment.Exit(0); + + } - public void UpdateBaseAsync() + public void UpdateBases() { - if (Task.Run(() => CheckForInternetConnectionAsync()).GetAwaiter().GetResult()) + if (CheckForInternetConnection()) { string[] bases = { "bases.vcbnds", "bases.vcbn64", "bases.vcbgba", "bases.vcbsnes", "bases.vcbnes", "bases.vcbtg16", "bases.vcbmsx", "bases.vcbwii" }; - - Task.Run(() => - { + Task.Run(() => { Progress = 0; double l = 100 / bases.Length; foreach (string s in bases) { DeleteBase(s); - Task.Run(() => DownloadBaseAsync(s, this)).GetAwaiter().GetResult(); + DownloadBase(s, this); GameConsoles g = new GameConsoles(); if (s.Contains("nds")) g = GameConsoles.NDS; @@ -1317,24 +1467,21 @@ namespace UWUVCI_AIO_WPF } catch (Exception) { } cm.ShowDialog(); - 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.Arguments = (debug ? "--debug " : "") + "--skip"; + p.StartInfo.FileName = System.Windows.Application.ResourceAssembly.Location; + if (debug) + { + p.StartInfo.Arguments = "--debug --skip"; + } + else + { + p.StartInfo.Arguments = "--skip"; + } p.Start(); - Environment.Exit(0); } + + } public static int GetDeterministicHashCode(string str) { @@ -1350,93 +1497,97 @@ 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) - return false; - - Settings.Default.SysKey = key; - Settings.Default.Save(); - return true; + if (key.GetHashCode() == -589797700) + { + Properties.Settings.Default.SysKey = key; + Properties.Settings.Default.Save(); + return true; + } + return false; } public bool SysKey1set() { - return checkSysKey1(Settings.Default.SysKey1); + return checkSysKey1(Properties.Settings.Default.SysKey1); } public bool checkSysKey1(string key) { - if (GetDeterministicHashCode(key) != -1230232583) - return false; - - Settings.Default.SysKey1 = key; - Settings.Default.Save(); - return true; + if (key.GetHashCode() == -1230232583) + { + Properties.Settings.Default.SysKey1 = key; + Properties.Settings.Default.Save(); + return true; + } + return false; } public bool SysKeyset() { - return checkSysKey(Settings.Default.SysKey); + return checkSysKey(Properties.Settings.Default.SysKey); } public bool GetConsoleOfConfig(string configPath, GameConsoles console) { FileInfo fn = new FileInfo(configPath); if (fn.Extension.Contains("uwuvci")) { - 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); - } + 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); + if (check.Console == console) return true; - return check.Console == console; } return false; } public void selectConfig(GameConsoles console) { - 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) + string ret = string.Empty; + using (var dialog = new System.Windows.Forms.OpenFileDialog()) { - string ret = dialog.FileName; - if (GetConsoleOfConfig(ret, console)) + dialog.InitialDirectory = Path.Combine(Directory.GetCurrentDirectory(), "configs"); + dialog.Filter = "UWUVCI Config (*.uwuvci) | *.uwuvci"; + DialogResult res = dialog.ShowDialog(); + if (res == DialogResult.OK) { - ImportConfig(ret); - Custom_Message cm = new Custom_Message("Import Complete", " Importing of Config completed. \n Please reselect a Base!"); - try + ret = dialog.FileName; + if (GetConsoleOfConfig(ret, console)) { - cm.Owner = mw; + 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(); } - 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 + else { - cm.Owner = mw; + 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(); } - catch (Exception) { } - cm.ShowDialog(); } } + } - //I hate everything about this function private bool RemoteFileExists(string url) { try { HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest; request.Method = "HEAD"; - using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) - return (response.StatusCode == HttpStatusCode.OK); + HttpWebResponse response = request.GetResponse() as HttpWebResponse; + response.Close(); + return (response.StatusCode == HttpStatusCode.OK); } catch { @@ -1459,10 +1610,12 @@ namespace UWUVCI_AIO_WPF cm.Owner = mw; } catch (Exception) { } - if (!Settings.Default.ndsw) + if (!Properties.Settings.Default.ndsw) { cm.ShowDialog(); } + + break; case GameConsoles.SNES: cm = new Custom_Message("Information", " You can only inject SNES ROMs that are not using any Co-Processors (example for not working: Star Fox) \n\n If attempting to inject a ROM in need of a Co-Processor, we will not give you any support with fixing said injection. "); @@ -1471,10 +1624,11 @@ namespace UWUVCI_AIO_WPF cm.Owner = mw; } catch (Exception) { } - if (!Settings.Default.snesw) + if (!Properties.Settings.Default.snesw) { cm.ShowDialog(); } + break; } } @@ -1484,9 +1638,13 @@ namespace UWUVCI_AIO_WPF if (ROM) { if (INI) + { dialog.Filter = "BootSound Files (*.mp3; *.wav; *.btsnd) | *.mp3;*.wav;*.btsnd"; + } else if (GC) + { dialog.Filter = "GCN ROM (*.iso; *.gcm) | *.iso; *.gcm"; + } else { switch (GameConfiguration.Console) @@ -1529,14 +1687,22 @@ namespace UWUVCI_AIO_WPF break; } } + + } else if (!INI) - dialog.Filter = "Images (*.png; *.jpg; *.bmp; *.tga; *jpeg) | *.png;*.jpg;*.bmp;*.tga;*jpeg"; - else if (INI) - dialog.Filter = "N64 VC Configuration (*.ini) | *.ini"; + { + dialog.Filter = "Images (*.png; *.jpg; *.bmp; *.tga; *jpeg) | *.png;*.jpg;*.bmp;*.tga;*jpeg"; + } + else if (INI) + { + dialog.Filter = "N64 VC Configuration (*.ini) | *.ini"; + } if (Directory.Exists("SourceFiles")) + { dialog.InitialDirectory = "SourceFiles"; + } DialogResult res = dialog.ShowDialog(); if (res == DialogResult.OK) @@ -1552,7 +1718,7 @@ namespace UWUVCI_AIO_WPF { } - if (!Settings.Default.gczw) + if (!Properties.Settings.Default.gczw) { cm1.ShowDialog(); } @@ -1562,60 +1728,79 @@ namespace UWUVCI_AIO_WPF else { if (dialog.Filter.Contains("BootImages") || dialog.Filter.Contains("BootSound")) + { ret = ""; + } } } 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}"); } private static void DeleteBase(string console) { - File.Delete(Path.Combine(Directory.GetCurrentDirectory(), "bin", "bases", console)); + File.Delete($@"bin\bases\{console}"); } public static List GetMissingVCBs() { 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"); - + string path = @"bin\bases\bases.vcb"; + if (!File.Exists(path + "nds")) + { + ret.Add(path + "nds"); + } + if (!File.Exists(path + "nes")) + { + ret.Add(path + "nes"); + } + if (!File.Exists(path + "n64")) + { + ret.Add(path + "n64"); + } + if (!File.Exists(path + "snes")) + { + ret.Add(path + "snes"); + } + if (!File.Exists(path + "gba")) + { + ret.Add(path + "gba"); + } + if (!File.Exists(path + "tg16")) + { + ret.Add(path + "tg16"); + } + if (!File.Exists(path + "msx")) + { + ret.Add(path + "msx"); + } + if (!File.Exists(path + "wii")) + { + ret.Add(path + "wii"); + } return ret; } - public static async Task DownloadBaseAsync(string name, MainViewModel mvm) + public static void DownloadBase(string name, MainViewModel mvm) { - var filePath = Path.Combine(Directory.GetCurrentDirectory(), "bin", "bases", name); + string olddir = Directory.GetCurrentDirectory(); try { - using var httpClient = new HttpClient(); - using var response = await httpClient.GetStreamAsync(getDownloadLink(name, false)); - using var fs = new FileStream(filePath, FileMode.Create); - await response.CopyToAsync(fs); + string basePath = $@"bin\bases\"; + Directory.SetCurrentDirectory(basePath); + using (var client = new WebClient()) + + { + var fixname = name.Split('\\'); + client.DownloadFile(getDownloadLink(name, false), fixname[fixname.Length - 1]); + } } catch (Exception e) { @@ -1629,21 +1814,36 @@ namespace UWUVCI_AIO_WPF cm.ShowDialog(); Environment.Exit(1); } + Directory.SetCurrentDirectory(olddir); } - public static void DownloadToolAsync(string name, MainViewModel mvm) + public static void DownloadTool(string name, MainViewModel mvm) { - var filePath = Path.Combine(Directory.GetCurrentDirectory(), "bin", "Tools", name); + string olddir = Directory.GetCurrentDirectory(); try { - while (true) - { - var isToolRight = ToolCheck.IsToolRightAsync(name); - if (isToolRight) - break; - using (var webClient = new WebClient()) - webClient.DownloadFile(getDownloadLink(name, true), filePath); + if (Directory.GetCurrentDirectory().Contains("bin") && Directory.GetCurrentDirectory().Contains("Tools")) + { + olddir = Directory.GetCurrentDirectory().Replace("bin\\Tools", ""); } + else + { + string basePath = $@"bin\Tools\"; + Directory.SetCurrentDirectory(basePath); + } + do + { + if (File.Exists(name)) + { + File.Delete(name); + } + using (var client = new WebClient()) + { + client.DownloadFile(getDownloadLink(name, true), name); + } + } while (!ToolCheck.IsToolRight(name)); + + } catch (Exception e) { @@ -1658,53 +1858,127 @@ namespace UWUVCI_AIO_WPF Environment.Exit(1); } + Directory.SetCurrentDirectory(olddir); } private static string getDownloadLink(string toolname, bool tool) { try { - if (tool) - return $"{ToolCheck.backupulr}{toolname}"; + bool ok = false; + try + { + System.Net.WebClient client = new System.Net.WebClient(); + string result = client.DownloadString("https://uwuvciapi.azurewebsites.net/api/values"); + ok = true; + } + catch (System.Net.WebException) + { + + + } + if (ok) + { + WebRequest request; + //get download link from uwuvciapi + if (tool) + { + request = WebRequest.Create("https://uwuvciapi.azurewebsites.net/GetToolLink?tool=" + toolname); + } + else + { + request = WebRequest.Create("https://uwuvciapi.azurewebsites.net/GetVcbLink?vcb=" + toolname); + } + + var response = request.GetResponse(); + 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. + if (responseFromServer == "") + { + if (tool) + { + return $"{ToolCheck.backupulr}{toolname}"; + } + else + { + return $@"https://github.com/Hotbrawl20/UWUVCI-VCB/raw/master/" + toolname; + } + } + return responseFromServer; + } + } else - return $@"https://github.com/Hotbrawl20/UWUVCI-VCB/raw/master/Net6/" + toolname.Replace("bin\\bases\\", ""); + { + if (tool) + { + return $"{ToolCheck.backupulr}{toolname}"; + } + else + { + return $@"https://github.com/Hotbrawl20/UWUVCI-VCB/raw/master/" + toolname.Replace("bin\\bases\\", ""); + } + } + + } catch (Exception) { if (tool) + { return $"{ToolCheck.backupulr}{toolname}"; + } else { - var name = toolname.Replace("bin\\bases\\", ""); - return $@"https://github.com/Hotbrawl20/UWUVCI-VCB/raw/master/Net6/" + name; + return $@"https://github.com/Hotbrawl20/UWUVCI-VCB/raw/master/" + toolname.Replace("bin\\bases\\", ""); } + } } public void InjcttoolCheck() { if (ToolCheck.DoesToolsFolderExist()) { + List missingTools = new List(); missingTools = ToolCheck.CheckForMissingTools(); if (missingTools.Count > 0) { + + + foreach (MissingTool m in missingTools) - DownloadToolAsync(m.Name, this); + { + DownloadTool(m.Name, this); + + } + + InjcttoolCheck(); + } } else { + string path = $@"{Directory.GetCurrentDirectory()}bin\\Tools"; + Directory.CreateDirectory($@"{Directory.GetCurrentDirectory()}bin\\Tools"); InjcttoolCheck(); + } } private void ThreadDownload(List missingTools) { - var percentage = 100 / missingTools.Count; - Progress = 0; + var thread = new Thread(() => { + double l = 100 / missingTools.Count; + + foreach (MissingTool m in missingTools) { if (m.Name == "blank.ini") @@ -1713,24 +1987,33 @@ namespace UWUVCI_AIO_WPF sw.Close(); } else - DownloadToolAsync(m.Name, this); - Progress += percentage; + { + DownloadTool(m.Name, this); + } + + Progress += Convert.ToInt32(l); } Progress = 100; + }); thread.SetApartmentState(ApartmentState.STA); thread.Start(); + } private void timer_Tick2(object sender, EventArgs e) { - if (Progress >= 100) + + + if (Progress == 100) { Injectwait.Close(); + timer.Stop(); + Progress = 0; } } - private void toolCheckAsync() + private void toolCheck() { if (ToolCheck.DoesToolsFolderExist()) { @@ -1739,8 +2022,9 @@ namespace UWUVCI_AIO_WPF if (missingTools.Count > 0) { - if (Task.Run(() => CheckForInternetConnectionAsync()).GetAwaiter().GetResult()) + if (CheckForInternetConnection()) { + Task.Run(() => ThreadDownload(missingTools)); DownloadWait dw = new DownloadWait("Downloading Tools - Please Wait", "", this); try { @@ -1750,10 +2034,11 @@ namespace UWUVCI_AIO_WPF { } - ThreadDownload(missingTools); dw.ShowDialog(); + Thread.Sleep(200); + //Download Tools Progress = 0; - toolCheckAsync(); + toolCheck(); } else { @@ -1766,23 +2051,40 @@ namespace UWUVCI_AIO_WPF dw.ShowDialog(); Environment.Exit(1); } + + } } else { - Directory.CreateDirectory("bin/Tools"); - toolCheckAsync(); + if (Directory.GetCurrentDirectory().Contains("bin/tools")) + { + + } + else + { + Directory.CreateDirectory("bin/Tools"); + } + + toolCheck(); + + } } + 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() @@ -1792,10 +2094,12 @@ namespace UWUVCI_AIO_WPF try { if (Directory.Exists(Settings.Default.BasePath)) + { basep = true; + } else { - Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(), "bin", "BaseGames")); + if (!Directory.Exists(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(); @@ -1803,11 +2107,13 @@ namespace UWUVCI_AIO_WPF if (Directory.Exists(Settings.Default.OutPath)) { if (basep) + { ret = true; + } } else { - Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(), "InjectedGames")); + if (!Directory.Exists(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(); @@ -1830,16 +2136,23 @@ 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) @@ -1847,37 +2160,61 @@ 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; } @@ -1891,23 +2228,14 @@ namespace UWUVCI_AIO_WPF LTG16.Clear(); LMSX.Clear(); LWII.Clear(); - try - { - lNDS = VCBTool.ReadBasesFromVCB($@"bin/bases/bases.vcbnds"); - lNES = VCBTool.ReadBasesFromVCB($@"bin/bases/bases.vcbnes"); - lSNES = VCBTool.ReadBasesFromVCB($@"bin/bases/bases.vcbsnes"); - lN64 = VCBTool.ReadBasesFromVCB($@"bin/bases/bases.vcbn64"); - lGBA = VCBTool.ReadBasesFromVCB($@"bin/bases/bases.vcbgba"); - lTG16 = VCBTool.ReadBasesFromVCB($@"bin/bases/bases.vcbtg16"); - lMSX = VCBTool.ReadBasesFromVCB($@"bin/bases/bases.vcbmsx"); - lWii = VCBTool.ReadBasesFromVCB($@"bin/bases/bases.vcbwii"); - } - catch (Exception) - { - //Nico, look at what you made me do - Thread.Sleep(200); - GetAllBases(); - } + lNDS = VCBTool.ReadBasesFromVCB($@"bin/bases/bases.vcbnds"); + lNES = VCBTool.ReadBasesFromVCB($@"bin/bases/bases.vcbnes"); + lSNES = VCBTool.ReadBasesFromVCB($@"bin/bases/bases.vcbsnes"); + lN64 = VCBTool.ReadBasesFromVCB($@"bin/bases/bases.vcbn64"); + lGBA = VCBTool.ReadBasesFromVCB($@"bin/bases/bases.vcbgba"); + lTG16 = VCBTool.ReadBasesFromVCB($@"bin/bases/bases.vcbtg16"); + lMSX = VCBTool.ReadBasesFromVCB($@"bin/bases/bases.vcbmsx"); + lWii = VCBTool.ReadBasesFromVCB($@"bin/bases/bases.vcbwii"); CreateSettingIfNotExist(lNDS, GameConsoles.NDS); CreateSettingIfNotExist(lNES, GameConsoles.NES); CreateSettingIfNotExist(lSNES, GameConsoles.SNES); @@ -1919,7 +2247,7 @@ namespace UWUVCI_AIO_WPF } private void CreateSettingIfNotExist(List l, GameConsoles console) { - string file = Path.Combine(Directory.GetCurrentDirectory(), $@"bin\keys\{console.ToString().ToLower()}.vck"); + string file = $@"bin\keys\{console.ToString().ToLower()}.vck"; if (!File.Exists(file)) { List temp = new List(); @@ -1932,29 +2260,32 @@ namespace UWUVCI_AIO_WPF KeyFile.ExportFile(temp, console); } else + { FixupKeys(l, console); + } } private void FixupKeys(List l, GameConsoles console) { - string file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $@"bin\keys\{console.ToString().ToLower()}.vck"); + string file = $@"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; @@ -1967,10 +2298,10 @@ namespace UWUVCI_AIO_WPF } private void UpdateKeyFile(List l, GameConsoles console) { - string file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $@"bin\keys\{console.ToString().ToLower()}.vck"); + string file = $@"bin\keys\{console.ToString().ToLower()}.vck"; if (File.Exists(file)) { - List keys = KeyFile.ReadBasesFromKeyFile(file); + List keys = KeyFile.ReadBasesFromKeyFile($@"bin\keys\{console.ToString().ToLower()}.vck"); List newTK = new List(); foreach (GameBases gb in l) { @@ -1982,8 +2313,7 @@ namespace UWUVCI_AIO_WPF newTK.Add(tk); inOld = true; } - if (inOld) - break; + if (inOld) break; } if (!inOld) { @@ -2040,26 +2370,33 @@ namespace UWUVCI_AIO_WPF } public bool checkcKey(string key) { - if (-485504051 == GetDeterministicHashCode(key.ToLower())) + if (1274359530 == key.ToLower().GetHashCode()) { Settings.Default.Ckey = key.ToLower(); ckeys = true; Settings.Default.Save(); - } - else - ckeys = false; - return ckeys; + return true; + } + ckeys = false; + return false; } public bool isCkeySet() { - ckeys = GetDeterministicHashCode(Settings.Default.Ckey.ToLower()) == -485504051; - return ckeys; + if (Settings.Default.Ckey.ToLower().GetHashCode() == 1274359530) + { + ckeys = true; + return true; + } + else + { + ckeys = false; + return false; + } } public bool checkKey(string key) { - var hashCode = GetDeterministicHashCode(key.ToLower()); - if (GbTemp.KeyHash == hashCode) + if (GbTemp.KeyHash == key.ToLower().GetHashCode()) { UpdateKeyInFile(key, $@"bin\keys\{GetConsoleOfBase(gbTemp).ToString().ToLower()}.vck", GbTemp, GetConsoleOfBase(gbTemp)); return true; @@ -2072,22 +2409,29 @@ 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); } } public bool isKeySet(GameBases bases) { - string file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $@"bin\keys\{GetConsoleOfBase(bases).ToString().ToLower()}.vck"); - var temp = KeyFile.ReadBasesFromKeyFile(file); + var temp = KeyFile.ReadBasesFromKeyFile($@"bin\keys\{GetConsoleOfBase(bases).ToString().ToLower()}.vck"); foreach (TKeys t in temp) + { if (t.Base.Name == bases.Name && t.Base.Region == bases.Region) + { if (t.Tkey != null) + { return true; - + } + } + } return false; } @@ -2123,112 +2467,214 @@ namespace UWUVCI_AIO_WPF } public TKeys getTkey(GameBases bases) { - string file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $@"bin\keys\{GetConsoleOfBase(bases).ToString().ToLower()}.vck"); - var temp = KeyFile.ReadBasesFromKeyFile(file); - + var temp = KeyFile.ReadBasesFromKeyFile($@"bin\keys\{GetConsoleOfBase(bases).ToString().ToLower()}.vck"); foreach (TKeys t in temp) + { if (t.Base.Name == bases.Name && t.Base.Region == bases.Region) + { if (t.Tkey != null) + { return t; - + } + } + } return null; + } public void Download() { ValidatePathsStillExist(); - if (Task.Run(() => CheckForInternetConnectionAsync()).GetAwaiter().GetResult()) + if (CheckForInternetConnection()) { - DownloadWait dw = new DownloadWait("Downloading Base - Please Wait", "", this); + DownloadWait dw; + + if (GameConfiguration.Console == GameConsoles.WII || GameConfiguration.Console == GameConsoles.GCN) + { + double speed = TestDownloadSpeed(); // in MB/s + TimeSpan estimatedTime = CalculateEstimatedTime(speed); + + // Start the actual download + Task.Run(() => { Injection.Download(this); }); + + // Display the waiting dialog with the estimated time + dw = new DownloadWait("Downloading Base - Please Wait", estimatedTime, this); + } + else + { + Task.Run(() => { Injection.Download(this); }); + dw = new DownloadWait("Downloading Base - Please Wait", "", this); + } try { dw.changeOwner(mw); } catch (Exception) { } - Task.Run(() => Injection.Download(this)).GetAwaiter(); dw.ShowDialog(); Progress = 0; } } + + + private double TestDownloadSpeed() + { + WebClient webClient = new WebClient(); + Stopwatch sw = new Stopwatch(); + + //Using this file as a test file, it's about 16MB which should be small enough to not impact anything. + string url = "https://github.com/NicoAICP/UWUVCI-Tools/raw/master/gba2.zip"; + byte[] data; + + sw.Start(); + try + { + data = webClient.DownloadData(url); + } + catch + { + return 0; + } + sw.Stop(); + + double timeTaken = sw.Elapsed.TotalSeconds; // time in seconds + double sizeOfData = data.Length / 1024.0 / 1024.0; // size in MB + + return sizeOfData / timeTaken; // returns speed in MB/s + } + + private TimeSpan CalculateEstimatedTime(double speedInMbps) + { + const double fileSize = 8.5 * 1024; // file size in MB + + if (speedInMbps <= 0) + return TimeSpan.MaxValue; + + double estimatedTimeInSec = fileSize / speedInMbps; + return TimeSpan.FromSeconds(estimatedTimeInSec); + } + + public GameConsoles GetConsoleOfBase(GameBases gb) { 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) { - List info = new List() + List info = new List(); + if (Directory.Exists($@"{Settings.Default.BasePath}\{gb.Name.Replace(":", "")} [{gb.Region}]")) { - Directory.Exists($@"{Settings.Default.BasePath}\{gb.Name.Replace(":", "")} [{gb.Region}]"), - isKeySet(gb), - isCkeySet() - }; - + info.Add(true); + } + else + { + info.Add(false); + } + if (isKeySet(gb)) + { + info.Add(true); + } + else + { + info.Add(false); + } + if (isCkeySet()) + { + info.Add(true); + } + else + { + info.Add(false); + } return info; } + + public void SetInjectPath() { using (var dialog = new CommonOpenFileDialog()) @@ -2236,6 +2682,7 @@ namespace UWUVCI_AIO_WPF dialog.IsFolderPicker = true; CommonFileDialogResult result = dialog.ShowDialog(); if (result == CommonFileDialogResult.Ok) + { try { if (DirectoryIsEmpty(dialog.FileName)) @@ -2264,7 +2711,9 @@ namespace UWUVCI_AIO_WPF } else + { SetInjectPath(); + } } } catch (Exception e) @@ -2278,6 +2727,8 @@ namespace UWUVCI_AIO_WPF catch (Exception) { } cm.ShowDialog(); } + + } } ArePathsSet(); } @@ -2288,6 +2739,7 @@ namespace UWUVCI_AIO_WPF dialog.IsFolderPicker = true; CommonFileDialogResult result = dialog.ShowDialog(); if (result == CommonFileDialogResult.Ok) + { try { if (DirectoryIsEmpty(dialog.FileName)) @@ -2316,7 +2768,9 @@ namespace UWUVCI_AIO_WPF } else + { SetInjectPath(); + } } } catch (Exception e) @@ -2330,6 +2784,8 @@ namespace UWUVCI_AIO_WPF catch (Exception) { } cm.ShowDialog(); } + + } } ArePathsSet(); } @@ -2337,7 +2793,10 @@ namespace UWUVCI_AIO_WPF { if (ValidatePathsStillExist()) { + Settings.Default.PathsSet = true; + + Settings.Default.Save(); } UpdatePathSet(); @@ -2346,16 +2805,22 @@ namespace UWUVCI_AIO_WPF { int fileCount = Directory.GetFiles(path).Length; if (fileCount > 0) + { return false; + } string[] dirs = Directory.GetDirectories(path); foreach (string dir in dirs) + { if (!DirectoryIsEmpty(dir)) + { return false; + } + } return true; } - public async Task getBootIMGGBA(string rom) + public void getBootIMGGBA(string rom) { string repoid = ""; string SystemType = "gba/"; @@ -2376,7 +2841,7 @@ namespace UWUVCI_AIO_WPF Console.WriteLine("prodcode after scramble: " + repoid); } List repoids = new List(); - if (await CheckForInternetConnectionWOWarningAsync()) + if (CheckForInternetConnectionWOWarning()) { repoids.Add(SystemType + repoid); repoids.Add(SystemType + repoid.Substring(0, 3) + "E"); @@ -2384,11 +2849,11 @@ namespace UWUVCI_AIO_WPF repoids.Add(SystemType + repoid.Substring(0, 3) + "J"); GetRepoImages(SystemType, repoid); - await checkForAdditionalFiles(GameConsoles.GBA, repoids); + checkForAdditionalFiles(GameConsoles.GBA, repoids); } } - public async Task getBootIMGSNES(string rom) + public void getBootIMGSNES(string rom) { string SystemType = "snes/"; var repoid = GetFakeSNESProdcode(rom); @@ -2397,13 +2862,15 @@ namespace UWUVCI_AIO_WPF SystemType + repoid }; - if (await CheckForInternetConnectionWOWarningAsync()) + if (CheckForInternetConnectionWOWarning()) { GetRepoImages(SystemType, repoid); - await checkForAdditionalFiles(GameConsoles.SNES, repoids); + checkForAdditionalFiles(GameConsoles.SNES, repoids); + } + } - public async Task getBootIMGMSX(string rom) + public void getBootIMGMSX(string rom) { string SystemType = "msx/"; var repoid = GetFakeMSXTGProdcode(rom, true); @@ -2412,13 +2879,14 @@ namespace UWUVCI_AIO_WPF SystemType + repoid }; - if (await CheckForInternetConnectionWOWarningAsync()) + if (CheckForInternetConnectionWOWarning()) { GetRepoImages(SystemType, repoid); - await checkForAdditionalFiles(GameConsoles.MSX, repoids); + checkForAdditionalFiles(GameConsoles.MSX, repoids); } + } - public async Task getBootIMGTG(string rom) + public void getBootIMGTG(string rom) { string SystemType = "tg16/"; var repoid = GetFakeMSXTGProdcode(rom, false); @@ -2426,47 +2894,55 @@ namespace UWUVCI_AIO_WPF { SystemType + repoid }; - if (await CheckForInternetConnectionWOWarningAsync()) + if (CheckForInternetConnectionWOWarning()) { GetRepoImages(SystemType, repoid); - await checkForAdditionalFiles(GameConsoles.TG16, repoids); + 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); - hash = GetMd5Hash(md5, procode); + 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; } - //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) { @@ -2475,7 +2951,9 @@ 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); @@ -2515,17 +2993,23 @@ namespace UWUVCI_AIO_WPF 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] }); + + //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) + public void getBootIMGNES(string rom) { string SystemType = "nes/"; var repoid = GetFakeNESProdcode(rom); @@ -2534,11 +3018,12 @@ namespace UWUVCI_AIO_WPF SystemType + repoid }; - if (await CheckForInternetConnectionWOWarningAsync()) + if (CheckForInternetConnectionWOWarning()) { GetRepoImages(SystemType, repoid); - await checkForAdditionalFiles(GameConsoles.NES, repoids); + checkForAdditionalFiles(GameConsoles.NES, repoids); } + } static string GetMd5Hash(MD5 md5Hash, byte[] input) { @@ -2552,7 +3037,9 @@ 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(); @@ -2560,6 +3047,7 @@ namespace UWUVCI_AIO_WPF static string GetMd5Hash(MD5 md5Hash, string input) { + // Convert the input string to a byte array and compute the hash. byte[] data = md5Hash.ComputeHash(Encoding.UTF8.GetBytes(input)); @@ -2570,7 +3058,9 @@ 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(); @@ -2582,10 +3072,15 @@ 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(); @@ -2596,12 +3091,14 @@ namespace UWUVCI_AIO_WPF 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] }); + //Console.WriteLine("NumberHash of GameName: "+ number); Console.WriteLine("Fake ProdCode: " + getCodeOfNumbers(Convert.ToInt32(first10))); Console.WriteLine("---------------------------------------------------"); return getCodeOfNumbers(Convert.ToInt32(first10)); @@ -2643,12 +3140,15 @@ namespace UWUVCI_AIO_WPF var toret = new char[] { letters[n1], letters[n2], letters[n3], letters[n4] }; return new string(toret).ToUpper(); } - public async Task getBootIMGNDS(string rom) + public void getBootIMGNDS(string rom) { 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); @@ -2656,25 +3156,31 @@ 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(); - if (await CheckForInternetConnectionWOWarningAsync()) + if (CheckForInternetConnectionWOWarning()) { repoids.Add(SystemType + repoid); repoids.Add(SystemType + repoid.Substring(0, 3) + "E"); repoids.Add(SystemType + repoid.Substring(0, 3) + "P"); repoids.Add(SystemType + repoid.Substring(0, 3) + "J"); GetRepoImages(SystemType, repoid); - await checkForAdditionalFiles(GameConsoles.NDS, repoids); + checkForAdditionalFiles(GameConsoles.NDS, repoids); + } + } - public async Task getBootIMGN64(string rom) + public void getBootIMGN64(string rom) { 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); @@ -2683,16 +3189,19 @@ 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()) + if (CheckForInternetConnectionWOWarning()) { repoids.Add(SystemType + repoid); repoids.Add(SystemType + new string(new char[] { repoid[0], repoid[2], repoid[1], repoid[3] })); GetRepoImages(SystemType, repoid); - await checkForAdditionalFiles(GameConsoles.N64, repoids); + checkForAdditionalFiles(GameConsoles.N64, repoids); } + } private string ByteArrayToString(byte[] arr) { @@ -2704,47 +3213,54 @@ namespace UWUVCI_AIO_WPF string ret = ""; try { - 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 + using (var reader = new BinaryReader(File.OpenRead(OpenGame))) { - 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; + string TempString = ""; + string SystemType = "wii/"; + if (gc) + { + SystemType = "gcn/"; + } + var repoid = ""; reader.BaseStream.Position = 0x00; - while ((int)(TempChar = reader.ReadChar()) != 0) TempString = TempString + TempChar; - repoid = TempString; - } + char TempChar; + //WBFS Check + List repoids = new List(); + if (new FileInfo(OpenGame).Extension.Contains("wbfs")) //Performs actions if the header indicates a WBFS file + { - 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 = 0x200; - GetRepoImages(SystemType, repoid, repoids); - checkForAdditionalFiles(test == GameConsoles.GCN ? GameConsoles.GCN : GameConsoles.WII, repoids); + reader.BaseStream.Position = 0x218; + + + reader.BaseStream.Position = 0x220; + while ((TempChar = reader.ReadChar()) != 0) ret += TempChar; + reader.BaseStream.Position = 0x200; + while ((TempChar = reader.ReadChar()) != 0) TempString += TempChar; + repoid = TempString; + } + else + { + reader.BaseStream.Position = 0x18; + + reader.BaseStream.Position = 0x20; + while ((TempChar = reader.ReadChar()) != 0) ret += TempChar; + reader.BaseStream.Position = 0x00; + while ((TempChar = reader.ReadChar()) != 0) TempString += TempChar; + repoid = TempString; + } + + if (CheckForInternetConnectionWOWarning()) + { + 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); + } } } catch (Exception) @@ -2756,75 +3272,63 @@ namespace UWUVCI_AIO_WPF } catch (Exception) { } cm.ShowDialog(); + } + + return ret; } - public async Task CheckForInternetConnectionAsync() + public bool CheckForInternetConnection() { try { - using (var client = new HttpClient()) - using (await client.GetAsync("http://google.com/generate_204")) + using (var client = new WebClient()) + using (client.OpenRead("http://google.com/generate_204")) return true; } catch { - var googleBlocked = false; - - using (var client = new HttpClient()) - using (await client.GetAsync("https://raw.githubusercontent.com")) - googleBlocked = true; - - Custom_Message cm; - if (!googleBlocked) - cm = new Custom_Message("No Internet Connection", " To Download Tools, Bases or required Files you need to be connected to the Internet. The Program will now terminate. "); - else - cm = new Custom_Message("Google Can't Be Reached On Your Connection", " To check for Internet on non webapps, Google is normally used since it's the fastest site to reach. You may run into issues with other programs. "); + Custom_Message cm = new Custom_Message("No Internet Connection", " To Download Tools, Bases or required Files you need to be connected to the Internet. The Program will now terminate. "); try { cm.Owner = mw; + } + + catch (Exception) { } cm.ShowDialog(); - - if (!googleBlocked) - Environment.Exit(1); - - return googleBlocked; + Environment.Exit(1); + return false; } } - public async Task CheckForInternetConnectionWOWarningAsync() + public bool CheckForInternetConnectionWOWarning() { try { - using (var client = new HttpClient()) - using (await client.GetAsync("http://google.com/generate_204")) + using (var client = new WebClient()) + using (client.OpenRead("http://google.com/generate_204")) return true; } catch { - try - { - using (var client = new HttpClient()) - using (await client.GetAsync("http://raw.githubusercontent.com")) - return true; - } - catch - { - return false; - } + + + return false; } } - private async Task checkForAdditionalFiles(GameConsoles console, List repoids) + private void checkForAdditionalFiles(GameConsoles console, List repoids) { if (!Directory.Exists(Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo"))) + { Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo")); - + } bool ini = false; bool btsnd = false; string inip = ""; + string btsndp = ""; string exten = ""; - string linkbase = "https://raw.githubusercontent.com/Flumpster/UWUVCI-Images/master/"; + string linkbase = "https://raw.githubusercontent.com/UWUVCI-PRIME/UWUVCI-IMAGES/master/"; if (console == GameConsoles.N64) { foreach (string repoid in repoids) @@ -2835,7 +3339,9 @@ namespace UWUVCI_AIO_WPF inip = linkbase + repoid + "/game.ini"; break; } + } + } string[] ext = { "btsnd" }; foreach (var e in ext) @@ -2845,12 +3351,15 @@ namespace UWUVCI_AIO_WPF if (RemoteFileExists(linkbase + repoid + "/BootSound." + e)) { btsnd = true; - string btsndp = linkbase + repoid + "/BootSound." + e; + btsndp = linkbase + repoid + "/BootSound." + e; exten = e; break; } if (btsnd) + { break; + } + } } @@ -2873,22 +3382,16 @@ namespace UWUVCI_AIO_WPF cm.ShowDialog(); if (addi) { - var client = new HttpClient(); + var client = new WebClient(); if (ini) { - using var response = await client.GetStreamAsync(inip); - using var fs = new FileStream(Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo", "game.ini"), FileMode.Create); - await response.CopyToAsync(fs); - + client.DownloadFile(inip, Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo", "game.ini")); (Thing as N64Config).ini.Text = Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo", "game.ini"); GameConfiguration.N64Stuff.INIPath = Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo", "game.ini"); } 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); - + client.DownloadFile(btsndp, Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo", $"bootSound.{exten}")); BootSound = Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo", $"bootSound.{exten}"); switch (console) { @@ -2906,13 +3409,18 @@ 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}"); break; + } } addi = false; @@ -2925,20 +3433,20 @@ namespace UWUVCI_AIO_WPF if (console == "tg16" || console == "tgcd") console = "tgfx"; - string url = @"https://flumpster.github.io/instructions/" + console + "/" + console + ".html"; - + string url = "https://uwuvci-prime.github.io/UWUVCI-Resources/" + console + "/" + console + ".html"; + return url; } + WaveOutEvent waveOutEvent = new WaveOutEvent(); AudioFileReader audioFileReader; public System.Timers.Timer t; public bool passtrough = true; internal bool enableWii = true; internal bool backupenableWii = true; - public GameConsoles test; - public void PlaySound() { + Task ts = new Task(() => { try @@ -2946,6 +3454,9 @@ namespace UWUVCI_AIO_WPF t = new System.Timers.Timer(200); t.Elapsed += isDone; + + + audioFileReader = new AudioFileReader(BootSound); waveOutEvent.Init(audioFileReader); @@ -2957,6 +3468,7 @@ namespace UWUVCI_AIO_WPF { } + }); ts.Start(); } @@ -2971,11 +3483,15 @@ namespace UWUVCI_AIO_WPF audioFileReader.Dispose(); t.Stop(); } + + + } catch (Exception) { } + } public void isDone(Object source, ElapsedEventArgs e) { @@ -2999,23 +3515,39 @@ 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))) + using (Process p = new Process()) + { + p.StartInfo.FileName = System.Windows.Application.ResourceAssembly.Location; + if (debug) { - fileName = file; - break; + if (saveworkaround) + { + p.StartInfo.Arguments = "--debug --skip --spacebypass"; + } + else + { + p.StartInfo.Arguments = "--debug --skip"; + } + } - - p.StartInfo.FileName = fileName; - - p.StartInfo.Arguments = (debug ? "--debug " : "") + "--skip" + (saveworkaround ? " --spacebypass" : ""); - p.Start(); - Environment.Exit(0); + else + { + if (saveworkaround) + { + p.StartInfo.Arguments = "--skip --spacebypass"; + } + else + { + p.StartInfo.Arguments = "--skip"; + } + } + p.Start(); + Environment.Exit(0); + } } @@ -3024,9 +3556,8 @@ namespace UWUVCI_AIO_WPF /// private void GetRepoImages(string SystemType, string repoid, List repoids = null) { - string linkbase = "https://raw.githubusercontent.com/Flumpster/UWUVCI-Images/master/"; - IMG_Message img = null; - string[] ext = { "png", "jpg", "jpeg" , "tga"}; + string linkbase = "https://raw.githubusercontent.com/UWUVCI-PRIME/UWUVCI-IMAGES/master/"; + string[] ext = { "png", "jpg", "jpeg", "tga" }; if (repoids == null || repoids?.Count == 0) { @@ -3049,13 +3580,11 @@ namespace UWUVCI_AIO_WPF { foreach (var id in repoids) { - var remoteFile = linkbase + id + $"/iconTex.{e}"; - if (RemoteFileExists(remoteFile) == true) + if (RemoteFileExists(linkbase + id + $"/iconTex.{e}") == true) { - if (e.Contains("tga")) { - var message = new Custom_Message("TGA Extension Warning", "It looks to be that the only files we have are in TGA format. TGA files can't natively be rendered in UWUVCI.\n\nYou will have to grab the files, convert them to png, and then manually insert them.\n\nYou can find the files at this URL: \""+ linkbase + id + "\""); + var message = new Custom_Message("TGA Extension Warning", "TGA files can't natively be rendered in UWUVCI, instead it will say something along the lines of the image not being able to be shown.\nThis is correct and is normal behavior.\n\nIf there are actual errors then grab the files from \"https://github.com/UWUVCI-PRIME/UWUVCI-IMAGES\", convert them to png, and then manually insert them."); try { message.Owner = mw; @@ -3065,10 +3594,8 @@ namespace UWUVCI_AIO_WPF } message.ShowDialog(); - continue; } - - img = new IMG_Message(linkbase + id + $"/iconTex.{e}", linkbase + id + $"/bootTvTex.{e}", id); + var img = new IMG_Message(linkbase + id + $"/iconTex.{e}", linkbase + id + $"/bootTvTex.{e}", id); try { img.Owner = mw; @@ -3081,4 +3608,4 @@ namespace UWUVCI_AIO_WPF } } } -} +} \ No newline at end of file diff --git a/UWUVCI AIO WPF/Properties/AssemblyInfo.cs b/UWUVCI AIO WPF/Properties/AssemblyInfo.cs index 11307d8..f06fc33 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.99.2.0")] -[assembly: AssemblyFileVersion("3.99.2.0")] +[assembly: AssemblyVersion("3.99.9.2")] +[assembly: AssemblyFileVersion("3.99.9.2")] diff --git a/UWUVCI AIO WPF/Properties/Settings.Designer.cs b/UWUVCI AIO WPF/Properties/Settings.Designer.cs index ba570a0..e499f33 100644 --- a/UWUVCI AIO WPF/Properties/Settings.Designer.cs +++ b/UWUVCI AIO WPF/Properties/Settings.Designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ // -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:4.0.30319.42000 // -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +// der Code erneut generiert wird. // //------------------------------------------------------------------------------ @@ -12,7 +12,7 @@ namespace UWUVCI_AIO_WPF.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -178,16 +178,18 @@ namespace UWUVCI_AIO_WPF.Properties { this["gczw"] = value; } } - [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("")] - public string Ancast { - get { - return ((string)(this["Ancast"])); + public string Ancast + { + get + { + return ((string)(this["ancast"])); } - set { - this["Ancast"] = value; + set + { + this["ancast"] = value; } } } diff --git a/UWUVCI AIO WPF/UI/Frames/InjectFrames/Bases/NonCustomBaseFrame.xaml.cs b/UWUVCI AIO WPF/UI/Frames/InjectFrames/Bases/NonCustomBaseFrame.xaml.cs index e4b6bf4..d5560bf 100644 --- a/UWUVCI AIO WPF/UI/Frames/InjectFrames/Bases/NonCustomBaseFrame.xaml.cs +++ b/UWUVCI AIO WPF/UI/Frames/InjectFrames/Bases/NonCustomBaseFrame.xaml.cs @@ -91,17 +91,26 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Bases if (info[0]) { mvm.BaseDownloaded = true; - if (mvm.RomSet) - mvm.CanInject = true; + if (mvm.RomSet) mvm.CanInject = true; } else + { mvm.BaseDownloaded = false; - } + + } + } + } + private void btnDwnlnd_Click(object sender, RoutedEventArgs e) { - mvm.Download(); - checkStuff(mvm.getInfoOfBase(Base)); + + mvm.Download(); + Thread.Sleep(500); + checkStuff(mvm.getInfoOfBase(Base)); + + + } private void btnDwnlnd_Copy_Click(object sender, RoutedEventArgs e) diff --git a/UWUVCI AIO WPF/UI/Frames/InjectFrames/Configurations/WiiConfig.xaml b/UWUVCI AIO WPF/UI/Frames/InjectFrames/Configurations/WiiConfig.xaml index 3744054..39ee2af 100644 --- a/UWUVCI AIO WPF/UI/Frames/InjectFrames/Configurations/WiiConfig.xaml +++ b/UWUVCI AIO WPF/UI/Frames/InjectFrames/Configurations/WiiConfig.xaml @@ -54,7 +54,7 @@ - - diff --git a/UWUVCI AIO WPF/UI/Frames/SettingsFrame.xaml.cs b/UWUVCI AIO WPF/UI/Frames/SettingsFrame.xaml.cs index 83ee36b..5d43143 100644 --- a/UWUVCI AIO WPF/UI/Frames/SettingsFrame.xaml.cs +++ b/UWUVCI AIO WPF/UI/Frames/SettingsFrame.xaml.cs @@ -15,7 +15,6 @@ 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 @@ -25,12 +24,12 @@ namespace UWUVCI_AIO_WPF.UI.Frames /// public partial class SettingsFrame : Page, IDisposable { - MainWindow parent; + MainWindow parent; public SettingsFrame(MainWindow mw) { InitializeComponent(); parent = mw; - // spm.Content += "\nThis will most likely fix the Injection Process, if it's stuck before it shows Copy Base"; + // spm.Content += "\nThis will most likely fix the Injection Process, if it's stuck before it shows Copy Base"; } public void Dispose() { @@ -39,8 +38,8 @@ namespace UWUVCI_AIO_WPF.UI.Frames private void Button_Click(object sender, RoutedEventArgs e) { - /* TitleKeys tk = new TitleKeys(); - tk.ShowDialog();*/ + /* TitleKeys tk = new TitleKeys(); + tk.ShowDialog();*/ } private void Button_Click_1(object sender, RoutedEventArgs e) @@ -57,7 +56,7 @@ namespace UWUVCI_AIO_WPF.UI.Frames private void Button_Click_3(object sender, RoutedEventArgs e) { MainViewModel mvm = FindResource("mvm") as MainViewModel; - mvm.UpdateBaseAsync(); + mvm.UpdateBases(); } private void Button_Click_4(object sender, RoutedEventArgs e) @@ -67,12 +66,12 @@ namespace UWUVCI_AIO_WPF.UI.Frames { Process.Start(@"bin\Tools\INICreator.exe"); } - + } private void Button_Click_5(object sender, RoutedEventArgs e) { - Custom_Message cm = new Custom_Message("Credits", "UWUVCI AIO - NicoAICP, Morilli, ZestyTS\nBeta Testers/Contributors - wowjinxy, Danis, Adolfobenjaminv\n\nBuildPcePkg & BuildTurboCDPcePkg - JohnnyGo\nCdecrypt - crediar\nCNUSPACKER - NicoAICP, Morilli\nINICreator - NicoAICP\nN64Converter - Morilli\npng2tga - Easy2Convert\ninject_gba_c (psb) - Morilli\nRetroInject_C - Morilli\ntga_verify - Morilli\nWiiUDownloader - Morilli, ZestyTS\nwiiurpxtool - 0CHB0\nGoomba - FluBBa\nDarkFilter Removal N64 - MelonSpeedruns, ZestyTS\nNintendont SD Card Menu - TeconMoon\nwit - Wiimm\nGetExtTypePatcher - Fix94\nnfs2iso2nfs - sabykos, piratesephiroth, Fix94, ZestyTS, and many more\nWii-VMC - wanikoko\nIcon/TV Bootimages - Flump, ZestyTS\nNKit - Nanook\nImage Creation Base - Phacox\nWiiGameLanguage Patcher - ReturnerS\nChangeAspectRatio - andot\nvWii Title Forwarder - Fix94"); + Custom_Message cm = new Custom_Message("Credits", "UWUVCI AIO - NicoAICP, Morilli, ZestyTS\nBeta Testers/Contributors - wowjinxy, Danis, Adolfobenjaminv\n\nBuildPcePkg & BuildTurboCDPcePkg - JohnnyGo\nCdecrypt - crediar\nCNUSPACKER - NicoAICP, Morilli\nINICreator - NicoAICP\nN64Converter - Morilli\npng2tga - Easy2Convert\ninject_gba_c (psb) - Morilli\nRetroInject_C - Morilli\ntga_verify - Morilli\nWiiUDownloader - Morilli\nwiiurpxtool - 0CHB0\nGoomba - FluBBa\nDarkFilter Removal N64 - MelonSpeedruns, ZestyTS\nNintendont SD Card Menu - TeconMoon\nwit - Wiimm\nGetExtTypePatcher - Fix94\nnfs2iso2nfs - sabykos, piratesephiroth, Fix94 and many more\nWii-VMC - wanikoko\nIcon/TV Bootimages - Flump, ZestyTS\nNKit - Nanook\nImage Creation Base - Phacox\nWiiGameLanguage Patcher - ReturnerS\nChangeAspectRatio - andot\nvWii Title Forwarder - Fix94"); try { cm.Owner = (FindResource("mvm") as MainViewModel).mw; @@ -87,13 +86,13 @@ namespace UWUVCI_AIO_WPF.UI.Frames private void Button_Click_6(object sender, RoutedEventArgs e) { MainViewModel mvm = FindResource("mvm") as MainViewModel; - mvm.UpdateAsync(true); + mvm.Update(true); } private void Button_Click_7(object sender, RoutedEventArgs e) { MainViewModel mvm = FindResource("mvm") as MainViewModel; - mvm.UpdateToolsAsync(); + mvm.UpdateTools(); } private void Button_Click_8(object sender, RoutedEventArgs e) @@ -109,7 +108,7 @@ namespace UWUVCI_AIO_WPF.UI.Frames { Process.Start(@"bin\Tools\NintendontConfig.exe"); } - + } private void Button_Click_10(object sender, RoutedEventArgs e) @@ -144,12 +143,7 @@ namespace UWUVCI_AIO_WPF.UI.Frames private void Button_Click_13(object sender, RoutedEventArgs e) { - Process.Start(new ProcessStartInfo() - { - FileName = "https://ko-fi.com/zestyts", - UseShellExecute = true, - Verb = "open" - }); + 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 4747d8f..2936a62 100644 --- a/UWUVCI AIO WPF/UI/Frames/StartFrame.xaml +++ b/UWUVCI AIO WPF/UI/Frames/StartFrame.xaml @@ -7,8 +7,9 @@ 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 893b4fa..4298777 100644 --- a/UWUVCI AIO WPF/UI/Frames/StartFrame.xaml.cs +++ b/UWUVCI AIO WPF/UI/Frames/StartFrame.xaml.cs @@ -17,20 +17,11 @@ namespace UWUVCI_AIO_WPF.UI.Frames private void Button_Click(object sender, RoutedEventArgs e) { - OpenKofiLink("uwuvci"); + Process.Start("https://ko-fi.com/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/" + urlSuffix, - UseShellExecute = true, - Verb = "open" - }); + Process.Start("https://ko-fi.com/zestyts"); } } } \ No newline at end of file diff --git a/UWUVCI AIO WPF/UI/Frames/Teaser.xaml.cs b/UWUVCI AIO WPF/UI/Frames/Teaser.xaml.cs index 0534cfd..74b75a2 100644 --- a/UWUVCI AIO WPF/UI/Frames/Teaser.xaml.cs +++ b/UWUVCI AIO WPF/UI/Frames/Teaser.xaml.cs @@ -29,7 +29,6 @@ namespace UWUVCI_AIO_WPF.UI.Frames private void tb_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { - //Process.Start("https://www.reddit.com/r/WiiUHacks/comments/jchcls/poc_retroarch_autoboot_starts_rom_automatically/"); var cm = new Custom_Message("Soon™", "Coming Soon™ to a UWUVCI Prime Near You!"); cm.ShowDialog(); } diff --git a/UWUVCI AIO WPF/UI/Windows/Custom Message.xaml.cs b/UWUVCI AIO WPF/UI/Windows/Custom Message.xaml.cs index 187ce4b..3f21f9d 100644 --- a/UWUVCI AIO WPF/UI/Windows/Custom Message.xaml.cs +++ b/UWUVCI AIO WPF/UI/Windows/Custom Message.xaml.cs @@ -110,24 +110,15 @@ namespace UWUVCI_AIO_WPF.UI.Windows private void Folder_Click(object sender, RoutedEventArgs e) { - var filePath = ""; try { - filePath = path; - if (File.Exists(filePath)) - filePath = new FileInfo(filePath).DirectoryName; - - Process.Start(new ProcessStartInfo() - { - FileName = filePath, - UseShellExecute = true, - Verb = "open" - }); + if (File.Exists(path)) path = new FileInfo(path).DirectoryName; + Process.Start(path); Close(); } catch (Exception) { - Custom_Message cm = new Custom_Message("An Error occured", "An error occured opening the folder. Please make sure the Output Path exists.\n\nFile path: " + filePath); + Custom_Message cm = new Custom_Message("An Error occured", "An error occured opening the folder. Please make sure the Output Path exists."); try { cm.Owner = (FindResource("mvm") as MainViewModel).mw; @@ -166,7 +157,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows Close(); var containNintendont = Message.Content.ToString().ToLower().Contains("nintendont"); - SDSetup sd = new SDSetup(containNintendont, path); + SDSetup sd = new SDSetup(containNintendont ? true : false, path); try { sd.Owner = (FindResource("mvm") as MainViewModel).mw; diff --git a/UWUVCI AIO WPF/UI/Windows/DownloadWait.xaml.cs b/UWUVCI AIO WPF/UI/Windows/DownloadWait.xaml.cs index 0be213e..649e386 100644 --- a/UWUVCI AIO WPF/UI/Windows/DownloadWait.xaml.cs +++ b/UWUVCI AIO WPF/UI/Windows/DownloadWait.xaml.cs @@ -12,6 +12,12 @@ namespace UWUVCI_AIO_WPF.UI.Windows { MainViewModel mvm; DispatcherTimer timer = new DispatcherTimer(); + + //These variables are for handling a better progress bar + private TimeSpan remainingTime; + private int motion = 1; + private double accumulatedProgress = 0.0; + private double progressIncrementPerSecond = 0.0; public DownloadWait(string doing, string msg, MainViewModel mvm) { try @@ -38,9 +44,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows try { if (Owner?.GetType() != typeof(MainWindow)) - { WindowStartupLocation = WindowStartupLocation.CenterScreen; - } } catch (Exception) { @@ -54,36 +58,108 @@ namespace UWUVCI_AIO_WPF.UI.Windows timer.Tick += timer_Tick; } + + public DownloadWait(string doing, TimeSpan estimatedTime, MainViewModel mvm) + { + // Initialization same as original constructor + try + { + if (Owner?.GetType() == typeof(MainWindow)) + WindowStartupLocation = WindowStartupLocation.CenterOwner; + } + catch (Exception) + { + WindowStartupLocation = WindowStartupLocation.CenterScreen; + } + this.mvm = mvm; + InitializeComponent(); + Key.Text = doing; + + // Handle estimated time + if (estimatedTime != TimeSpan.MaxValue) + remainingTime = estimatedTime; + else + // Can't estimate, just starting with zero + remainingTime = TimeSpan.Zero; + + timer.Interval = TimeSpan.FromSeconds(1); + timer.Tick += timer_Tick; + timer.Start(); + } private void Window_Minimize(object sender, RoutedEventArgs e) { WindowState = WindowState.Minimized; } + private void timer_Tick(object sender, EventArgs e) { msgT.Text = mvm.msg; pb.Value = mvm.Progress; + if (Key.Text.Contains("Downloading Base")) { - if (mvm.Progress < 70) + if (mvm.Progress >= 96) { - mvm.Progress += 1; + msgT.Text += $"Verifying download..."; + + if (motion == 6) + motion = 1; + + for (var i = 0; i < motion; i++) + msgT.Text += "."; + + motion++; + } + // Check if remainingTime has been initialized (i.e., not zero) + else if (remainingTime != TimeSpan.Zero) + { + if (remainingTime.TotalSeconds > 0) + { + msgT.Text += $"Estimated time remaining: {remainingTime.Minutes} minutes {remainingTime.Seconds} seconds"; + + if (mvm.Progress < 95) + { + // Calculate the progress increment if not already calculated + if (progressIncrementPerSecond == 0.0) + progressIncrementPerSecond = (95 - mvm.Progress) / remainingTime.TotalSeconds; + + accumulatedProgress += progressIncrementPerSecond; + + while (accumulatedProgress >= 1) + { + mvm.Progress++; + accumulatedProgress--; + } + + remainingTime = remainingTime.Add(TimeSpan.FromSeconds(-1)); + } + } + else + { + msgT.Text += $"Completing download, eta not available"; + + if (motion == 6) + motion = 1; + + for (var i = 0; i < motion; i++) + msgT.Text += "."; + + motion++; + } + } + else + { + if (mvm.Progress < 95) + mvm.Progress += 1; } } - else if (Key.Text.Contains("Injecting Game")) { - if (mvm.Progress < 79) - mvm.Progress += 1; - } - else if (Key.Text.Contains("Downloading Tools")) { } - else - mvm.Progress += 1; - - if(mvm.Progress >= 100) + if (mvm.Progress == 100) { timer.Stop(); Close(); - } } + public void changeOwner(MainWindow ow) { Owner = ow; diff --git a/UWUVCI AIO WPF/UI/Windows/IMG_Message.xaml.cs b/UWUVCI AIO WPF/UI/Windows/IMG_Message.xaml.cs index 52e7e3d..64f3351 100644 --- a/UWUVCI AIO WPF/UI/Windows/IMG_Message.xaml.cs +++ b/UWUVCI AIO WPF/UI/Windows/IMG_Message.xaml.cs @@ -306,7 +306,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows string inip = ""; string btsndp = ""; string exten = ""; - string linkbase = "https://raw.githubusercontent.com/Flumpster/UWUVCI-Images/master/"; + string linkbase = "https://raw.githubusercontent.com/UWUVCI-PRIME/UWUVCI-IMAGES/master/"; if (console == GameConsoles.N64) { if (RemoteFileExists(linkbase+repoid+"/game.ini")) @@ -395,7 +395,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows string inip = ""; string btsndp = ""; string exten = ""; - string linkbase = "https://raw.githubusercontent.com/Flumpster/UWUVCI-Images/master/"; + string linkbase = "https://raw.githubusercontent.com/UWUVCI-PRIME/UWUVCI-IMAGES/master/"; if (console == GameConsoles.N64) { if (RemoteFileExists(linkbase + repoid + "/game.ini")) diff --git a/UWUVCI AIO WPF/UI/Windows/TitleKeys.xaml.cs b/UWUVCI AIO WPF/UI/Windows/TitleKeys.xaml.cs index da40df6..57a1a51 100644 --- a/UWUVCI AIO WPF/UI/Windows/TitleKeys.xaml.cs +++ b/UWUVCI AIO WPF/UI/Windows/TitleKeys.xaml.cs @@ -156,7 +156,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows private void wb_Navigating(object sender, System.Windows.Navigation.NavigatingCancelEventArgs e) { - if (!e.Uri.ToString().Contains("flumpster")) + if (!e.Uri.ToString().Contains("UWUVCI-PRIME")) { e.Cancel = true; diff --git a/UWUVCI AIO WPF/UWUVCI AIO WPF.csproj b/UWUVCI AIO WPF/UWUVCI AIO WPF.csproj index bf68324..b255e4e 100644 --- a/UWUVCI AIO WPF/UWUVCI AIO WPF.csproj +++ b/UWUVCI AIO WPF/UWUVCI AIO WPF.csproj @@ -1,7 +1,22 @@ - + + + + - net6.0-windows + Debug + AnyCPU + {6A60AB0E-4597-4ECA-AEFB-D63A26CA7B54} WinExe + UWUVCI_AIO_WPF + UWUVCI AIO WPF + v4.7.2 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + true + + false publish\ true @@ -17,11 +32,26 @@ 1.0.0.%2a false true - false - True - true - true - AnyCPU + + + + x86 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 false @@ -36,18 +66,367 @@ UWUVCI_AIO_WPF.App + + ..\packages\Autoupdater.NET.Official.1.6.3\lib\net45\AutoUpdater.NET.dll + + + ..\packages\Costura.Fody.4.1.0\lib\net40\Costura.dll + + + ..\packages\CDecryptSharp.1.0.4\lib\CSharpDecrypt.dll + - ..\GameBaseClassLibrary.dll + ..\..\..\uwuvci_installer_creator\{app}\GameBaseClassLibrary.dll - - nfs2iso2nfs.dll + + ..\packages\GMWare.M2.1.1.2\lib\netstandard2.0\GMWare.M2.dll - - WiiUDownloaderLibrary.dll + + ..\packages\Json.Net.1.0.33\lib\netstandard2.0\Json.Net.dll + + + ..\packages\MaterialDesignColors.1.2.7\lib\net45\MaterialDesignColors.dll + + + ..\packages\MaterialDesignThemes.2.6.0\lib\net45\MaterialDesignThemes.Wpf.dll + + + ..\packages\McMaster.Extensions.CommandLineUtils.2.4.2\lib\net45\McMaster.Extensions.CommandLineUtils.dll + + + ..\packages\WindowsAPICodePack-Core.1.1.2\lib\Microsoft.WindowsAPICodePack.dll + + + ..\packages\WindowsAPICodePack-Shell.1.1.1\lib\Microsoft.WindowsAPICodePack.Shell.dll + + + ..\packages\NAudio.1.10.0\lib\net35\NAudio.dll + + + ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll + + + ..\packages\Octokit.1.0.0\lib\net46\Octokit.dll + + + ..\packages\Pfim.0.10.3\lib\netstandard2.0\Pfim.dll + + + + ..\packages\System.Buffers.4.5.0\lib\netstandard2.0\System.Buffers.dll + + + + + + + + + + ..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll + True + True + + + + ..\packages\System.ValueTuple.4.4.0\lib\net47\System.ValueTuple.dll + + + + + + + + + + 4.0 + + + ..\packages\WiiUDownloader.1.0.6\lib\WiiUDownloaderLibrary.dll + + + + + + ..\packages\Zstandard.Net.1.1.7\lib\net45\Zstandard.Net.dll + + MSBuild:Compile + Designer + + + + + + + + + + Done.xaml + + + OtherConfigs - Kopieren - Kopieren %282%29.xaml + + + OtherConfigs - Kopieren - Kopieren.xaml + + + OtherConfigs - Kopieren.xaml + + + WiiConfig.xaml + + + TKFrame.xaml + + + Paths.xaml + + + Teaser.xaml + + + Custom Message - Kopieren.xaml + + + Custom Message.xaml + + + DownloadWait - Kopieren.xaml + + + DownloadWait.xaml + + + EnterKey.xaml + + + ImageCreator - Kopieren - Kopieren %282%29.xaml + + + ImageCreator - Kopieren - Kopieren.xaml + + + ImageCreator - Kopieren.xaml + + + ImageCreator.xaml + + + IMG_Message - Kopieren - Kopieren - Kopieren.xaml + + + IMG_Message - Kopieren - Kopieren.xaml + + + IMG_Message - Kopieren.xaml + + + IMG_Message.xaml + + + TitleKeys - Kopieren.xaml + + + TitleKeys.xaml + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + + + + + + + InjectFrame.xaml + + + BaseContainerFrame.xaml + + + CustomBaseFrame.xaml + + + NonCustomBaseFrame.xaml + + + N64Config.xaml + + + OtherConfigs.xaml + + + SettingsFrame.xaml + + + StartFrame.xaml + + + MenuWindow.xaml + Code + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + @@ -120,6 +499,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -157,59 +665,15 @@ - - - - - - - - - - - - - - - - - - - - - - - all - - - - - - - - - - - tlbimp - 1 - 1 - 1ea4dbf0-3c3b-11cf-810c-00aa00389b71 - 0 - false - true - - - - - True - True - Settings.settings - - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - + + + + Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}". + + + + + + + \ No newline at end of file diff --git a/UWUVCI AIO WPF/packages.config b/UWUVCI AIO WPF/packages.config new file mode 100644 index 0000000..47fa935 --- /dev/null +++ b/UWUVCI AIO WPF/packages.config @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WiiUDownloaderLibrary.dll b/WiiUDownloaderLibrary.dll new file mode 100644 index 0000000..15fa808 Binary files /dev/null and b/WiiUDownloaderLibrary.dll differ