GUI: Don't lose status handler on multi-image binaries / improve status output
This commit is contained in:
@@ -33,6 +33,8 @@ namespace Il2CppInspectorGUI
|
||||
// Attempt to load an IL2CPP application package (APK or IPA)
|
||||
public async Task<bool> LoadPackageAsync(string packageFile) {
|
||||
try {
|
||||
OnStatusUpdate?.Invoke(this, "Extracting package");
|
||||
|
||||
var streams = Inspector.GetStreamsFromPackage(packageFile);
|
||||
if (streams == null)
|
||||
throw new InvalidOperationException("The supplied package is not an APK or IPA file, or does not contain an IL2CPP application");
|
||||
@@ -55,6 +57,7 @@ namespace Il2CppInspectorGUI
|
||||
Task.Run(() => {
|
||||
try {
|
||||
OnStatusUpdate?.Invoke(this, "Processing metadata");
|
||||
|
||||
metadata = new Metadata(metadataStream);
|
||||
return true;
|
||||
}
|
||||
@@ -73,19 +76,21 @@ namespace Il2CppInspectorGUI
|
||||
public Task<bool> LoadBinaryAsync(Stream binaryStream) =>
|
||||
Task.Run(() => {
|
||||
try {
|
||||
OnStatusUpdate?.Invoke(this, "Processing binary");
|
||||
|
||||
// This may throw other exceptions from the individual loaders as well
|
||||
IFileFormatReader stream = FileFormatReader.Load(binaryStream, StatusUpdate);
|
||||
if (stream == null) {
|
||||
throw new InvalidOperationException("Could not determine the binary file format");
|
||||
}
|
||||
if (!stream.Images.Any()) {
|
||||
if (stream.NumImages == 0) {
|
||||
throw new InvalidOperationException("Could not find any binary images in the file");
|
||||
}
|
||||
|
||||
// Multi-image binaries may contain more than one Il2Cpp image
|
||||
AppModels.Clear();
|
||||
foreach (var image in stream.Images) {
|
||||
OnStatusUpdate?.Invoke(this, "Analyzing IL2CPP data");
|
||||
OnStatusUpdate?.Invoke(this, $"Analyzing IL2CPP data for {image.Format}/{image.Arch} image");
|
||||
|
||||
// Architecture-agnostic load attempt
|
||||
try {
|
||||
@@ -94,7 +99,7 @@ namespace Il2CppInspectorGUI
|
||||
var inspector = new Inspector(binary, metadata);
|
||||
|
||||
// Build type model
|
||||
OnStatusUpdate?.Invoke(this, "Building .NET type model");
|
||||
OnStatusUpdate?.Invoke(this, $"Building .NET type model for {image.Format}/{image.Arch} image");
|
||||
var typeModel = new TypeModel(inspector);
|
||||
|
||||
// Initialize (but don't build) application model
|
||||
|
||||
@@ -471,7 +471,7 @@
|
||||
</Button>
|
||||
|
||||
<!-- Busy indicator -->
|
||||
<Border Name="areaBusyIndicator" Width="500" BorderThickness="1" CornerRadius="2" BorderBrush="Gray" HorizontalAlignment="Center" VerticalAlignment="Center" Background="White" SnapsToDevicePixels="True" Visibility="Hidden">
|
||||
<Border Name="areaBusyIndicator" Width="800" BorderThickness="1" CornerRadius="2" BorderBrush="Gray" HorizontalAlignment="Center" VerticalAlignment="Center" Background="White" SnapsToDevicePixels="True" Visibility="Hidden">
|
||||
<StackPanel Margin="60,40,60,40">
|
||||
<TextBlock Name="txtBusyStatus" Foreground="{StaticResource WindowsBlue}" FontSize="24" HorizontalAlignment="Center">Getting things ready...</TextBlock>
|
||||
<Image gif:AnimationBehavior.SourceUri="Resources/pizza.gif" Width="100" Margin="0,20,0,0" RenderOptions.BitmapScalingMode="Fant" />
|
||||
|
||||
@@ -118,7 +118,6 @@ namespace Il2CppInspectorGUI
|
||||
private async Task LoadBinaryAsync(string filename) {
|
||||
var app = (App) Application.Current;
|
||||
|
||||
txtBusyStatus.Text = "Processing binary...";
|
||||
areaBusyIndicator.Visibility = Visibility.Visible;
|
||||
btnSelectBinaryFile.Visibility = Visibility.Hidden;
|
||||
|
||||
@@ -155,7 +154,6 @@ namespace Il2CppInspectorGUI
|
||||
private async Task LoadPackageAsync(string filename) {
|
||||
var app = (App) Application.Current;
|
||||
|
||||
txtBusyStatus.Text = "Extracting package...";
|
||||
areaBusyIndicator.Visibility = Visibility.Visible;
|
||||
grdFirstPage.Visibility = Visibility.Hidden;
|
||||
|
||||
@@ -439,7 +437,7 @@ namespace Il2CppInspectorGUI
|
||||
var selectedPyUnityVersion = ((UnityHeaders) cboPyUnityVersion.SelectedItem)?.VersionRange.Min;
|
||||
var selectedPyTarget = (string) cboPyTarget.SelectedItem;
|
||||
await Task.Run(() => {
|
||||
OnStatusUpdate(this, "Building C++ application model");
|
||||
OnStatusUpdate(this, "Building application model");
|
||||
model.Build(selectedPyUnityVersion, CppCompilerType.GCC);
|
||||
|
||||
OnStatusUpdate(this, $"Generating {selectedPyTarget} Python script");
|
||||
@@ -464,7 +462,7 @@ namespace Il2CppInspectorGUI
|
||||
var selectedCppUnityVersion = ((UnityHeaders) cboCppUnityVersion.SelectedItem)?.VersionRange.Min;
|
||||
var cppCompiler = (CppCompilerType) Enum.Parse(typeof(CppCompilerType), cboCppCompiler.SelectionBoxItem.ToString());
|
||||
await Task.Run(() => {
|
||||
OnStatusUpdate(this, "Building C++ application model");
|
||||
OnStatusUpdate(this, "Building application model");
|
||||
model.Build(selectedCppUnityVersion, cppCompiler);
|
||||
|
||||
OnStatusUpdate(this, "Generating C++ scaffolding");
|
||||
@@ -490,7 +488,7 @@ namespace Il2CppInspectorGUI
|
||||
areaBusyIndicator.Visibility = Visibility.Visible;
|
||||
var selectedJsonUnityVersion = ((UnityHeaders) cboJsonUnityVersion.SelectedItem)?.VersionRange.Min;
|
||||
await Task.Run(() => {
|
||||
OnStatusUpdate(this, "Building C++ application model");
|
||||
OnStatusUpdate(this, "Building application model");
|
||||
model.Build(selectedJsonUnityVersion, CppCompilerType.GCC);
|
||||
|
||||
OnStatusUpdate(this, "Generating JSON metadata file");
|
||||
|
||||
Reference in New Issue
Block a user