From b9409e7425b7cd2a4f7cf04982a7c05121001ced Mon Sep 17 00:00:00 2001 From: Katy Coe Date: Mon, 21 Dec 2020 23:02:32 +0100 Subject: [PATCH] Plugins: Add hook TODOs --- Il2CppInspector.CLI/PluginOptions.cs | 2 ++ Il2CppInspector.Common/FileFormatStreams/FileFormatStream.cs | 5 +++++ Il2CppInspector.Common/IL2CPP/Il2CppBinary.cs | 4 ++++ Il2CppInspector.Common/IL2CPP/Il2CppInspector.cs | 2 ++ Il2CppInspector.Common/Model/AppModel.cs | 2 ++ Il2CppInspector.GUI/PluginConfigurationDialog.xaml.cs | 2 ++ Il2CppTests/TestAppModelQueries.cs | 1 + 7 files changed, 18 insertions(+) diff --git a/Il2CppInspector.CLI/PluginOptions.cs b/Il2CppInspector.CLI/PluginOptions.cs index 37f420c..177f0a3 100644 --- a/Il2CppInspector.CLI/PluginOptions.cs +++ b/Il2CppInspector.CLI/PluginOptions.cs @@ -183,6 +183,8 @@ namespace Il2CppInspector.CLI // Enable plugin PluginManager.AsInstance.ManagedPlugins.First(p => p.Plugin == plugin).Enabled = true; + + // TODO: Plugin hook OptionsChanged } return true; } diff --git a/Il2CppInspector.Common/FileFormatStreams/FileFormatStream.cs b/Il2CppInspector.Common/FileFormatStreams/FileFormatStream.cs index f4a8208..33ca41c 100644 --- a/Il2CppInspector.Common/FileFormatStreams/FileFormatStream.cs +++ b/Il2CppInspector.Common/FileFormatStreams/FileFormatStream.cs @@ -197,7 +197,12 @@ namespace Il2CppInspector private bool InitImpl(LoadOptions loadOptions, EventHandler statusCallback) { LoadOptions = loadOptions; OnStatusUpdate = statusCallback; + + // TODO: Plugin hook PreProcessFile + return Init(); + + // TODO: Plugin hook PostProcessFile } // Confirm file is valid and set up RVA mappings diff --git a/Il2CppInspector.Common/IL2CPP/Il2CppBinary.cs b/Il2CppInspector.Common/IL2CPP/Il2CppBinary.cs index c08ac77..2f22c44 100644 --- a/Il2CppInspector.Common/IL2CPP/Il2CppBinary.cs +++ b/Il2CppInspector.Common/IL2CPP/Il2CppBinary.cs @@ -259,6 +259,8 @@ namespace Il2CppInspector CodeRegistration = Image.ReadMappedObject(codeRegistration); MetadataRegistration = Image.ReadMappedObject(metadataRegistration); + // TODO: Plugin hook PreProcessBinary + // Do basic validatation that MetadataRegistration and CodeRegistration are sane /* * GlobalMethodPointers (<= 24.1) must be a series of pointers in il2cpp or .text, and in sequential order @@ -378,6 +380,8 @@ namespace Il2CppInspector GenericMethodPointers.Add(MethodSpecs[tableEntry.genericMethodIndex], genericMethodPointers[tableEntry.indices.methodIndex]); GenericMethodInvokerIndices.Add(MethodSpecs[tableEntry.genericMethodIndex], tableEntry.indices.invokerIndex); } + + // TODO: Plugin hook PostProcessBinary } // IL2CPP API exports diff --git a/Il2CppInspector.Common/IL2CPP/Il2CppInspector.cs b/Il2CppInspector.Common/IL2CPP/Il2CppInspector.cs index ef97b00..e731a1a 100644 --- a/Il2CppInspector.Common/IL2CPP/Il2CppInspector.cs +++ b/Il2CppInspector.Common/IL2CPP/Il2CppInspector.cs @@ -313,6 +313,8 @@ namespace Il2CppInspector // Merge all metadata usage references into a single distinct list MetadataUsages = buildMetadataUsages(); + + // TODO: Plugin hook PostProcessPackage } // Get a method pointer if available diff --git a/Il2CppInspector.Common/Model/AppModel.cs b/Il2CppInspector.Common/Model/AppModel.cs index 70e46ee..604ac9e 100644 --- a/Il2CppInspector.Common/Model/AppModel.cs +++ b/Il2CppInspector.Common/Model/AppModel.cs @@ -272,6 +272,8 @@ namespace Il2CppInspector.Model // Restore stdout Console.SetOut(stdout); + // TODO: Plugin hook PostProcessAppModel + // This is to allow this method to be chained after a new expression return this; } diff --git a/Il2CppInspector.GUI/PluginConfigurationDialog.xaml.cs b/Il2CppInspector.GUI/PluginConfigurationDialog.xaml.cs index db1ab11..81033a4 100644 --- a/Il2CppInspector.GUI/PluginConfigurationDialog.xaml.cs +++ b/Il2CppInspector.GUI/PluginConfigurationDialog.xaml.cs @@ -60,6 +60,8 @@ namespace Il2CppInspector.GUI private void okButton_Click(object sender, RoutedEventArgs e) { // Closes dialog box automatically DialogResult = true; + + // TODO: Plugin hook OptionsChanged (and make sure it works when clicking close icon as well) } // Select a file path diff --git a/Il2CppTests/TestAppModelQueries.cs b/Il2CppTests/TestAppModelQueries.cs index e445ccc..7848240 100644 --- a/Il2CppTests/TestAppModelQueries.cs +++ b/Il2CppTests/TestAppModelQueries.cs @@ -34,6 +34,7 @@ namespace Il2CppInspector // Assert // Check VTable offset is accurate + // Note: this is for 2020.1 and below; it changed to 0x138 in 2020.2 Assert.AreEqual(0x130, app.GetVTableOffset()); // BufferedStream.Flush()