GUI: Add Ghidra Python script output support (and future script targets)
This commit is contained in:
@@ -369,6 +369,10 @@
|
|||||||
<ComboBox Name="cboPyUnityVersion" DockPanel.Dock="Right" Margin="4"></ComboBox>
|
<ComboBox Name="cboPyUnityVersion" DockPanel.Dock="Right" Margin="4"></ComboBox>
|
||||||
<Label DockPanel.Dock="Left" Width="170" VerticalAlignment="Center" HorizontalAlignment="Left">Unity version (if known):</Label>
|
<Label DockPanel.Dock="Left" Width="170" VerticalAlignment="Center" HorizontalAlignment="Left">Unity version (if known):</Label>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
<DockPanel>
|
||||||
|
<ComboBox Name="cboPyTarget" DockPanel.Dock="Right" Margin="4" Width="80"></ComboBox>
|
||||||
|
<Label DockPanel.Dock="Left" Width="170" VerticalAlignment="Center" HorizontalAlignment="Left">Script target:</Label>
|
||||||
|
</DockPanel>
|
||||||
|
|
||||||
<Separator Margin="5,15,5,15"/>
|
<Separator Margin="5,15,5,15"/>
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,10 @@ namespace Il2CppInspectorGUI
|
|||||||
var programFiles = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
|
var programFiles = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
|
||||||
txtUnityPath.Text = Utils.FindPath($@"{programFiles}\Unity\Hub\Editor\*") ?? "<not set>";
|
txtUnityPath.Text = Utils.FindPath($@"{programFiles}\Unity\Hub\Editor\*") ?? "<not set>";
|
||||||
txtUnityScriptPath.Text = Utils.FindPath($@"{programFiles}\Unity\Hub\Editor\*\Editor\Data\Resources\PackageManager\ProjectTemplates\libcache\com.unity.template.3d-*\ScriptAssemblies") ?? "<not set>";
|
txtUnityScriptPath.Text = Utils.FindPath($@"{programFiles}\Unity\Hub\Editor\*\Editor\Data\Resources\PackageManager\ProjectTemplates\libcache\com.unity.template.3d-*\ScriptAssemblies") ?? "<not set>";
|
||||||
|
|
||||||
|
// Populate script target combo box and select IDA by default
|
||||||
|
cboPyTarget.ItemsSource = PythonScript.GetAvailableTargets();
|
||||||
|
cboPyTarget.SelectedItem = (cboPyTarget.ItemsSource as IEnumerable<string>).First(x => x == "IDA");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -426,12 +430,13 @@ namespace Il2CppInspectorGUI
|
|||||||
|
|
||||||
areaBusyIndicator.Visibility = Visibility.Visible;
|
areaBusyIndicator.Visibility = Visibility.Visible;
|
||||||
var selectedPyUnityVersion = ((UnityHeaders) cboPyUnityVersion.SelectedItem)?.VersionRange.Min;
|
var selectedPyUnityVersion = ((UnityHeaders) cboPyUnityVersion.SelectedItem)?.VersionRange.Min;
|
||||||
|
var selectedPyTarget = (string) cboPyTarget.SelectedItem;
|
||||||
await Task.Run(() => {
|
await Task.Run(() => {
|
||||||
OnStatusUpdate(this, "Building C++ application model");
|
OnStatusUpdate(this, "Building C++ application model");
|
||||||
model.Build(selectedPyUnityVersion, CppCompilerType.GCC);
|
model.Build(selectedPyUnityVersion, CppCompilerType.GCC);
|
||||||
|
|
||||||
OnStatusUpdate(this, "Generating Python script");
|
OnStatusUpdate(this, $"Generating {selectedPyTarget} Python script");
|
||||||
new PythonScript(model).WriteScriptToFile(pyOutFile, "IDA");
|
new PythonScript(model).WriteScriptToFile(pyOutFile, selectedPyTarget);
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user