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;
}
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();
}
}

View file

@ -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();

View file

@ -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);
}
}

View file

@ -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"));
}