Added something, idk pls advise

This commit is contained in:
ZestyTS 2022-06-15 20:06:43 -07:00
parent 4e72a78490
commit efaa2c0577
2 changed files with 70 additions and 3 deletions

View file

@ -15,7 +15,7 @@
<TextBox materialDesign:HintAssist.Hint="TV IMAGE" Name="tv" ToolTip="Also known as bootTvTex" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,227,157,238" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" IsReadOnly="True" Focusable="False" Text="{Binding GameConfiguration.TGATv.ImgPath}" Cursor="Help" IsTabStop="False"/>
<TextBox materialDesign:HintAssist.Hint="LOGO IMAGE (OPTIONAL)" ToolTip="Also known as bootLogoTex" Name="log" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,317,157,149" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" IsReadOnly="True" Focusable="False" Cursor="Help" Text="{Binding GameConfiguration.TGALog.ImgPath}" IsTabStop="False" TextChanged="log_TextChanged_1"/>
<TextBox materialDesign:HintAssist.Hint="GAME NAME" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,413,157,52" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" Text="{Binding GameConfiguration.GameName}" Name="gn" KeyUp="gn_KeyUp" MaxLength="250" IsTabStop="False"/>
<Button Content="Inject" HorizontalAlignment="Left" Margin="506,478,0,0" VerticalAlignment="Top" Width="127" IsEnabled="{Binding CanInject}" Click="InjectGame" Focusable="False" IsTabStop="False"/>
<Button Content="Inject" HorizontalAlignment="Left" Margin="506,478,0,0" VerticalAlignment="Top" Width="127" Click="InjectGame" Focusable="False" IsTabStop="False"/>
<Button Content="Create File" HorizontalAlignment="Left" Margin="506,327,0,0" VerticalAlignment="Top" Width="127" Click="Set_LogoTex" IsTabStop="False"/>
<Button Content="Create File" HorizontalAlignment="Left" Margin="506,238,0,0" VerticalAlignment="Top" Width="127" Click="Set_TvTex" IsTabStop="False"/>
<Button Content="Create File" HorizontalAlignment="Left" Margin="506,283,0,0" VerticalAlignment="Top" Width="127" Click="Set_DrcTex" IsTabStop="False"/>
@ -54,5 +54,7 @@
<RadioButton x:Name="RF_tn" Content="To NTSC" Click="RF_tp_Click" HorizontalAlignment="Left" VerticalAlignment="Top" GroupName="RF" Width="85" ToolTip="Change Game Region to NTSC" Margin="0,6,0,0"/>
<RadioButton x:Name="RF_tj" Content="To JPN" Click="RF_tp_Click" HorizontalAlignment="Left" VerticalAlignment="Top" GroupName="RF" Width="82" ToolTip="Change Game Region to JPN" Margin="0,6,0,0"/>
</StackPanel>
<TextBox materialDesign:HintAssist.Hint="WIIU ANCAST KEY" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Margin="10,460,395,5" Background="{x:Null}" Foreground="Black" SelectionBrush="#FF00C3D7" CaretBrush="#FF21C3F3" FontSize="18" Text="{Binding ancastKey}" x:Name="ancastKey" MaxLength="250" IsTabStop="False"/>
<Button Content="Get From OTP" HorizontalAlignment="Left" Margin="257,473,0,0" VerticalAlignment="Top" Width="127" Click="ancast_OTP" Focusable="False" IsTabStop="False"/>
</Grid>
</Page>

View file

@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Security;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
@ -146,8 +148,9 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
reader.Close();
}
}
isok = true;
if (isok)
{
motepass.IsEnabled = false;
@ -307,6 +310,63 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
mvm.LR = false;
}
mvm.GameConfiguration.GameName = gn.Text;
/*TODO: Make this work
* - WiiUDownloader requires titlekey
* - C2W_Patcher doesn't work, but idfk what it's supposed to do so /shrug
* - idfk what this shit is supposed to do
*/
if (!string.IsNullOrEmpty(ancastKey.Text))
{
ancastKey.Text = ancastKey.Text.ToUpper();
var sourceData = ancastKey.Text;
var tempSource = ASCIIEncoding.ASCII.GetBytes(sourceData);
var tmpHash = new MD5CryptoServiceProvider().ComputeHash(tempSource);
var hash = BitConverter.ToString(tmpHash);
if (hash == "31-8D-1F-9D-98-FB-08-E7-7C-7F-E1-77-AA-49-05-43")
{
var toolsPath = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "bin", "Tools");
var tempPath = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "bin", "temp");
string[,] filesToDownload = {
{ "0005001010004000 -file /code/deint.txt", "deint.txt" },
{ "0005001010004000 -file /code/font.bin", "font.bin" },
{ "0005001010004001 -file /code/c2w.img", "c2w.img" },
{ "0005001010004001 -file /code/boot.bin", "boot.bin" },
{ "0005001010004001 -file /code/dmcu.d.hex", "dmcu.d.hex"}
};
for(var i = 0; i < filesToDownload.Length/2; i++)
{
using (Process download = new Process())
{
download.StartInfo.FileName = System.IO.Path.Combine(toolsPath, "WiiUDownloader.exe");
download.StartInfo.Arguments = $"{filesToDownload[i,0]} \"{System.IO.Path.Combine(tempPath, filesToDownload[i,1])}\"";
download.Start();
download.WaitForExit();
}
}
string[] ancastKeyCopy = { ancastKey.Text };
Directory.CreateDirectory(tempPath + "\\C2W");
File.WriteAllLines(tempPath + "\\C2W\\starbuck_key.txt", ancastKeyCopy);
using (Process c2w = new Process())
{
c2w.StartInfo.FileName = System.IO.Path.Combine(toolsPath, "c2w_patcher.exe");
c2w.StartInfo.Arguments = $"-nc \"{System.IO.Path.Combine(tempPath, "C2W")}";
c2w.Start();
c2w.WaitForExit();
}
}
else
{
//error
return;
}
}
mvm.Inject(false);
}
@ -943,5 +1003,10 @@ namespace UWUVCI_AIO_WPF.UI.Frames.InjectFrames.Configurations
}
}
private void ancast_OTP(object sender, RoutedEventArgs e)
{
}
}
}