This commit is contained in:
NicoAICP 2020-04-21 22:54:32 +02:00
parent 37d4b2154d
commit d53100fb87
4 changed files with 100 additions and 51 deletions

View file

@ -2135,19 +2135,20 @@ namespace UWUVCI_AIO_WPF
return true; return true;
} }
public void getBootIMGNDS(string rom) public void getBootIMGGBA(string rom)
{ {
string linkbase = "https://raw.githubusercontent.com/Flumpster/UWUVCI-Images/master/"; string linkbase = "https://raw.githubusercontent.com/Flumpster/UWUVCI-Images/master/";
string repoid = ""; string repoid = "";
string SystemType = "nds/"; string SystemType = "gba/";
IMG_Message img = null; IMG_Message img = null;
using (var fs = new FileStream(rom, using (var fs = new FileStream(rom,
FileMode.Open, FileMode.Open,
FileAccess.Read)) FileAccess.Read))
{ {
byte[] procode = new byte[6];
fs.Seek(0x3A, SeekOrigin.Begin); byte[] procode = new byte[4];
fs.Read(procode, 0, 6); fs.Seek(0xAC, SeekOrigin.Begin);
fs.Read(procode, 0, 4);
repoid = ByteArrayToString(procode); repoid = ByteArrayToString(procode);
Regex rgx = new Regex("[^a-zA-Z0-9 -]"); Regex rgx = new Regex("[^a-zA-Z0-9 -]");
repoid = rgx.Replace(repoid, ""); repoid = rgx.Replace(repoid, "");
@ -2201,9 +2202,36 @@ namespace UWUVCI_AIO_WPF
catch (Exception) { } catch (Exception) { }
img.ShowDialog(); 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())
{ {
repoid = new string(new char[] { repoid[0], repoid[2], repoid[1], repoid[3] });
if (RemoteFileExists(linkbase + SystemType + repoid + "/iconTex.png") == true) if (RemoteFileExists(linkbase + SystemType + repoid + "/iconTex.png") == true)
{ {
img = new IMG_Message(linkbase + SystemType + repoid + "/iconTex.png", linkbase + SystemType + repoid + "/bootTvTex.png"); img = new IMG_Message(linkbase + SystemType + repoid + "/iconTex.png", linkbase + SystemType + repoid + "/bootTvTex.png");
@ -2247,7 +2275,7 @@ namespace UWUVCI_AIO_WPF
catch (Exception) { } catch (Exception) { }
img.ShowDialog(); img.ShowDialog();
} }
}
} }

View file

@ -52,8 +52,8 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
private void Set_Rom_Path(object sender, RoutedEventArgs e) private void Set_Rom_Path(object sender, RoutedEventArgs e)
{ {
string path = string.Empty; string path = string.Empty;
if (!cd) path = mvm.GetFilePath(true, false); path = mvm.GetFilePath(true, false);
else path = mvm.turbocd();
if (!CheckIfNull(path)) { if (!CheckIfNull(path)) {
mvm.RomPath = path; mvm.RomPath = path;
@ -63,6 +63,7 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
mvm.CanInject = true; mvm.CanInject = true;
} }
mvm.getBootIMGGBA(mvm.RomPath);
} }
} }
@ -246,7 +247,13 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
{ {
new TDRSHOW(tv.Text).ShowDialog(); 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) private void drcIMG_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{ {
new TDRSHOW(drc.Text).ShowDialog(); new TDRSHOW(drc.Text).ShowDialog();

View file

@ -59,6 +59,10 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
{ {
mvm.CanInject = true; mvm.CanInject = true;
}
if(mvm.GameConfiguration.Console == GameBaseClassLibrary.GameConsoles.NDS)
{
mvm.getBootIMGNDS(mvm.RomPath);
} }
} }

View file

@ -81,6 +81,10 @@ namespace UWUVCI_AIO_WPF.UI.Windows
{ {
(mvm.Thing as N64Config).icoIMG.Visibility = Visibility.Visible; (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) else if (mvm.GameConfiguration.Console == GameBaseClassLibrary.GameConsoles.NDS || mvm.GameConfiguration.Console == GameBaseClassLibrary.GameConsoles.SNES)
{ {
(mvm.Thing as OtherConfigs).icoIMG.Visibility = Visibility.Visible; (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).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")); (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) 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")); (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"));
} }