mirror of
https://github.com/stuff-by-3-random-dudes/UWUVCI-AIO-WPF
synced 2024-11-10 13:44:13 +00:00
added langauge patch (JP Patch) that japanese wii games work on non japanese consoles
This commit is contained in:
parent
bdafec4442
commit
5ea0d2028c
6 changed files with 103 additions and 11 deletions
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
|
@ -19,7 +20,42 @@ namespace UWUVCI_AIO_WPF
|
|||
Timer t = new Timer(5000);
|
||||
private void Application_Startup(object sender, StartupEventArgs e)
|
||||
{
|
||||
|
||||
|
||||
if (Directory.Exists(@"custom"))
|
||||
{
|
||||
if (File.Exists(@"custom\main.dol"))
|
||||
{
|
||||
if (File.Exists(@"bin\Tools\nintendont.dol"))
|
||||
{
|
||||
File.Delete(@"bin\Tools\nintendont.dol");
|
||||
File.Copy(@"custom\main.dol", @"bin\Tools\nintendont.dol");
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!Directory.Exists(@"bin"))
|
||||
{
|
||||
Directory.CreateDirectory(@"bin");
|
||||
}
|
||||
else if(!Directory.Exists(@"bin\Tools"))
|
||||
{
|
||||
Directory.CreateDirectory(@"bin\Tools");
|
||||
}
|
||||
File.Copy(@"custom\main.dol", @"bin\Tools\nintendont.dol");
|
||||
}
|
||||
|
||||
if (File.Exists(@"bin\Tools\nintendont_force.dol"))
|
||||
{
|
||||
File.Delete(@"bin\Tools\nintendont_force.dol");
|
||||
File.Copy(@"custom\main.dol", @"bin\Tools\nintendont_force.dol");
|
||||
}
|
||||
else
|
||||
{
|
||||
File.Copy(@"custom\main.dol", @"bin\Tools\nintendont_force.dol");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Process[] pname = Process.GetProcessesByName("UWUVCI AIO");
|
||||
if (pname.Length > 1)
|
||||
{
|
||||
|
|
|
@ -7,24 +7,40 @@ using System.IO;
|
|||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Threading;
|
||||
using System.Xml;
|
||||
using UWUVCI_AIO_WPF.Classes;
|
||||
using UWUVCI_AIO_WPF.Properties;
|
||||
using UWUVCI_AIO_WPF.UI.Windows;
|
||||
using MessageBox = System.Windows.MessageBox;
|
||||
|
||||
namespace UWUVCI_AIO_WPF
|
||||
{
|
||||
|
||||
|
||||
internal static class Injection
|
||||
{
|
||||
|
||||
|
||||
[DllImport("User32.dll")]
|
||||
static extern int SetForegroundWindow(IntPtr point);
|
||||
[DllImport("user32.dll")]
|
||||
public static extern int SendMessage(
|
||||
int hWnd, // handle to destination window
|
||||
uint Msg, // message
|
||||
long wParam, // first message parameter
|
||||
long lParam // second message parameter
|
||||
);
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
[DllImport("user32.dll", SetLastError = true)]
|
||||
static extern bool PostMessage(IntPtr hWnd, int Msg, System.Windows.Forms.Keys wParam, int lParam);
|
||||
private static Int32 WM_KEYDOWN = 0x100; private static Int32 WM_KEYUP = 0x101;
|
||||
private static readonly string tempPath = Path.Combine(Directory.GetCurrentDirectory(),"bin", "temp");
|
||||
private static readonly string baseRomPath = Path.Combine(tempPath, "baserom");
|
||||
private static readonly string imgPath = Path.Combine(tempPath, "img");
|
||||
|
@ -132,6 +148,7 @@ namespace UWUVCI_AIO_WPF
|
|||
[STAThread]
|
||||
public static bool Inject(GameConfig Configuration, string RomPath, MainViewModel mvm, bool force)
|
||||
{
|
||||
|
||||
Clean();
|
||||
long gamesize = new FileInfo(RomPath).Length;
|
||||
var drive = new DriveInfo(tempPath);
|
||||
|
@ -218,7 +235,7 @@ namespace UWUVCI_AIO_WPF
|
|||
|
||||
code = null;
|
||||
if (e.Message.Contains("Images")){
|
||||
|
||||
|
||||
MessageBox.Show("Injection Failed due to wrong BitDepth, please check if your Files are in a different bitdepth than 32bit or 24bit", "Injection Failed", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
else if (e.Message.Contains("Size"))
|
||||
|
@ -264,7 +281,10 @@ namespace UWUVCI_AIO_WPF
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
public static void SendKey(IntPtr hWnd, System.Windows.Forms.Keys key)
|
||||
{
|
||||
PostMessage(hWnd, WM_KEYUP, key, 0);
|
||||
}
|
||||
static void bootsound(string sound)
|
||||
{
|
||||
FileInfo soundFile = new FileInfo(sound);
|
||||
|
@ -393,6 +413,7 @@ namespace UWUVCI_AIO_WPF
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static void WII(string romPath, MainViewModel mvm)
|
||||
{
|
||||
string savedir = Directory.GetCurrentDirectory();
|
||||
|
@ -482,8 +503,25 @@ namespace UWUVCI_AIO_WPF
|
|||
}
|
||||
|
||||
}
|
||||
if (mvm.jppatch)
|
||||
{
|
||||
|
||||
mvm.msg = "Language Patching ROM...";
|
||||
using (BinaryWriter writer = new BinaryWriter(new FileStream(Path.Combine(tempPath, "TEMP", "sys", "main.dol"), FileMode.Open)))
|
||||
{
|
||||
byte[] stuff = new byte[] { 0x38, 0x60};
|
||||
writer.Seek(0x4CBDAC, SeekOrigin.Begin);
|
||||
writer.Write(stuff);
|
||||
writer.Seek(0x4CBDAF, SeekOrigin.Begin);
|
||||
stuff = new byte[] { 0x00 };
|
||||
writer.Write(stuff);
|
||||
writer.Close();
|
||||
}
|
||||
mvm.Progress = 37;
|
||||
}
|
||||
if (mvm.Patch)
|
||||
{
|
||||
|
||||
mvm.msg = "Video Patching ROM...";
|
||||
using (Process vmc = new Process())
|
||||
{
|
||||
|
|
|
@ -57,6 +57,7 @@ namespace UWUVCI_AIO_WPF
|
|||
}
|
||||
}
|
||||
|
||||
public bool jppatch = false;
|
||||
|
||||
|
||||
private GameBases gbTemp;
|
||||
|
|
|
@ -24,12 +24,13 @@
|
|||
<ComboBox HorizontalAlignment="Left" Margin="10,138,0,0" VerticalAlignment="Top" Width="476" x:Name="gamepad" SelectionChanged="gamepad_SelectionChanged"/>
|
||||
<Label Content="Use GamePad as:" HorizontalAlignment="Left" Margin="6,113,0,0" VerticalAlignment="Top" FontSize="14"/>
|
||||
<CheckBox Content="Swap L/R and ZL/ZR" HorizontalAlignment="Left" Margin="506,142,0,0" VerticalAlignment="Top" Width="137" x:Name="LR" IsEnabled="False" IsChecked="False"/>
|
||||
<StackPanel Margin="10,20,53,436" Orientation="Horizontal" ToolTip="This may not work with every Game">
|
||||
<StackPanel Margin="10,20,34,436" Orientation="Horizontal">
|
||||
<Label Content="Video Patch:" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="14" Width="90"/>
|
||||
<RadioButton Name="vmcsmoll" Content="None" HorizontalAlignment="Left" Margin="0,5,0,0" VerticalAlignment="Top" GroupName="VMC" IsChecked="True" Click="RadioButton_Click_2" Width="77"/>
|
||||
<RadioButton Name="ntsc" Content="NTSC To PAL" HorizontalAlignment="Left" Margin="0,5,0,0" VerticalAlignment="Top" GroupName="VMC" Click="RadioButton_Click" Width="111"/>
|
||||
<RadioButton Name="pal" Content="PAL To NTSC" HorizontalAlignment="Left" Margin="0,5,0,0" VerticalAlignment="Top" GroupName="VMC" Click="RadioButton_Click_1" Width="110"/>
|
||||
<CheckBox Content="Disable Trim" Margin="0,5,0,31" Name="trimn" Click="trimn_Click" IsEnabled="False"/>
|
||||
<RadioButton Name="ntsc" Content="NTSC To PAL" HorizontalAlignment="Left" Margin="0,5,0,0" VerticalAlignment="Top" GroupName="VMC" Click="RadioButton_Click" Width="111" ToolTip="May not work with every Game"/>
|
||||
<RadioButton Name="pal" Content="PAL To NTSC" HorizontalAlignment="Left" Margin="0,5,0,0" VerticalAlignment="Top" GroupName="VMC" Click="RadioButton_Click_1" Width="110" ToolTip="May not work with every Game"/>
|
||||
<CheckBox Content="JP Patch" Margin="0,5,0,31" Name="jppatch" Width="84" ToolTip="Allows playing JP Wii Games on non JP Consoles" Click="jppatch_Click"/>
|
||||
<CheckBox Content="Disable Trim" Margin="0,5,0,31" x: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"/>
|
||||
<Image HorizontalAlignment="Left" Height="35" Margin="452,191,0,0" VerticalAlignment="Top" Width="38" OpacityMask="LightGray" Name="icoIMG" Source="/UWUVCI AIO WPF;component/UI/Images/newcamera2.png" Cursor="Hand" MouseLeftButtonDown="icoIMG_MouseLeftButtonDown" Visibility="Hidden" />
|
||||
|
|
|
@ -662,6 +662,7 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
|
|||
pal.IsEnabled = false;
|
||||
ntsc.IsEnabled = false;
|
||||
mvm.donttrim = true;
|
||||
mvm.jppatch = false;
|
||||
List<string> gpEmu = new List<string>();
|
||||
gpEmu.Add("None");
|
||||
gpEmu.Add("Classic Controller");
|
||||
|
@ -670,6 +671,7 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
|
|||
gpEmu.Add("[NEEDS TRIMMING] Force Classic Controller");
|
||||
gpEmu.Add("Force No Classic Controller");
|
||||
gamepad.ItemsSource = gpEmu;
|
||||
jppatch.IsEnabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -677,7 +679,8 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
|
|||
pal.IsEnabled = true;
|
||||
ntsc.IsEnabled = true;
|
||||
mvm.donttrim = false;
|
||||
List<string> gpEmu = new List<string>();
|
||||
jppatch.IsEnabled = true;
|
||||
List<string> gpEmu = new List<string>();
|
||||
gpEmu.Add("None");
|
||||
gpEmu.Add("Classic Controller");
|
||||
gpEmu.Add("Horizontal WiiMote");
|
||||
|
@ -689,5 +692,17 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
private void jppatch_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (mvm.jppatch)
|
||||
{
|
||||
mvm.jppatch = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
mvm.jppatch = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -203,6 +203,7 @@ namespace UWUVCI_AIO_WPF
|
|||
mvm.NKITFLAG = false;
|
||||
mvm.prodcode = "";
|
||||
mvm.foldername = "";
|
||||
mvm.jppatch = false;
|
||||
mvm.isDoneMW();
|
||||
|
||||
switch ((sender as ListView).SelectedIndex)
|
||||
|
|
Loading…
Reference in a new issue