changed wii menu

This commit is contained in:
NicoAICP 2020-06-09 22:02:38 +02:00
parent 64703798e4
commit 27c46bf514
6 changed files with 381 additions and 10 deletions

View file

@ -25,11 +25,11 @@
<TextBox Name="gc2" materialDesign:HintAssist.Hint="GAMECUBE DISC 2 (LEAVE BLANK IF NONE)" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,120,157,345" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" IsReadOnly="True" Focusable="False" Text="{Binding gc2rom}" Height="45"/>
<Button Content="Select File" HorizontalAlignment="Left" Margin="506,133,0,0" VerticalAlignment="Top" Width="127" Click="Button_Click"/>
<StackPanel Margin="10,20,211,436" Orientation="Horizontal" >
<StackPanel Margin="10,20,48,436" Orientation="Horizontal" >
<Label Content="Config:" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="14" Width="90"/>
<CheckBox Content="Force 4:3" HorizontalAlignment="Left" Margin="0,5,0,0" VerticalAlignment="Top" Width="98" Click="CheckBox_Click" ToolTip="If checked Games will run in 4:3 instead of 16:9"/>
<CheckBox Content="Disable GamePad" HorizontalAlignment="Left" Margin="0,5,0,0" VerticalAlignment="Top" Width="143" Click="CheckBox_Click_1" ToolTip="If checked the GamePad will not be used as a controller" Name="gp"/>
<CheckBox Content="Disable GamePad" HorizontalAlignment="Left" Margin="0,5,0,0" VerticalAlignment="Top" Width="306" Click="CheckBox_Click_1" ToolTip="If checked the GamePad will not be used as a controller" Name="gp"/>
<CheckBox Content="Disable Trim" Margin="0,5,0,31" Name="trimn" Click="trimn_Click" IsEnabled="False"/>
</StackPanel>
<TextBox materialDesign:HintAssist.Hint="BOOTSOUND (OPTIONAL)" ToolTip="Needs to be a RIFF WAVE file 48000khz and 16bit stereo." x:Name="sound" Text="{Binding BootSound}" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,365,157,101" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" IsReadOnly="True" Focusable="False" Cursor="Help" TextChanged="sound_TextChanged"/>

View file

@ -39,11 +39,11 @@
<Button Content="?" HorizontalAlignment="Left" Margin="600,19,0,0" Height="32" VerticalAlignment="Top" Width="33" Background="#FF2196F3" BorderBrush="#FF2196F3" Foreground="White" Click="Button_Click_1" FontSize="22" Padding="0" />
<StackPanel Height="30" Margin="150,20,97,460" Orientation="Horizontal" Name="Extra" Visibility="Hidden">
<CheckBox Content="JP Patch" x:Name="jppatch" ToolTip="Allows playing JP Wii Games on non JP Consoles" Click="jppatch_Click" RenderTransformOrigin="-1.389,-3.87" Margin="0,6,16,6" Height="18" Width="72"/>
<CheckBox Content="Disable Trim" Margin="0,7,0,5" x:Name="trimn" Click="trimn_Click" IsEnabled="False" Width="107"/>
<CheckBox Content="Disable WiiMote Passthrough" Margin="0,7,0,5" x:Name="motepass" IsEnabled="False" Width="182" Visibility="Hidden" Checked="motepass_Checked" Unchecked="motepass_Unchecked"/>
<CheckBox Content="Disable WiiMote Passthrough" Margin="0,7,0,5" x:Name="motepass" IsEnabled="False" Width="182" Checked="motepass_Checked" Unchecked="motepass_Unchecked"/>
</StackPanel>
<StackPanel Height="30" Margin="150,19,213,461" Orientation="Horizontal" Name="VideoMode" Visibility="Hidden">
<CheckBox Content="Disable Trim" Margin="505,22,31,464" x:Name="trimn" Click="trimn_Click" IsEnabled="False" Width="107"/>
<StackPanel Height="30" Margin="150,19,213,461" Orientation="Horizontal" Name="VideoMode" >
<RadioButton x:Name="vmcsmoll" Content="None" HorizontalAlignment="Left" VerticalAlignment="Top" GroupName="VMC" IsChecked="True" Click="RadioButton_Click_2" Width="77" Margin="0,6,0,0"/>
<RadioButton x:Name="ntsc" Content="NTSC To PAL" HorizontalAlignment="Left" VerticalAlignment="Top" GroupName="VMC" Click="RadioButton_Click" Width="111" ToolTip="May not work with every Game" Margin="0,6,0,0"/>
<RadioButton x:Name="pal" Content="PAL To NTSC" HorizontalAlignment="Left" VerticalAlignment="Top" GroupName="VMC" Click="RadioButton_Click_1" Width="110" ToolTip="May not work with every Game" Margin="0,6,0,0"/>

