diff --git a/Il2CppInspector.Common/Plugins/API/V100/Hooks.cs b/Il2CppInspector.Common/Plugins/API/V100/Hooks.cs index fd4e825..355a75f 100644 --- a/Il2CppInspector.Common/Plugins/API/V100/Hooks.cs +++ b/Il2CppInspector.Common/Plugins/API/V100/Hooks.cs @@ -6,6 +6,7 @@ using System; using System.IO; +using Il2CppInspector.Reflection; namespace Il2CppInspector.PluginAPI.V100 { @@ -25,4 +26,12 @@ namespace Il2CppInspector.PluginAPI.V100 { void PostProcessMetadata(Metadata metadata, PluginPostProcessMetadataEventInfo 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/PluginEventInfo.cs b/Il2CppInspector.Common/Plugins/API/V100/PluginEventInfo.cs index 1765c8c..2d88551 100644 --- a/Il2CppInspector.Common/Plugins/API/V100/PluginEventInfo.cs +++ b/Il2CppInspector.Common/Plugins/API/V100/PluginEventInfo.cs @@ -79,6 +79,11 @@ namespace Il2CppInspector.PluginAPI.V100 /// public class PluginPostProcessMetadataEventInfo : PluginEventInfo { } + /// + /// Event info for PostProcessTypeModel + /// + public class PluginPostProcessTypeModelEventInfo : PluginEventInfo { } + /// /// Additional data for PreProcessMetadata /// diff --git a/Il2CppInspector.Common/Plugins/PluginHooks.cs b/Il2CppInspector.Common/Plugins/PluginHooks.cs index 3cf03d5..37e658d 100644 --- a/Il2CppInspector.Common/Plugins/PluginHooks.cs +++ b/Il2CppInspector.Common/Plugins/PluginHooks.cs @@ -7,6 +7,7 @@ // This is the ONLY line to update when the API version changes using System.IO; using Il2CppInspector.PluginAPI.V100; +using Il2CppInspector.Reflection; namespace Il2CppInspector { @@ -21,5 +22,8 @@ namespace Il2CppInspector stream.Position = 0; p.PreProcessMetadata(stream, e); }); + + public static PluginPostProcessTypeModelEventInfo PostProcessTypeModel(TypeModel typeModel) + => PluginManager.Try((p, e) => p.PostProcessTypeModel(typeModel, e)); } } diff --git a/Il2CppInspector.Common/Reflection/TypeModel.cs b/Il2CppInspector.Common/Reflection/TypeModel.cs index adfe949..228f70c 100644 --- a/Il2CppInspector.Common/Reflection/TypeModel.cs +++ b/Il2CppInspector.Common/Reflection/TypeModel.cs @@ -166,6 +166,9 @@ namespace Il2CppInspector.Reflection GenericMethods[spec].Invoker = MethodInvokers[index]; } } + + // Post-processing hook + PluginHooks.PostProcessTypeModel(this); } // Get generic arguments from either a type or method instanceIndex from a MethodSpec