diff --git a/Il2CppInspector.GUI/Il2CppInspector.GUI.csproj b/Il2CppInspector.GUI/Il2CppInspector.GUI.csproj index 63e48fc..38d2b40 100644 --- a/Il2CppInspector.GUI/Il2CppInspector.GUI.csproj +++ b/Il2CppInspector.GUI/Il2CppInspector.GUI.csproj @@ -30,6 +30,11 @@ + + + + + diff --git a/Il2CppInspector.GUI/MainWindow.xaml b/Il2CppInspector.GUI/MainWindow.xaml index a02b7e5..525842a 100644 --- a/Il2CppInspector.GUI/MainWindow.xaml +++ b/Il2CppInspector.GUI/MainWindow.xaml @@ -6,7 +6,7 @@ xmlns:local="clr-namespace:Il2CppInspectorGUI" xmlns:gif="https://github.com/XamlAnimatedGif/XamlAnimatedGif" mc:Ignorable="d" - Title="Il2CppInspector" Height="630" Width="970" Background="White"> + Title="Il2CppInspector" Height="630" Width="990" Background="White"> @@ -100,7 +100,7 @@ - + @@ -159,7 +159,7 @@ - + @@ -201,13 +201,14 @@ - + + C# prototypes @@ -226,22 +227,28 @@ Suppress pointer, offset and index metadata comments - Attempt to generate code that compiles + Attempt to generate output that compiles Place assembly-level attributes in separate files - + + + + Visual Studio solution Uses the settings above but forces tree layout, compilable output and separate assembly attributes - - - + + + - - - + + + - + + + + IDAPython script No configuration required for IDA script output diff --git a/Il2CppInspector.GUI/MainWindow.xaml.cs b/Il2CppInspector.GUI/MainWindow.xaml.cs index aa7131e..1142336 100644 --- a/Il2CppInspector.GUI/MainWindow.xaml.cs +++ b/Il2CppInspector.GUI/MainWindow.xaml.cs @@ -24,6 +24,8 @@ using System.Windows.Shapes; using Microsoft.Win32; using Il2CppInspector; using Il2CppInspector.Reflection; +using Ookii.Dialogs.Wpf; +using Path = System.IO.Path; namespace Il2CppInspectorGUI { @@ -37,10 +39,25 @@ namespace Il2CppInspectorGUI // Subscribe to status update events ((App) Application.Current).OnStatusUpdate += OnStatusUpdate; + + // Find Unity paths + var programFiles = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); + txtUnityPath.Text = Utils.FindPath($@"{programFiles}\Unity\Hub\Editor\*") ?? ""; + txtUnityScriptPath.Text = Utils.FindPath($@"{programFiles}\Unity\Hub\Editor\*\Editor\Data\Resources\PackageManager\ProjectTemplates\libcache\com.unity.template.3d-*\ScriptAssemblies") ?? ""; } + /// + /// Update the busy indicator message + /// private void OnStatusUpdate(object sender, string e) => txtBusyStatus.Dispatcher.Invoke(() => txtBusyStatus.Text = e + "..."); + /// + /// User clicked on a link + /// + private void Hyperlink_OnRequestNavigate(object sender, RequestNavigateEventArgs e) { + Process.Start(new ProcessStartInfo {FileName = e.Uri.ToString(), UseShellExecute = true}); + } + /// /// Select global metadata file /// @@ -163,10 +180,48 @@ namespace Il2CppInspectorGUI } /// - /// User clicked on a link + /// Select Unity editor path /// - private void Hyperlink_OnRequestNavigate(object sender, RequestNavigateEventArgs e) { - Process.Start(new ProcessStartInfo {FileName = e.Uri.ToString(), UseShellExecute = true}); + private void BtnUnityPath_OnClick(object sender, RoutedEventArgs e) { + var openFolderDialog = new VistaFolderBrowserDialog(); + if (txtUnityPath.Text != "") + openFolderDialog.SelectedPath = txtUnityPath.Text; + else { + openFolderDialog.SelectedPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); + } + + openFolderDialog.Description = "Select Unity editor path"; + openFolderDialog.UseDescriptionForTitle = true; + + while (openFolderDialog.ShowDialog() == true) { + if (!File.Exists(openFolderDialog.SelectedPath + @"\Editor\Data\Managed\UnityEditor.dll")) + MessageBox.Show(this, "Could not find Unity installation in this folder. Ensure the 'Editor' folder is a child of the selected folder and try again.", "Unity installation not found", MessageBoxButton.OK, MessageBoxImage.Error); + else { + txtUnityPath.Text = openFolderDialog.SelectedPath; + break; + } + } + } + + /// + /// Select Unity script assemblies path + /// + private void BtnUnityScriptPath_OnClick(object sender, RoutedEventArgs e) { + var openFolderDialog = new VistaFolderBrowserDialog(); + if (txtUnityScriptPath.Text != "") + openFolderDialog.SelectedPath = txtUnityScriptPath.Text; + + openFolderDialog.Description = "Select Unity script assemblies path"; + openFolderDialog.UseDescriptionForTitle = true; + + while (openFolderDialog.ShowDialog() == true) { + if (!File.Exists(openFolderDialog.SelectedPath + @"\UnityEngine.UI.dll")) + MessageBox.Show(this, "Could not find Unity assemblies in this folder. Ensure the selected folder contains UnityEngine.UI.dll and try again.", "Unity assemblies not found", MessageBoxButton.OK, MessageBoxImage.Error); + else { + txtUnityScriptPath.Text = openFolderDialog.SelectedPath; + break; + } + } } }