Configs now work

This commit is contained in:
NicoAICP 2020-04-06 21:30:31 +02:00
parent 76464b6bd4
commit 457e32cb2f
16 changed files with 315 additions and 62 deletions

View file

@ -9,7 +9,7 @@ using UWUVCI_AIO_WPF.Classes;
namespace UWUVCI_AIO_WPF
{
[Serializable]
class GameConfig : BaseModel
class GameConfig
{
public GameConsoles Console { get; set; }
public GameBases BaseRom { get; set; }
@ -20,7 +20,7 @@ namespace UWUVCI_AIO_WPF
{
get { return cBasePath; }
set { cBasePath = value;
OnPropertyChanged();
}
}

View file

@ -401,17 +401,26 @@ namespace UWUVCI_AIO_WPF
n64convert.Start();
n64convert.WaitForExit();
}
if (config.INIPath == null)
if(config.INIBin == null)
{
File.Delete(mainIni);
File.Copy(Path.Combine(toolsPath, "blank.ini"), 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
{
ReadFileFromBin(config.INIBin, "custom.ini");
File.Delete(mainIni);
File.Copy(config.INIPath, mainIni);
File.Move("custom.ini", mainIni);
}
if (config.DarkFilter)
{

View file

@ -5,8 +5,10 @@ using System.Text;
using System.Threading.Tasks;
namespace UWUVCI_AIO_WPF.Classes
{
class N64Conf : BaseModel
[Serializable]
class N64Conf
{
private string iniPath = null;
@ -14,7 +16,6 @@ namespace UWUVCI_AIO_WPF.Classes
{
get { return iniPath; }
set { iniPath = value;
OnPropertyChanged();
}
}
private bool darkFilter;
@ -23,7 +24,6 @@ namespace UWUVCI_AIO_WPF.Classes
{
get { return darkFilter; }
set { darkFilter = value;
OnPropertyChanged();
}
}

View file

@ -6,7 +6,8 @@ using System.Threading.Tasks;
namespace UWUVCI_AIO_WPF.Classes
{
class PNGTGA : BaseModel
[Serializable]
class PNGTGA
{
private string imgPath = null;
@ -14,7 +15,6 @@ namespace UWUVCI_AIO_WPF.Classes
{
get { return imgPath; }
set { imgPath = value;
OnPropertyChanged();
}
}

View file

@ -7,6 +7,7 @@ using System.Text;
namespace UWUVCI_AIO_WPF
{
[Serializable]
public class BaseModel : INotifyPropertyChanged
{
// Declare the PropertyChanged event

View file

@ -3,15 +3,20 @@ using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading.Tasks;
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;
namespace UWUVCI_AIO_WPF
@ -21,7 +26,7 @@ namespace UWUVCI_AIO_WPF
//public GameConfig GameConfiguration { get; set; }
private GameConfig gameConfiguration = new GameConfig();
public GameConfig GameConfiguration
{
get { return gameConfiguration; }
@ -112,6 +117,14 @@ namespace UWUVCI_AIO_WPF
}
}
private Page thing;
public Page Thing
{
get { return thing; }
set { thing = value; }
}
public int OldIndex { get; set; }
public bool RomSet { get; set; }
@ -144,7 +157,7 @@ namespace UWUVCI_AIO_WPF
}
private List<GameBases> lNES = new List<GameBases>();
public List<GameBases> LNES
{
get { return lNES; }
@ -200,6 +213,20 @@ namespace UWUVCI_AIO_WPF
}
}
private string cBasePath;
public string CBasePath
{
get { return cBasePath; }
set { cBasePath = value;
OnPropertyChanged();
}
}
private MainWindow mw;
private CustomBaseFrame cb = null;
@ -207,9 +234,9 @@ namespace UWUVCI_AIO_WPF
{
toolCheck();
BaseCheck();
GameConfiguration = new GameConfig();
if (!ValidatePathsStillExist() && Settings.Default.SetBaseOnce && Settings.Default.SetOutOnce)
if (!ValidatePathsStillExist() && Settings.Default.SetBaseOnce && Settings.Default.SetOutOnce)
{
MessageBox.Show("One of your added Paths seems to not exist anymore. Please check the paths in the Path menu!", "Issue", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
@ -219,12 +246,16 @@ namespace UWUVCI_AIO_WPF
}
public void resetCBASE()
{
if(cb != null) cb.Reset();
if (cb != null) cb.Reset();
}
public void removeCBASE()
{
cb = null;
}
public void setThing(Page T)
{
Thing = T;
}
public void SetCBASE(CustomBaseFrame cbs)
{
cb = cbs;
@ -233,6 +264,122 @@ namespace UWUVCI_AIO_WPF
{
mw = mwi;
}
public void ExportFile()
{
ReadImagesIntoConfig();
if (GameConfiguration.Console == GameConsoles.N64)
{
ReadIniIntoConfig();
}
CheckAndFixConfigFolder();
Stream createConfigStream = new FileStream($@"configs\{GameConfiguration.GameName}.uwuvci", FileMode.Create, FileAccess.Write);
GZipStream compressedStream = new GZipStream(createConfigStream, CompressionMode.Compress);
IFormatter formatter = new BinaryFormatter();
formatter.Serialize(compressedStream, GameConfiguration);
compressedStream.Close();
createConfigStream.Close();
}
public void ImportConfig(string configPath)
{
FileInfo fn = new FileInfo(configPath);
if (fn.Extension.Contains("uwuvci"))
{
FileStream inputConfigStream = new FileStream(configPath, FileMode.Open, FileAccess.Read);
GZipStream decompressedConfigStream = new GZipStream(inputConfigStream, CompressionMode.Decompress);
IFormatter formatter = new BinaryFormatter();
GameConfiguration = (GameConfig)formatter.Deserialize(decompressedConfigStream);
}
if(GameConfiguration.Console == GameConsoles.N64)
{
(thing as N64Config).getInfoFromConfig();
}
else
{
(thing as OtherConfigs).getInfoFromConfig();
}
}
public void ReadImagesIntoConfig()
{
ReadFileAsBin(GameConfiguration, GameConfiguration.TGAIco.ImgPath, 1);
ReadFileAsBin(GameConfiguration, GameConfiguration.TGADrc.ImgPath, 2);
ReadFileAsBin(GameConfiguration, GameConfiguration.TGATv.ImgPath, 3);
ReadFileAsBin(GameConfiguration, GameConfiguration.TGALog.ImgPath, 4);
}
public void ReadIniIntoConfig()
{
ReadFileAsBin(GameConfiguration, GameConfiguration.N64Stuff.INIPath, 5);
}
private void ReadFileAsBin(GameConfig file, string FilePath, int scase)
{
if(FilePath != null)
{
try
{
var filedata = new FileStream(FilePath, FileMode.Open);
var len = (int)filedata.Length;
switch (scase)
{
case 1:
file.TGAIco.ImgBin = new byte[len];
filedata.Read(file.TGAIco.ImgBin, 0, len);
break;
case 2:
file.TGADrc.ImgBin = new byte[len];
filedata.Read(file.TGADrc.ImgBin, 0, len);
break;
case 3:
file.TGATv.ImgBin = new byte[len];
filedata.Read(file.TGATv.ImgBin, 0, len);
break;
case 4:
file.TGALog.ImgBin = new byte[len];
filedata.Read(file.TGALog.ImgBin, 0, len);
break;
case 5:
file.N64Stuff.INIBin = new byte[len];
filedata.Read(file.N64Stuff.INIBin, 0, len);
break;
}
filedata.Close();
}
catch (Exception)
{
switch (scase)
{
case 1:
file.TGAIco.ImgBin = null;
break;
case 2:
file.TGADrc.ImgBin = null;
break;
case 3:
file.TGATv.ImgBin = null;
break;
case 4:
file.TGALog.ImgBin = null;
break;
case 5:
file.N64Stuff.INIBin = null;
break;
}
}
}
}
private static void CheckAndFixConfigFolder()
{
if (!Directory.Exists(@"configs"))
{
Directory.CreateDirectory(@"configs");
}
}
public void Pack(bool loadiine)
{
if (loadiine)
@ -319,6 +466,34 @@ namespace UWUVCI_AIO_WPF
Environment.Exit(0);
}
public bool GetConsoleOfConfig(string configPath, GameConsoles console)
{
FileInfo fn = new FileInfo(configPath);
if (fn.Extension.Contains("uwuvci"))
{
FileStream inputConfigStream = new FileStream(configPath, FileMode.Open, FileAccess.Read);
GZipStream decompressedConfigStream = new GZipStream(inputConfigStream, CompressionMode.Decompress);
IFormatter formatter = new BinaryFormatter();
GameConfig check = (GameConfig)formatter.Deserialize(decompressedConfigStream);
if (check.Console == console) return true;
}
return false;
}
public string selectConfig()
{
string ret = string.Empty;
using (var dialog = new System.Windows.Forms.OpenFileDialog())
{
dialog.Filter = "UWUVCI Config (*.uwuvci) | *.uwuvci";
DialogResult res = dialog.ShowDialog();
if (res == DialogResult.OK)
{
ret = dialog.FileName;
}
}
return ret;
}
public string GetFilePath(bool ROM, bool INI)
{

View file

@ -44,11 +44,23 @@ namespace UWUVCI_AIO_WPF.UI.Frames
private void Button_Click(object sender, RoutedEventArgs e)
{
//import config
string s = mvm.selectConfig();
if (s != null)
{
if (mvm.GetConsoleOfConfig(s, mvm.GameConfiguration.Console))
{
mvm.ImportConfig(s);
}
}
MessageBox.Show("Please re-select a base!");
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
//Export config
mvm.ExportFile();
}
private void Button_Click_2(object sender, RoutedEventArgs e)

View file

@ -60,6 +60,7 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Bases
if (cbCombo.SelectedIndex == 0)
{
fLoadFrame.Content = new CustomBaseFrame(mvm.LBases[cbCombo.SelectedIndex], console, insertedConfig);
}
else

View file

@ -10,7 +10,7 @@
Title="CustomBaseFrame">
<Grid DataContext="{StaticResource mvm}">
<TextBox materialDesign:HintAssist.Hint="BASE PATH" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="0,5,108,145" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" Text="{Binding GameConfiguration.CBasePath}" IsReadOnly="True" Focusable="False" />
<TextBox materialDesign:HintAssist.Hint="BASE PATH" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="0,5,108,145" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" Text="{Binding CBasePath}" IsReadOnly="True" Focusable="False" />
<Button Content="Set Path" HorizontalAlignment="Left" Margin="280,21,0,0" VerticalAlignment="Top" Width="103" Height="26" Click="Button_Click"/>
<TextBlock x:Name="tbCode" HorizontalAlignment="Center" Margin="10,84,10,0" TextWrapping="Wrap" Text="Code folder not found" VerticalAlignment="Top" TextAlignment="Center" Width="363" FontSize="20" Foreground="DarkRed"/>
<TextBlock x:Name="tbContent" HorizontalAlignment="Center" Margin="10,119,10,0" TextWrapping="Wrap" Text="Content folder not found" VerticalAlignment="Top" TextAlignment="Center" Width="363" FontSize="20" Foreground="DarkRed"/>

View file

@ -45,17 +45,7 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Bases
this.console = console;
mvm.SetCBASE(this);
}
private void CreateConfig(GameBases Base, GameConsoles console, bool existing)
{
if (!existing)
{
mvm.GameConfiguration = new GameConfig();
mvm.GameConfiguration.Console = console;
}
mvm.GameConfiguration.BaseRom = Base;
}
private void Button_Click(object sender, RoutedEventArgs e)
@ -67,8 +57,9 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Bases
tbMeta.Text = "Meta Folder not found";
tbMeta.Foreground = new SolidColorBrush(Color.FromRgb(205, 50, 50));
mvm.BaseDownloaded = false;
//warning if using custom bases programm may crash
DialogResult res = System.Windows.Forms.MessageBox.Show("If using Custom Bases there will be a chance that the programm crashes if adding a wrong base (example: a normal wiiu game instead of a nds vc game).\nIf you add a wrong base, we will not assist you fixing it, other than telling you to use another base.\nIf you agree to this please select Yes", "Custom base Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
mvm.CBasePath = null;
//warning if using custom bases programm may crash
DialogResult res = System.Windows.Forms.MessageBox.Show("If using Custom Bases there will be a chance that the programm crashes if adding a wrong base (example: a normal wiiu game instead of a nds vc game).\nIf you add a wrong base, we will not assist you fixing it, other than telling you to use another base.\nIf you agree to this please select Yes", "Custom base Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
if(res == DialogResult.Yes)
{ //get folder
using (var dialog = new System.Windows.Forms.FolderBrowserDialog())
@ -96,7 +87,6 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Bases
if (Directory.Exists(System.IO.Path.Combine(dialog.SelectedPath, "content")) && Directory.Exists(System.IO.Path.Combine(dialog.SelectedPath, "code")) && Directory.Exists(System.IO.Path.Combine(dialog.SelectedPath, "meta")))
{
//create new Game Config
mvm.GameConfiguration = new GameConfig();
mvm.GameConfiguration.Console = console;
mvm.GameConfiguration.CBasePath = dialog.SelectedPath;
GameBases gb = new GameBases();
@ -133,6 +123,7 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Bases
gb.Name = "Custom";
gb.Region = Regions.EU;
gb.Path = mvm.GameConfiguration.CBasePath;
mvm.CBasePath = mvm.GameConfiguration.CBasePath;
mvm.GameConfiguration.BaseRom = gb;
tbCode.Text = "Code Folder exists";
tbCode.Foreground = new SolidColorBrush(Color.FromRgb(50, 205, 50));

View file

@ -29,11 +29,9 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Bases
{
InitializeComponent();
mvm = (MainViewModel)FindResource("mvm");
if (!existing)
{
createConfig(Base, console);
}
this.Base = Base;
createConfig(Base, console);
checkStuff(mvm.getInfoOfBase(Base));
}
@ -45,7 +43,7 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Bases
}
private void createConfig(GameBases Base, GameConsoles console)
{
mvm.GameConfiguration = new GameConfig();
mvm.GameConfiguration.BaseRom = Base;
mvm.GameConfiguration.Console = console;

View file

@ -12,11 +12,11 @@
<Grid DataContext="{StaticResource mvm}">
<TextBox materialDesign:HintAssist.Hint="ROM PATH" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,8,157,355" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" IsReadOnly="True" Focusable="False" Text="{Binding RomPath}"/>
<TextBox materialDesign:HintAssist.Hint="ICONTEX" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,128,157,235" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" IsReadOnly="True" Focusable="False" Text="{Binding GameConfiguration.TGAIco.ImgPath}"/>
<TextBox materialDesign:HintAssist.Hint="BOOTDRCTEX" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,174,157,189" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" IsReadOnly="True" Focusable="False" Text="{Binding GameConfiguration.TGADrc.ImgPath}"/>
<TextBox materialDesign:HintAssist.Hint="BOOTTVTEX" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,219,157,144" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" IsReadOnly="True" Focusable="False" Text="{Binding GameConfiguration.TGATv.ImgPath}"/>
<TextBox materialDesign:HintAssist.Hint="BOOTLOGOTEX" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,264,157,99" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" IsReadOnly="True" Focusable="False" Text="{Binding GameConfiguration.TGALog.ImgPath}"/>
<TextBox materialDesign:HintAssist.Hint="GAME NAME" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,317,157,46" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" Text="{Binding GameConfiguration.GameName}"/>
<TextBox materialDesign:HintAssist.Hint="ICONTEX" Name="ic" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,128,157,235" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" IsReadOnly="True" Focusable="False" Text="{Binding GameConfiguration.TGAIco.ImgPath}"/>
<TextBox materialDesign:HintAssist.Hint="BOOTDRCTEX" Name="drc" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,174,157,189" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" IsReadOnly="True" Focusable="False" Text="{Binding GameConfiguration.TGADrc.ImgPath}"/>
<TextBox materialDesign:HintAssist.Hint="BOOTTVTEX" Name="tv" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,219,157,144" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" IsReadOnly="True" Focusable="False" Text="{Binding GameConfiguration.TGATv.ImgPath}"/>
<TextBox materialDesign:HintAssist.Hint="BOOTLOGOTEX" Name="log" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,264,157,99" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" IsReadOnly="True" Focusable="False" Text="{Binding GameConfiguration.TGALog.ImgPath}"/>
<TextBox materialDesign:HintAssist.Hint="GAME NAME" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,317,157,46" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" Text="{Binding GameConfiguration.GameName}" Name="gn"/>
<Button Content="Inject" HorizontalAlignment="Left" Margin="506,357,0,0" VerticalAlignment="Top" Width="127" Click="InjectGame" IsEnabled="{Binding CanInject}"/>
<Button Content="Set Path" HorizontalAlignment="Left" Margin="506,277,0,0" VerticalAlignment="Top" Width="127" Click="Set_LogoTex"/>
<Button Content="Set Path" HorizontalAlignment="Left" Margin="506,232,0,0" VerticalAlignment="Top" Width="127" Click="Set_TvTex"/>
@ -25,7 +25,7 @@
<Button Content="Set Path" HorizontalAlignment="Left" Margin="506,21,0,0" VerticalAlignment="Top" Width="127" Click="Set_Rom_Path"/>
<RadioButton x:Name="rbRDF" Content="Remove DarkFilter" HorizontalAlignment="Left" Margin="11,369,0,0" VerticalAlignment="Top" GroupName="df" IsChecked="{Binding GameConfiguration.N64Stuff.DarkFilter}"/>
<RadioButton Content="Keep DarkFilter" HorizontalAlignment="Left" Margin="151,369,0,0" VerticalAlignment="Top" GroupName="df" IsChecked="True"/>
<TextBox materialDesign:HintAssist.Hint="INI PATH (LEAVE EMPTY FOR BLANK INI)" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,58,157,305" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" IsReadOnly="True" Focusable="False" Text="{Binding GameConfiguration.N64Stuff.INIPath}"/>
<TextBox Name="ini" materialDesign:HintAssist.Hint="INI PATH (LEAVE EMPTY FOR BLANK INI)" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,58,157,305" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" IsReadOnly="True" Focusable="False" Text="{Binding GameConfiguration.N64Stuff.INIPath}"/>
<Button Content="Set Path" HorizontalAlignment="Left" Margin="506,72,0,0" VerticalAlignment="Top" Width="127" Click="Set_IniPath"/>
</Grid>
</Page>

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -27,9 +28,11 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
mvm = (MainViewModel)FindResource("mvm");
mvm.GameConfiguration.N64Stuff = new N64Conf();
InitializeComponent();
mvm.setThing(this);
}
private void Set_Rom_Path(object sender, RoutedEventArgs e)
{
string path = mvm.GetFilePath(true, false);
@ -50,13 +53,26 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
mvm.Inject();
}
public void getInfoFromConfig()
{
tv.Text = mvm.GameConfiguration.TGATv.ImgPath;
ic.Text = mvm.GameConfiguration.TGAIco.ImgPath;
drc.Text = mvm.GameConfiguration.TGADrc.ImgPath;
log.Text = mvm.GameConfiguration.TGALog.ImgPath;
gn.Text = mvm.GameConfiguration.GameName;
ini.Text = mvm.GameConfiguration.N64Stuff.INIPath;
}
private void Set_TvTex(object sender, RoutedEventArgs e)
{
mvm.ImageWarning();
string path = mvm.GetFilePath(false, false);
if (!CheckIfNull(path)) mvm.GameConfiguration.TGATv.ImgPath = path;
if (!CheckIfNull(path))
{
mvm.GameConfiguration.TGATv.ImgPath = path;
mvm.GameConfiguration.TGATv.extension = new FileInfo(path).Extension;
tv.Text = path;
}
}
@ -64,21 +80,37 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
{
mvm.ImageWarning();
string path = mvm.GetFilePath(false, false);
if (!CheckIfNull(path)) mvm.GameConfiguration.TGADrc.ImgPath = path;
if (!CheckIfNull(path))
{
mvm.GameConfiguration.TGADrc.ImgPath = path;
mvm.GameConfiguration.TGADrc.extension = new FileInfo(path).Extension;
drc.Text = path;
}
}
private void Set_IconTex(object sender, RoutedEventArgs e)
{
mvm.ImageWarning();
string path = mvm.GetFilePath(false, false);
if (!CheckIfNull(path)) mvm.GameConfiguration.TGAIco.ImgPath = path;
if (!CheckIfNull(path))
{
mvm.GameConfiguration.TGAIco.ImgPath = path;
mvm.GameConfiguration.TGAIco.extension = new FileInfo(path).Extension;
ic.Text = path;
}
}
private void Set_LogoTex(object sender, RoutedEventArgs e)
{
mvm.ImageWarning();
string path = mvm.GetFilePath(false, false);
if (!CheckIfNull(path)) mvm.GameConfiguration.TGALog.ImgPath = path;
if (!CheckIfNull(path))
{
mvm.GameConfiguration.TGALog.ImgPath = path;
mvm.GameConfiguration.TGALog.extension = new FileInfo(path).Extension;
log.Text = path;
}
}
private bool CheckIfNull(string s)
@ -93,7 +125,11 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
private void Set_IniPath(object sender, RoutedEventArgs e)
{
string path = mvm.GetFilePath(false, true);
if (!CheckIfNull(path)) mvm.GameConfiguration.N64Stuff.INIPath = path;
if (!CheckIfNull(path))
{
mvm.GameConfiguration.N64Stuff.INIPath = path;
ini.Text = path;
}
}
}
}

View file

@ -12,11 +12,11 @@
<Grid DataContext="{StaticResource mvm}">
<TextBox materialDesign:HintAssist.Hint="ROM PATH" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,38,157,325" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" IsReadOnly="True" Focusable="False" Text="{Binding RomPath}"/>
<TextBox materialDesign:HintAssist.Hint="ICONTEX" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,111,157,252" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" IsReadOnly="True" Focusable="False" Text="{Binding GameConfiguration.TGAIco.ImgPath}"/>
<TextBox materialDesign:HintAssist.Hint="BOOTDRCTEX" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,157,157,206" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" IsReadOnly="True" Focusable="False" Text="{Binding GameConfiguration.TGADrc.ImgPath}"/>
<TextBox materialDesign:HintAssist.Hint="BOOTTVTEX" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,202,157,161" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" IsReadOnly="True" Focusable="False" Text="{Binding GameConfiguration.TGATv.ImgPath}"/>
<TextBox materialDesign:HintAssist.Hint="BOOTLOGOTEX" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,247,157,116" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" IsReadOnly="True" Focusable="False" Text="{Binding GameConfiguration.TGALog.ImgPath}"/>
<TextBox materialDesign:HintAssist.Hint="GAME NAME" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,316,157,47" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" Text="{Binding GameConfiguration.GameName}"/>
<TextBox materialDesign:HintAssist.Hint="ICONTEX" Name="ic" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,111,157,252" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" IsReadOnly="True" Focusable="False" Text="{Binding GameConfiguration.TGAIco.ImgPath}"/>
<TextBox materialDesign:HintAssist.Hint="BOOTDRCTEX" Name="drc" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,157,157,206" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" IsReadOnly="True" Focusable="False" Text="{Binding GameConfiguration.TGADrc.ImgPath}"/>
<TextBox materialDesign:HintAssist.Hint="BOOTTVTEX" Name="tv" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,202,157,161" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" IsReadOnly="True" Focusable="False" Text="{Binding GameConfiguration.TGATv.ImgPath}"/>
<TextBox materialDesign:HintAssist.Hint="BOOTLOGOTEX" Name="log" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,247,157,116" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" IsReadOnly="True" Focusable="False" Text="{Binding GameConfiguration.TGALog.ImgPath}"/>
<TextBox materialDesign:HintAssist.Hint="GAME NAME" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,316,157,47" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" Text="{Binding GameConfiguration.GameName}" Name="gn"/>
<Button Content="Inject" HorizontalAlignment="Left" Margin="506,340,0,0" VerticalAlignment="Top" Width="127" IsEnabled="{Binding CanInject}" Click="InjectGame"/>
<Button Content="Set Path" HorizontalAlignment="Left" Margin="506,260,0,0" VerticalAlignment="Top" Width="127" Click="Set_LogoTex"/>
<Button Content="Set Path" HorizontalAlignment="Left" Margin="506,215,0,0" VerticalAlignment="Top" Width="127" Click="Set_TvTex"/>

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -26,6 +27,7 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
{
InitializeComponent();
mvm = FindResource("mvm") as MainViewModel;
mvm.setThing(this);
}
public void Dispose()
{
@ -56,8 +58,12 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
{
mvm.ImageWarning();
string path = mvm.GetFilePath(false, false);
if (!CheckIfNull(path)) mvm.GameConfiguration.TGATv.ImgPath = path;
if (!CheckIfNull(path))
{
mvm.GameConfiguration.TGATv.ImgPath = path;
mvm.GameConfiguration.TGATv.extension = new FileInfo(path).Extension;
tv.Text = path;
}
}
@ -65,23 +71,45 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
{
mvm.ImageWarning();
string path = mvm.GetFilePath(false, false);
if (!CheckIfNull(path)) mvm.GameConfiguration.TGADrc.ImgPath = path;
}
if (!CheckIfNull(path))
{
mvm.GameConfiguration.TGADrc.ImgPath = path;
mvm.GameConfiguration.TGADrc.extension = new FileInfo(path).Extension;
drc.Text = path;
}
}
private void Set_IconTex(object sender, RoutedEventArgs e)
{
mvm.ImageWarning();
string path = mvm.GetFilePath(false, false);
if (!CheckIfNull(path)) mvm.GameConfiguration.TGAIco.ImgPath = path;
if (!CheckIfNull(path)) {
mvm.GameConfiguration.TGAIco.ImgPath = path;
mvm.GameConfiguration.TGAIco.extension = new FileInfo(path).Extension;
ic.Text = path;
}
}
private void Set_LogoTex(object sender, RoutedEventArgs e)
{
mvm.ImageWarning();
string path = mvm.GetFilePath(false, false);
if (!CheckIfNull(path)) mvm.GameConfiguration.TGALog.ImgPath = path;
if (!CheckIfNull(path)) {
mvm.GameConfiguration.TGALog.ImgPath = path;
mvm.GameConfiguration.TGALog.extension = new FileInfo(path).Extension;
log.Text = path;
}
}
public void getInfoFromConfig()
{
tv.Text = mvm.GameConfiguration.TGATv.ImgPath;
ic.Text = mvm.GameConfiguration.TGAIco.ImgPath;
drc.Text = mvm.GameConfiguration.TGADrc.ImgPath;
log.Text = mvm.GameConfiguration.TGALog.ImgPath;
gn.Text = mvm.GameConfiguration.GameName;
}
private bool CheckIfNull(string s)
{
if(s == null || s.Equals(string.Empty))

View file

@ -69,6 +69,8 @@ namespace UWUVCI_AIO_WPF
mvm.RomSet = false;
mvm.RomPath = null;
mvm.Injected = false;
mvm.CBasePath = null;
mvm.setThing(null);
switch ((sender as ListView).SelectedIndex)
{
case 0: