From d53100fb8721a7f7ee4c037cdc412497af1e78f7 Mon Sep 17 00:00:00 2001 From: NicoAICP Date: Tue, 21 Apr 2020 22:54:32 +0200 Subject: [PATCH] fixes --- UWUVCI AIO WPF/Models/MainViewModel.cs | 124 +++++++++++------- ...rConfigs - Kopieren - Kopieren (2).xaml.cs | 13 +- .../Configurations/OtherConfigs.xaml.cs | 4 + UWUVCI AIO WPF/UI/Windows/IMG_Message.xaml.cs | 10 ++ 4 files changed, 100 insertions(+), 51 deletions(-) diff --git a/UWUVCI AIO WPF/Models/MainViewModel.cs b/UWUVCI AIO WPF/Models/MainViewModel.cs index d1072d3..5d7f917 100644 --- a/UWUVCI AIO WPF/Models/MainViewModel.cs +++ b/UWUVCI AIO WPF/Models/MainViewModel.cs @@ -2135,19 +2135,20 @@ namespace UWUVCI_AIO_WPF return true; } - public void getBootIMGNDS(string rom) + public void getBootIMGGBA(string rom) { string linkbase = "https://raw.githubusercontent.com/Flumpster/UWUVCI-Images/master/"; string repoid = ""; - string SystemType = "nds/"; + string SystemType = "gba/"; IMG_Message img = null; using (var fs = new FileStream(rom, FileMode.Open, FileAccess.Read)) { - byte[] procode = new byte[6]; - fs.Seek(0x3A, SeekOrigin.Begin); - fs.Read(procode, 0, 6); + + byte[] procode = new byte[4]; + fs.Seek(0xAC, SeekOrigin.Begin); + fs.Read(procode, 0, 4); repoid = ByteArrayToString(procode); Regex rgx = new Regex("[^a-zA-Z0-9 -]"); repoid = rgx.Replace(repoid, ""); @@ -2201,53 +2202,80 @@ namespace UWUVCI_AIO_WPF catch (Exception) { } img.ShowDialog(); } - else + + + + } + + } + public void getBootIMGNDS(string rom) + { + string linkbase = "https://raw.githubusercontent.com/Flumpster/UWUVCI-Images/master/"; + string repoid = ""; + string SystemType = "nds/"; + IMG_Message img = null; + 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); + repoid = ByteArrayToString(procode); + 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 (CheckForInternetConnectionWOWarning()) + { + if (RemoteFileExists(linkbase + SystemType + repoid + "/iconTex.png") == true) { - repoid = new string(new char[] { repoid[0], repoid[2], repoid[1], repoid[3] }); - if (RemoteFileExists(linkbase + SystemType + repoid + "/iconTex.png") == true) + img = new IMG_Message(linkbase + SystemType + repoid + "/iconTex.png", linkbase + SystemType + repoid + "/bootTvTex.png"); + try { - img = new IMG_Message(linkbase + SystemType + repoid + "/iconTex.png", linkbase + SystemType + repoid + "/bootTvTex.png"); - try - { - img.Owner = mw; - } - catch (Exception) { } - img.ShowDialog(); - } - else if (RemoteFileExists(linkbase + SystemType + repoid.Substring(0, 3) + "E" + "/iconTex.png") == true) - { - repoid = repoid.Substring(0, 3) + "E"; - img = new IMG_Message(linkbase + SystemType + repoid + "/iconTex.png", linkbase + SystemType + repoid + "/bootTvTex.png"); - try - { - img.Owner = mw; - } - catch (Exception) { } - img.ShowDialog(); - } - else if (RemoteFileExists(linkbase + SystemType + repoid.Substring(0, 3) + "P" + "/iconTex.png") == true) - { - repoid = repoid.Substring(0, 3) + "P"; - img = new IMG_Message(linkbase + SystemType + repoid + "/iconTex.png", linkbase + SystemType + repoid + "/bootTvTex.png"); - try - { - img.Owner = mw; - } - catch (Exception) { } - img.ShowDialog(); - } - else if (RemoteFileExists(linkbase + SystemType + repoid.Substring(0, 3) + "J" + "/iconTex.png") == true) - { - repoid = repoid.Substring(0, 3) + "J"; - img = new IMG_Message(linkbase + SystemType + repoid + "/iconTex.png", linkbase + SystemType + repoid + "/bootTvTex.png"); - try - { - img.Owner = mw; - } - catch (Exception) { } - img.ShowDialog(); + img.Owner = mw; } + catch (Exception) { } + img.ShowDialog(); } + else if (RemoteFileExists(linkbase + SystemType + repoid.Substring(0, 3) + "E" + "/iconTex.png") == true) + { + repoid = repoid.Substring(0, 3) + "E"; + img = new IMG_Message(linkbase + SystemType + repoid + "/iconTex.png", linkbase + SystemType + repoid + "/bootTvTex.png"); + try + { + img.Owner = mw; + } + catch (Exception) { } + img.ShowDialog(); + } + else if (RemoteFileExists(linkbase + SystemType + repoid.Substring(0, 3) + "P" + "/iconTex.png") == true) + { + repoid = repoid.Substring(0, 3) + "P"; + img = new IMG_Message(linkbase + SystemType + repoid + "/iconTex.png", linkbase + SystemType + repoid + "/bootTvTex.png"); + try + { + img.Owner = mw; + } + catch (Exception) { } + img.ShowDialog(); + } + else if (RemoteFileExists(linkbase + SystemType + repoid.Substring(0, 3) + "J" + "/iconTex.png") == true) + { + repoid = repoid.Substring(0, 3) + "J"; + img = new IMG_Message(linkbase + SystemType + repoid + "/iconTex.png", linkbase + SystemType + repoid + "/bootTvTex.png"); + try + { + img.Owner = mw; + } + catch (Exception) { } + img.ShowDialog(); + } + } diff --git a/UWUVCI AIO WPF/UI/Frames/InjectFrames/Configurations/OtherConfigs - Kopieren - Kopieren (2).xaml.cs b/UWUVCI AIO WPF/UI/Frames/InjectFrames/Configurations/OtherConfigs - Kopieren - Kopieren (2).xaml.cs index e2e5a40..1be8950 100644 --- a/UWUVCI AIO WPF/UI/Frames/InjectFrames/Configurations/OtherConfigs - Kopieren - Kopieren (2).xaml.cs +++ b/UWUVCI AIO WPF/UI/Frames/InjectFrames/Configurations/OtherConfigs - Kopieren - Kopieren (2).xaml.cs @@ -52,8 +52,8 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations private void Set_Rom_Path(object sender, RoutedEventArgs e) { string path = string.Empty; - if (!cd) path = mvm.GetFilePath(true, false); - else path = mvm.turbocd(); + path = mvm.GetFilePath(true, false); + if (!CheckIfNull(path)) { mvm.RomPath = path; @@ -63,6 +63,7 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations mvm.CanInject = true; } + mvm.getBootIMGGBA(mvm.RomPath); } } @@ -246,7 +247,13 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations { new TDRSHOW(tv.Text).ShowDialog(); } - + public void imgpath(string icon, string tv) + { + ic.Text = icon; + this.tv.Text = tv; + icoIMG.Visibility = Visibility.Visible; + this.tv.Visibility = Visibility.Visible; + } private void drcIMG_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { new TDRSHOW(drc.Text).ShowDialog(); diff --git a/UWUVCI AIO WPF/UI/Frames/InjectFrames/Configurations/OtherConfigs.xaml.cs b/UWUVCI AIO WPF/UI/Frames/InjectFrames/Configurations/OtherConfigs.xaml.cs index 0882943..cb21b6a 100644 --- a/UWUVCI AIO WPF/UI/Frames/InjectFrames/Configurations/OtherConfigs.xaml.cs +++ b/UWUVCI AIO WPF/UI/Frames/InjectFrames/Configurations/OtherConfigs.xaml.cs @@ -59,6 +59,10 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations { mvm.CanInject = true; + } + if(mvm.GameConfiguration.Console == GameBaseClassLibrary.GameConsoles.NDS) + { + mvm.getBootIMGNDS(mvm.RomPath); } } diff --git a/UWUVCI AIO WPF/UI/Windows/IMG_Message.xaml.cs b/UWUVCI AIO WPF/UI/Windows/IMG_Message.xaml.cs index d8f590a..9115eb6 100644 --- a/UWUVCI AIO WPF/UI/Windows/IMG_Message.xaml.cs +++ b/UWUVCI AIO WPF/UI/Windows/IMG_Message.xaml.cs @@ -81,6 +81,10 @@ namespace UWUVCI_AIO_WPF.UI.Windows { (mvm.Thing as N64Config).icoIMG.Visibility = Visibility.Visible; } + else if (mvm.GameConfiguration.Console == GameBaseClassLibrary.GameConsoles.GBA) + { + (mvm.Thing as GBA).icoIMG.Visibility = Visibility.Visible; + } else if (mvm.GameConfiguration.Console == GameBaseClassLibrary.GameConsoles.NDS || mvm.GameConfiguration.Console == GameBaseClassLibrary.GameConsoles.SNES) { (mvm.Thing as OtherConfigs).icoIMG.Visibility = Visibility.Visible; @@ -101,8 +105,14 @@ namespace UWUVCI_AIO_WPF.UI.Windows (mvm.Thing as N64Config).tvIMG.Visibility = Visibility.Visible; (mvm.Thing as N64Config).imgpath(System.IO.Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo", "iconTex.png"), System.IO.Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo", "bootTvTex.png")); } + else if (mvm.GameConfiguration.Console == GameBaseClassLibrary.GameConsoles.GBA) + { + (mvm.Thing as GBA).tvIMG.Visibility = Visibility.Visible; + (mvm.Thing as GBA).imgpath(System.IO.Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo", "iconTex.png"), System.IO.Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo", "bootTvTex.png")); + } else if (mvm.GameConfiguration.Console == GameBaseClassLibrary.GameConsoles.NDS || mvm.GameConfiguration.Console == GameBaseClassLibrary.GameConsoles.SNES) { + (mvm.Thing as OtherConfigs).tvIMG.Visibility = Visibility.Visible; (mvm.Thing as OtherConfigs).imgpath(System.IO.Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo", "iconTex.png"), System.IO.Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo", "bootTvTex.png")); }