diff --git a/Il2CppInspector.Common/Plugins/API/V100/Hooks.cs b/Il2CppInspector.Common/Plugins/API/V100/Hooks.cs deleted file mode 100644 index d0765de..0000000 --- a/Il2CppInspector.Common/Plugins/API/V100/Hooks.cs +++ /dev/null @@ -1,74 +0,0 @@ -/* - Copyright 2020 Katy Coe - http://www.djkaty.com - https://github.com/djkaty - - All rights reserved. -*/ - -using System; -using System.IO; -using NoisyCowStudios.Bin2Object; -using Il2CppInspector.Reflection; - -// Hooks we provide to plugins which can choose whether or not to provide implementations -namespace Il2CppInspector.PluginAPI.V100 -{ - /// - /// Executes when the plugin's options are updated by the user - /// Not called on first load (with the default, possibly incomplete options provided by the plugin author) - /// Do not perform any long-running operations here - /// Implementation is optional - the default is to do nothing - /// - public partial interface IPlugin - { - void OptionsChanged(PluginOptionsChangedEventInfo e) { } - } - - /// - /// Process global-metadata.dat when it is first opened as a sequence of bytes - /// Seek cursor will be at the start of the file - /// - public interface IPreProcessMetadata - { - void PreProcessMetadata(BinaryObjectStream stream, PluginPreProcessMetadataEventInfo data); - } - - /// - /// Process global-metadata.dat after it has been loaded into a Metadata object - /// - public interface IPostProcessMetadata - { - void PostProcessMetadata(Metadata metadata, PluginPostProcessMetadataEventInfo data); - } - - /// - /// Fetch all of the .NET identifier strings - /// - public interface IGetStrings - { - void GetStrings(Metadata metadata, PluginGetStringsEventInfo data); - } - - /// - /// Fetch all of the (constant) string literals - /// - public interface IGetStringLiterals - { - void GetStringLiterals(Metadata metadata, PluginGetStringLiteralsEventInfo data); - } - - /// - /// Post-process the entire IL2CPP application package after the metadata and binary have been loaded and merged - /// - public interface IPostProcessPackage - { - void PostProcessPackage(Il2CppInspector package, PluginPostProcessPackageEventInfo data); - } - - /// - /// Post-process the .NET type model to make changes after it has been fully created - /// - public interface IPostProcessTypeModel - { - void PostProcessTypeModel(TypeModel model, PluginPostProcessTypeModelEventInfo data); - } -} diff --git a/Il2CppInspector.Common/Plugins/API/V100/ILoadPipeline.cs b/Il2CppInspector.Common/Plugins/API/V100/ILoadPipeline.cs new file mode 100644 index 0000000..cac8f48 --- /dev/null +++ b/Il2CppInspector.Common/Plugins/API/V100/ILoadPipeline.cs @@ -0,0 +1,50 @@ +/* + Copyright 2020 Katy Coe - http://www.djkaty.com - https://github.com/djkaty + + All rights reserved. +*/ + +using NoisyCowStudios.Bin2Object; +using Il2CppInspector.Reflection; + +namespace Il2CppInspector.PluginAPI.V100 +{ + /// + /// Plugins which implement ILoadPipeline perform additional processing on IL2CPP workloads + /// as they are analyzed and translated into an internal model + /// Calls are performed in the order listed below + /// + public interface ILoadPipeline + { + /// + /// Process global-metadata.dat when it is first opened as a sequence of bytes + /// Seek cursor will be at the start of the file + /// + void PreProcessMetadata(BinaryObjectStream stream, PluginPreProcessMetadataEventInfo data) { } + + /// + /// Fetch all of the .NET identifier strings + /// + void GetStrings(Metadata metadata, PluginGetStringsEventInfo data) { } + + /// + /// Fetch all of the (constant) string literals + /// + void GetStringLiterals(Metadata metadata, PluginGetStringLiteralsEventInfo data) { } + + /// + /// Process global-metadata.dat after it has been loaded into a Metadata object + /// + void PostProcessMetadata(Metadata metadata, PluginPostProcessMetadataEventInfo data) { } + + /// + /// Post-process the entire IL2CPP application package after the metadata and binary have been loaded and merged + /// + void PostProcessPackage(Il2CppInspector package, PluginPostProcessPackageEventInfo data) { } + + /// + /// Post-process the .NET type model to make changes after it has been fully created + /// + void PostProcessTypeModel(TypeModel model, PluginPostProcessTypeModelEventInfo data) { } + } +} diff --git a/Il2CppInspector.Common/Plugins/API/V100/IPlugin.cs b/Il2CppInspector.Common/Plugins/API/V100/IPlugin.cs index 0f08b07..4791479 100644 --- a/Il2CppInspector.Common/Plugins/API/V100/IPlugin.cs +++ b/Il2CppInspector.Common/Plugins/API/V100/IPlugin.cs @@ -40,8 +40,16 @@ namespace Il2CppInspector.PluginAPI.V100 public string Description { get; } /// - /// Plugin options + /// Plugin options with their current values (or default values on startup where applicable) /// public List Options { get; } - } + + /// + /// Executes when the plugin's options are updated by the user + /// Not called on first load (with the default, possibly incomplete options provided by the plugin author) + /// Do not perform any long-running operations here + /// Implementation is optional. The default is to do nothing + /// + void OptionsChanged(PluginOptionsChangedEventInfo e) { } + } } diff --git a/Il2CppInspector.Common/Plugins/PluginHooks.cs b/Il2CppInspector.Common/Plugins/PluginHooks.cs index 38388fc..7810cc5 100644 --- a/Il2CppInspector.Common/Plugins/PluginHooks.cs +++ b/Il2CppInspector.Common/Plugins/PluginHooks.cs @@ -4,11 +4,11 @@ All rights reserved. */ -// This is the ONLY line to update when the API version changes -using System.IO; -using NoisyCowStudios.Bin2Object; -using Il2CppInspector.PluginAPI.V100; using Il2CppInspector.Reflection; +using NoisyCowStudios.Bin2Object; + +// This is the ONLY line to update when the API version changes +using Il2CppInspector.PluginAPI.V100; namespace Il2CppInspector { @@ -17,25 +17,25 @@ namespace Il2CppInspector internal static class PluginHooks { public static PluginPreProcessMetadataEventInfo PreProcessMetadata(BinaryObjectStream stream) - => PluginManager.Try((p, e) => { + => PluginManager.Try((p, e) => { stream.Position = 0; p.PreProcessMetadata(stream, e); }); public static PluginPostProcessMetadataEventInfo PostProcessMetadata(Metadata metadata) - => PluginManager.Try((p, e) => p.PostProcessMetadata(metadata, e)); + => PluginManager.Try((p, e) => p.PostProcessMetadata(metadata, e)); public static PluginGetStringsEventInfo GetStrings(Metadata metadata) - => PluginManager.Try((p, e) => p.GetStrings(metadata, e)); + => PluginManager.Try((p, e) => p.GetStrings(metadata, e)); public static PluginGetStringLiteralsEventInfo GetStringLiterals(Metadata metadata) - => PluginManager.Try((p, e) => p.GetStringLiterals(metadata, e)); + => PluginManager.Try((p, e) => p.GetStringLiterals(metadata, e)); public static PluginPostProcessPackageEventInfo PostProcessPackage(Il2CppInspector package) - => PluginManager.Try((p, e) => p.PostProcessPackage(package, e)); + => PluginManager.Try((p, e) => p.PostProcessPackage(package, e)); public static PluginPostProcessTypeModelEventInfo PostProcessTypeModel(TypeModel typeModel) - => PluginManager.Try((p, e) => p.PostProcessTypeModel(typeModel, e)); + => PluginManager.Try((p, e) => p.PostProcessTypeModel(typeModel, e)); } }