GUI: Create type models
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using Il2CppInspector;
|
||||
using Il2CppInspector.Reflection;
|
||||
using Inspector = Il2CppInspector.Il2CppInspector;
|
||||
|
||||
namespace Il2CppInspectorGUI
|
||||
@@ -18,7 +17,7 @@ namespace Il2CppInspectorGUI
|
||||
{
|
||||
private Metadata metadata;
|
||||
|
||||
public List<Inspector> Il2CppImages { get; } = new List<Inspector>();
|
||||
public List<Il2CppModel> Il2CppModels { get; } = new List<Il2CppModel>();
|
||||
|
||||
public Exception LastException { get; private set; }
|
||||
|
||||
@@ -48,19 +47,22 @@ namespace Il2CppInspectorGUI
|
||||
}
|
||||
|
||||
// Multi-image binaries may contain more than one Il2Cpp image
|
||||
Il2CppImages.Clear();
|
||||
Il2CppModels.Clear();
|
||||
foreach (var image in stream.Images) {
|
||||
// Architecture-agnostic load attempt
|
||||
try {
|
||||
// If we can't load the IL2CPP data here, it's probably packed or obfuscated; ignore it
|
||||
if (Il2CppBinary.Load(image, metadata.Version) is Il2CppBinary binary) {
|
||||
Il2CppImages.Add(new Inspector(binary, metadata));
|
||||
var inspector = new Inspector(binary, metadata);
|
||||
|
||||
// Build type model
|
||||
Il2CppModels.Add(new Il2CppModel(inspector));
|
||||
}
|
||||
}
|
||||
// Unsupported architecture; ignore it
|
||||
catch (NotImplementedException) { }
|
||||
}
|
||||
if (!Il2CppImages.Any()) {
|
||||
if (!Il2CppModels.Any()) {
|
||||
throw new InvalidOperationException("Could not auto-detect any IL2CPP binary images in the file. This may mean the binary file is packed, encrypted or obfuscated, that the file is not an IL2CPP image or that Il2CppInspector was not able to automatically find the required data. Please check the binary file in a disassembler to ensure that it is an unencrypted IL2CPP binary before submitting a bug report!");
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -74,9 +74,9 @@
|
||||
<TextBlock>
|
||||
<TextBlock.Text>
|
||||
<MultiBinding StringFormat="{}{2}-bit {1} ({0})">
|
||||
<Binding Path="BinaryImage.Format"></Binding>
|
||||
<Binding Path="BinaryImage.Arch"></Binding>
|
||||
<Binding Path="BinaryImage.Bits"></Binding>
|
||||
<Binding Path="Package.BinaryImage.Format"></Binding>
|
||||
<Binding Path="Package.BinaryImage.Arch"></Binding>
|
||||
<Binding Path="Package.BinaryImage.Bits"></Binding>
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
@@ -100,7 +100,7 @@
|
||||
<Label DockPanel.Dock="Top" Foreground="{StaticResource WindowsBlue}" FontSize="18">Select image</Label>
|
||||
<ListBox DockPanel.Dock="Top" Name="lstImages" ItemTemplate="{StaticResource ImageListTemplate}" Height="80"/>
|
||||
<Label DockPanel.Dock="Top" Foreground="{StaticResource WindowsBlue}" FontSize="18">Image information</Label>
|
||||
<Grid DockPanel.Dock="Top" Name="gridImageDetails" DataContext="{Binding ElementName=lstImages, Path=SelectedItem}">
|
||||
<Grid DockPanel.Dock="Top" Name="gridImageDetails" DataContext="{Binding ElementName=lstImages, Path=SelectedItem.Package}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
@@ -154,7 +154,7 @@
|
||||
<!-- Busy indicator -->
|
||||
<Border Name="areaBusyIndicator" BorderThickness="1" CornerRadius="2" BorderBrush="Gray" HorizontalAlignment="Center" VerticalAlignment="Center" Background="#F8F8F8" SnapsToDevicePixels="True" Visibility="Hidden">
|
||||
<StackPanel Margin="60,40,60,40">
|
||||
<TextBlock Foreground="{StaticResource WindowsBlue}" FontSize="24">Getting things ready...</TextBlock>
|
||||
<TextBlock Name="txtBusyStatus" Foreground="{StaticResource WindowsBlue}" FontSize="24">Getting things ready...</TextBlock>
|
||||
<Image gif:AnimationBehavior.SourceUri="Resources/pizza.gif" Width="100" Margin="0,20,0,0" RenderOptions.BitmapScalingMode="Fant" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace Il2CppInspectorGUI
|
||||
};
|
||||
|
||||
if (openFileDialog.ShowDialog() == true) {
|
||||
txtBusyStatus.Text = "Processing metadata...";
|
||||
areaBusyIndicator.Visibility = Visibility.Visible;
|
||||
btnSelectMetadataFile.Visibility = Visibility.Hidden;
|
||||
|
||||
@@ -72,6 +73,7 @@ namespace Il2CppInspectorGUI
|
||||
btnBack.IsEnabled = false;
|
||||
|
||||
if (openFileDialog.ShowDialog() == true) {
|
||||
txtBusyStatus.Text = "Processing binary...";
|
||||
areaBusyIndicator.Visibility = Visibility.Visible;
|
||||
btnSelectBinaryFile.Visibility = Visibility.Hidden;
|
||||
|
||||
@@ -81,12 +83,12 @@ namespace Il2CppInspectorGUI
|
||||
areaBusyIndicator.Visibility = Visibility.Hidden;
|
||||
rectModalLightBoxBackground.Visibility = Visibility.Hidden;
|
||||
|
||||
lstImages.ItemsSource = app.Il2CppImages;
|
||||
lstImages.ItemsSource = app.Il2CppModels;
|
||||
}
|
||||
else {
|
||||
areaBusyIndicator.Visibility = Visibility.Hidden;
|
||||
btnSelectBinaryFile.Visibility = Visibility.Visible;
|
||||
MessageBox.Show(this, app.LastException.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
MessageBox.Show(this, "Something went wrong! " + app.LastException.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user