Merge branch 'C2W' into OverhaulToNet6

This commit is contained in:
ZestyTS 2022-08-05 22:21:28 -07:00
commit 34705e0c07
2 changed files with 69 additions and 2 deletions

View file

@ -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)
{
}
}
}