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 namespace UWUVCI_AIO_WPF
{ {
[Serializable] [Serializable]
class GameConfig : BaseModel class GameConfig
{ {
public GameConsoles Console { get; set; } public GameConsoles Console { get; set; }
public GameBases BaseRom { get; set; } public GameBases BaseRom { get; set; }
@ -20,7 +20,7 @@ namespace UWUVCI_AIO_WPF
{ {
get { return cBasePath; } get { return cBasePath; }
set { cBasePath = value; set { cBasePath = value;
OnPropertyChanged();
} }
} }

View file

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

View file

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

View file

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

View file

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

View file

@ -3,15 +3,20 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Configuration; using System.Configuration;
using System.IO; using System.IO;
using System.IO.Compression;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Forms; using System.Windows.Forms;
using UWUVCI_AIO_WPF.Classes; using UWUVCI_AIO_WPF.Classes;
using UWUVCI_AIO_WPF.Properties; using UWUVCI_AIO_WPF.Properties;
using UWUVCI_AIO_WPF.UI; using UWUVCI_AIO_WPF.UI;
using UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Bases; using UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Bases;
using UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations;
using UWUVCI_AIO_WPF.UI.Windows; using UWUVCI_AIO_WPF.UI.Windows;
namespace UWUVCI_AIO_WPF namespace UWUVCI_AIO_WPF
@ -21,7 +26,7 @@ namespace UWUVCI_AIO_WPF
//public GameConfig GameConfiguration { get; set; } //public GameConfig GameConfiguration { get; set; }
private GameConfig gameConfiguration = new GameConfig(); private GameConfig gameConfiguration = new GameConfig();
public GameConfig GameConfiguration public GameConfig GameConfiguration
{ {
get { return 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 int OldIndex { get; set; }
public bool RomSet { get; set; } public bool RomSet { get; set; }
@ -144,7 +157,7 @@ namespace UWUVCI_AIO_WPF
} }
private List<GameBases> lNES = new List<GameBases>(); private List<GameBases> lNES = new List<GameBases>();
public List<GameBases> LNES public List<GameBases> LNES
{ {
get { return 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 MainWindow mw;
private CustomBaseFrame cb = null; private CustomBaseFrame cb = null;
@ -207,9 +234,9 @@ namespace UWUVCI_AIO_WPF
{ {
toolCheck(); toolCheck();
BaseCheck(); BaseCheck();
GameConfiguration = new GameConfig(); 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); 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() public void resetCBASE()
{ {
if(cb != null) cb.Reset(); if (cb != null) cb.Reset();
} }
public void removeCBASE() public void removeCBASE()
{ {
cb = null; cb = null;
} }
public void setThing(Page T)
{
Thing = T;
}
public void SetCBASE(CustomBaseFrame cbs) public void SetCBASE(CustomBaseFrame cbs)
{ {
cb = cbs; cb = cbs;
@ -233,6 +264,122 @@ namespace UWUVCI_AIO_WPF
{ {
mw = mwi; 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) public void Pack(bool loadiine)
{ {
if (loadiine) if (loadiine)
@ -319,6 +466,34 @@ namespace UWUVCI_AIO_WPF
Environment.Exit(0); 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) 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) private void Button_Click(object sender, RoutedEventArgs e)
{ {
//import config //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) private void Button_Click_1(object sender, RoutedEventArgs e)
{ {
//Export config //Export config
mvm.ExportFile();
} }
private void Button_Click_2(object sender, RoutedEventArgs e) 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) if (cbCombo.SelectedIndex == 0)
{ {
fLoadFrame.Content = new CustomBaseFrame(mvm.LBases[cbCombo.SelectedIndex], console, insertedConfig); fLoadFrame.Content = new CustomBaseFrame(mvm.LBases[cbCombo.SelectedIndex], console, insertedConfig);
} }
else else

View file

@ -10,7 +10,7 @@
Title="CustomBaseFrame"> Title="CustomBaseFrame">
<Grid DataContext="{StaticResource mvm}"> <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"/> <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="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"/> <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; this.console = console;
mvm.SetCBASE(this); 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) 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.Text = "Meta Folder not found";
tbMeta.Foreground = new SolidColorBrush(Color.FromRgb(205, 50, 50)); tbMeta.Foreground = new SolidColorBrush(Color.FromRgb(205, 50, 50));
mvm.BaseDownloaded = false; mvm.BaseDownloaded = false;
//warning if using custom bases programm may crash mvm.CBasePath = null;
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); //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) if(res == DialogResult.Yes)
{ //get folder { //get folder
using (var dialog = new System.Windows.Forms.FolderBrowserDialog()) 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"))) 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 //create new Game Config
mvm.GameConfiguration = new GameConfig();
mvm.GameConfiguration.Console = console; mvm.GameConfiguration.Console = console;
mvm.GameConfiguration.CBasePath = dialog.SelectedPath; mvm.GameConfiguration.CBasePath = dialog.SelectedPath;
GameBases gb = new GameBases(); GameBases gb = new GameBases();
@ -133,6 +123,7 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Bases
gb.Name = "Custom"; gb.Name = "Custom";
gb.Region = Regions.EU; gb.Region = Regions.EU;
gb.Path = mvm.GameConfiguration.CBasePath; gb.Path = mvm.GameConfiguration.CBasePath;
mvm.CBasePath = mvm.GameConfiguration.CBasePath;
mvm.GameConfiguration.BaseRom = gb; mvm.GameConfiguration.BaseRom = gb;
tbCode.Text = "Code Folder exists"; tbCode.Text = "Code Folder exists";
tbCode.Foreground = new SolidColorBrush(Color.FromRgb(50, 205, 50)); tbCode.Foreground = new SolidColorBrush(Color.FromRgb(50, 205, 50));

View file

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

View file

@ -12,11 +12,11 @@
<Grid DataContext="{StaticResource mvm}"> <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="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="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" 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="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" 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="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" 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="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}"/> <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="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,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"/> <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"/> <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 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"/> <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"/> <Button Content="Set Path" HorizontalAlignment="Left" Margin="506,72,0,0" VerticalAlignment="Top" Width="127" Click="Set_IniPath"/>
</Grid> </Grid>
</Page> </Page>

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -27,9 +28,11 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
mvm = (MainViewModel)FindResource("mvm"); mvm = (MainViewModel)FindResource("mvm");
mvm.GameConfiguration.N64Stuff = new N64Conf(); mvm.GameConfiguration.N64Stuff = new N64Conf();
InitializeComponent(); InitializeComponent();
mvm.setThing(this);
} }
private void Set_Rom_Path(object sender, RoutedEventArgs e) private void Set_Rom_Path(object sender, RoutedEventArgs e)
{ {
string path = mvm.GetFilePath(true, false); string path = mvm.GetFilePath(true, false);
@ -50,13 +53,26 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
mvm.Inject(); 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) private void Set_TvTex(object sender, RoutedEventArgs e)
{ {
mvm.ImageWarning(); mvm.ImageWarning();
string path = mvm.GetFilePath(false, false); 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(); mvm.ImageWarning();
string path = mvm.GetFilePath(false, false); 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) private void Set_IconTex(object sender, RoutedEventArgs e)
{ {
mvm.ImageWarning(); mvm.ImageWarning();
string path = mvm.GetFilePath(false, false); 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) private void Set_LogoTex(object sender, RoutedEventArgs e)
{ {
mvm.ImageWarning(); mvm.ImageWarning();
string path = mvm.GetFilePath(false, false); 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) 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) private void Set_IniPath(object sender, RoutedEventArgs e)
{ {
string path = mvm.GetFilePath(false, true); 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}"> <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="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="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" 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="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" 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="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" 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="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}"/> <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="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,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"/> <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;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -26,6 +27,7 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
{ {
InitializeComponent(); InitializeComponent();
mvm = FindResource("mvm") as MainViewModel; mvm = FindResource("mvm") as MainViewModel;
mvm.setThing(this);
} }
public void Dispose() public void Dispose()
{ {
@ -56,8 +58,12 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
{ {
mvm.ImageWarning(); mvm.ImageWarning();
string path = mvm.GetFilePath(false, false); 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(); mvm.ImageWarning();
string path = mvm.GetFilePath(false, false); 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) private void Set_IconTex(object sender, RoutedEventArgs e)
{ {
mvm.ImageWarning(); mvm.ImageWarning();
string path = mvm.GetFilePath(false, false); 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) private void Set_LogoTex(object sender, RoutedEventArgs e)
{ {
mvm.ImageWarning(); mvm.ImageWarning();
string path = mvm.GetFilePath(false, false); 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) private bool CheckIfNull(string s)
{ {
if(s == null || s.Equals(string.Empty)) if(s == null || s.Equals(string.Empty))

View file

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