View file

@ -48,7 +48,7 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
selection.Add("Region Patches");
selection.Add("Extras");
selectionDB.ItemsSource = selection;
selectionDB.SelectedIndex = 2;
selectionDB.SelectedIndex = 0;
}
public WiiConfig(GameConfig c)
{
@ -73,7 +73,7 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
selection.Add("Region Patches");
selection.Add("Extras");
selectionDB.ItemsSource = selection;
selectionDB.SelectedIndex = 2;
selectionDB.SelectedIndex = 0;
}
public void Dispose()
{
@ -118,7 +118,7 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
if (isok)
{
motepass.Visibility = Visibility.Hidden;
motepass.IsEnabled = false;
motepass.IsChecked = false;
mvm.NKITFLAG = false;
trimn.IsEnabled = false;
@ -179,13 +179,14 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
RF_tn.IsEnabled = false;
RF_tp.IsEnabled = false;
jppatch.IsEnabled = false;
motepass.Visibility = Visibility.Visible;
motepass.IsChecked = false;
motepass.IsEnabled = true;
mvm.donttrim = false;
}
else
{
motepass.IsChecked = false;
motepass.IsEnabled = false;
trimn.IsEnabled = true;
}

View file

@ -0,0 +1,46 @@
<Window x:Class="UWUVCI_AIO_WPF.UI.Windows.asd"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:UWUVCI_AIO_WPF"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
Title="ImageCreator" Height="200" Width="435" Foreground="White" Background="LightGray" ResizeMode="NoResize" Icon="/UWUVCI AIO WPF;component/b.ico" Name="wind" SizeToContent="WidthAndHeight" BorderBrush="#FF2196F3" BorderThickness="1.5,1.5,1.5,1.5" ShowInTaskbar="False" WindowStyle="None" Loaded="wind_Loaded" WindowStartupLocation="CenterOwner" MaxHeight="200">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="160"/>
<ColumnDefinition Width="275"/>
</Grid.ColumnDefinitions>
<Label Margin="0,0,353,0"></Label>
<Label Height="9" Margin="0,0,353,0"></Label>
<Label Margin="0,0,353,0"></Label>
<Image HorizontalAlignment="Left" Height="128" VerticalAlignment="Top" Width="128" Name="Image" Margin="18,49,0,0"/>
<Button Content="Select File" Grid.Column="1" HorizontalAlignment="Left" Margin="160,19,0,0" VerticalAlignment="Top" Width="99" Name="FileSelect" Click="FileSelect_Click" TabIndex="1" />
<Label Content="Overlay:" Grid.Column="1" HorizontalAlignment="Left" Margin="15,83,0,0" VerticalAlignment="Top"/>
<RadioButton Content="Enabled" Grid.Column="1" HorizontalAlignment="Left" Margin="100,87,0,0" VerticalAlignment="Top" Foreground="Black" GroupName="ov" Name="enOv" Click="enOv_Click" IsChecked="True" TabIndex="2"/>
<RadioButton Content="Disabled" Grid.Column="1" HorizontalAlignment="Left" Margin="189,87,0,0" VerticalAlignment="Top" Foreground="Black" GroupName="ov" Click="enOv_Click" TabIndex="3"/>
<Button Content="Cancel" Grid.Column="1" HorizontalAlignment="Left" Margin="160,145,0,0" Width="99" Click="Button_Click" Height="32" VerticalAlignment="Top" TabIndex="5"/>
<Button Content="Finish" Grid.Column="1" HorizontalAlignment="Left" Margin="15,145,0,0" VerticalAlignment="Top" Width="99" Name="Finish" Click="Finish_Click" TabIndex="4"/>
<Border BorderThickness="1.5,1.5,1.5,1.5" BorderBrush="#FF2196F3" HorizontalAlignment="Left" Height="129" VerticalAlignment="Top" Width="129" Margin="18,48,0,0">
</Border>
<StackPanel HorizontalAlignment="Left" Height="32" Margin="14,327,0,0" VerticalAlignment="Top" Width="481" Orientation="Horizontal" Name="snesonly" Visibility="Hidden">
<Label Content="Style:" Width="50" Margin="0,4,0,-4"></Label>
<RadioButton Content="SNES - PAL" GroupName="snes" Name="pal" IsChecked="True" Click="pal_Click" Foreground="Black" Width="100" Margin="0,6,0,-6"/>
<RadioButton Content="SNES - NTSC" GroupName="snes" Click="pal_Click" Foreground="Black" Margin="0,6,0,-6" Width="107" />
<RadioButton Content="Super Famicom" GroupName="snes" Click="RadioButton_Click" Foreground="Black" Margin="0,6,0,-6"/>
<ComboBox Margin="0,2" Width="169" Name="combo" SelectionChanged="combo_SelectionChanged" Foreground="Black" Visibility="Hidden" ></ComboBox>
</StackPanel>
<Label Content=" bootTvTex" x:Name="imageName" Margin="14,25,14,148"/>
</Grid>
</Window>

View file

@ -0,0 +1,317 @@
using GameBaseClassLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.ComTypes;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using UWUVCI_AIO_WPF.Classes;
namespace UWUVCI_AIO_WPF.UI.Windows
{
/// <summary>
/// Interaktionslogik für ImageCreator.xaml
/// </summary>
public partial class asd : Window, IDisposable
{
private static readonly string tempPath = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "bin", "temp");
private static readonly string toolsPath = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "bin", "Tools");
MenuIconImage bi = new MenuIconImage();
Bitmap b;
string console = "other";
bool drc = false;
public asd()
{
InitializeComponent();
imageName.Content = "iconTex";
SetTemplate();
}
public asd(string name)
{
InitializeComponent();
console = name;
imageName.Content = "iconTex";
SetTemplate();
}
private void SetTemplate()
{
if(console == "WII")
{
bi.Frame = new Bitmap(Properties.Resources.WiiIcon);
}
else
{
bi.Frame = new Bitmap(Properties.Resources.Icon);
}
}
private void Button_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
private void FileSelect_Click(object sender, RoutedEventArgs e)
{
string file = "";
MainViewModel mvm = FindResource("mvm") as MainViewModel;
file = mvm.GetFilePath(false, false);
if(!string.IsNullOrEmpty(file))
{
string copy = "";
if (new FileInfo(file).Extension.Contains("tga"))
{
using (Process conv = new Process())
{
conv.StartInfo.UseShellExecute = false;
conv.StartInfo.CreateNoWindow = true;
if (Directory.Exists(System.IO.Path.Combine(tempPath, "image")))
{
Directory.Delete(System.IO.Path.Combine(tempPath, "image"), true);
}
Directory.CreateDirectory(System.IO.Path.Combine(tempPath, "image"));
conv.StartInfo.FileName = System.IO.Path.Combine(toolsPath, "tga2png.exe");
conv.StartInfo.Arguments = $"-i \"{file}\" -o \"{System.IO.Path.Combine(tempPath, "image")}\"";
conv.Start();
conv.WaitForExit();
foreach (string sFile in Directory.GetFiles(System.IO.Path.Combine(tempPath, "image"), "*.png"))
{
copy = sFile;
}
}
}
else
{
copy = file;
}
bi.TitleScreen = new Bitmap(copy);
b = bi.Create(console);
Image.Source = BitmapToImageSource(b);
}
}
private void Finish_Click(object sender, RoutedEventArgs e)
{
if (!Directory.Exists(@"bin\createdIMG"))
{
Directory.CreateDirectory(@"bin\createdIMG");
}
if(File.Exists(System.IO.Path.Combine(@"bin\createdIMG", imageName.Content + ".png")))
{
File.Delete(System.IO.Path.Combine(@"bin\createdIMG", imageName.Content + ".png"));
}
if (drc)
{
b = ResizeImage(b, 854, 480);
}
b.Save(System.IO.Path.Combine(@"bin\createdIMG", imageName.Content + ".png"));
this.Close();
}
private void TextBox_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
{
}
private void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
e.Handled = !IsTextAllowed(e.Text);
}
private static readonly Regex _regex = new Regex("[^0-9]+"); //regex that matches disallowed text
private static bool IsTextAllowed(string text)
{
return !_regex.IsMatch(text);
}
private void TextBoxPasting(object sender, DataObjectPastingEventArgs e)
{
if (e.DataObject.GetDataPresent(typeof(String)))
{
String text = (String)e.DataObject.GetData(typeof(String));
if (!IsTextAllowed(text))
{
e.CancelCommand();
}
}
else
{
e.CancelCommand();
}
}
private void wind_Loaded(object sender, RoutedEventArgs e)
{
b = bi.Create(console);
Image.Source = BitmapToImageSource(b);
}
BitmapImage BitmapToImageSource(Bitmap bitmap)
{
using (MemoryStream memory = new MemoryStream())
{
bitmap.Save(memory, System.Drawing.Imaging.ImageFormat.Bmp);
memory.Position = 0;
BitmapImage bitmapimage = new BitmapImage();
bitmapimage.BeginInit();
bitmapimage.StreamSource = memory;
bitmapimage.CacheOption = BitmapCacheOption.OnLoad;
bitmapimage.EndInit();
return bitmapimage;
}
}
private void enOv_Click(object sender, RoutedEventArgs e)
{
if(enOv.IsChecked == true)
{
b = bi.Create(console);
Image.Source = BitmapToImageSource(b);
}
else
{
if(bi.TitleScreen != null)
{
b = ResizeImage(bi.TitleScreen, 128, 128); Image.Source = BitmapToImageSource(b);
}
else
{
b = new Bitmap(1280, 720);
using (Graphics gfx = Graphics.FromImage(b))
using (SolidBrush brush = new SolidBrush(System.Drawing.Color.FromArgb(0, 0, 0)))
{
gfx.FillRectangle(brush, 0, 0, 128, 128);
}
Image.Source = BitmapToImageSource(b);
}
}
}
public static Bitmap ResizeImage(System.Drawing.Image image, int width, int height)
{
var destRect = new System.Drawing.Rectangle(0, 0, width, height);
var destImage = new Bitmap(width, height);
destImage.SetResolution(image.HorizontalResolution, image.VerticalResolution);
using (var graphics = Graphics.FromImage(destImage))
{
graphics.CompositingMode = CompositingMode.SourceCopy;
graphics.CompositingQuality = CompositingQuality.HighQuality;
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphics.SmoothingMode = SmoothingMode.HighQuality;
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
using (var wrapMode = new ImageAttributes())
{
wrapMode.SetWrapMode(WrapMode.TileFlipXY);
graphics.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, wrapMode);
}
}
return destImage;
}
void DrawImage()
{
b = bi.Create(console);
Image.Source = BitmapToImageSource(b);
}
private void Players_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
{
}
private void Players_TextChanged(object sender, TextChangedEventArgs e)
{
DrawImage();
}
public void Dispose()
{
}
private void combo_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (combo.SelectedIndex == 0)
{
bi.Frame = Properties.Resources.SNES_PAL;
}
else if(combo.SelectedIndex == 1)
{
bi.Frame = Properties.Resources.SNES_USA;
}
else
{
bi.Frame = Properties.Resources.SFAM;
}
b = bi.Create(console);
Image.Source = BitmapToImageSource(b);
}
private void pal_Click(object sender, RoutedEventArgs e)
{
if(pal.IsChecked == true)
{
bi.Frame = Properties.Resources.SNES_PAL;
}
else
{
bi.Frame = Properties.Resources.SNES_USA;
}
b = bi.Create(console);
Image.Source = BitmapToImageSource(b);
}
private void RadioButton_Click(object sender, RoutedEventArgs e)
{
bi.Frame = Properties.Resources.SFAM;
b = bi.Create(console);
Image.Source = BitmapToImageSource(b);
}
private void PLDi_Click(object sender, RoutedEventArgs e)
{
DrawImage();
}
private void RLEn_Click(object sender, RoutedEventArgs e)
{
DrawImage();
}
}
}

View file

@ -150,6 +150,9 @@
<Compile Include="UI\Windows\EnterKey.xaml.cs">
<DependentUpon>EnterKey.xaml</DependentUpon>
</Compile>
<Compile Include="UI\Windows\ImageCreator - Kopieren - Kopieren %282%29.xaml.cs">
<DependentUpon>ImageCreator - Kopieren - Kopieren %282%29.xaml</DependentUpon>
</Compile>
<Compile Include="UI\Windows\ImageCreator - Kopieren.xaml.cs">
<DependentUpon>ImageCreator - Kopieren.xaml</DependentUpon>
</Compile>
@ -254,6 +257,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UI\Windows\ImageCreator - Kopieren - Kopieren %282%29.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="UI\Windows\ImageCreator - Kopieren.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>