Plugins: Add IPostProcessPackage

This commit is contained in:
Katy Coe
2020-12-22 03:17:49 +01:00
parent b9409e7425
commit e058c39f19
4 changed files with 19 additions and 2 deletions

View File

@@ -159,7 +159,7 @@ namespace Il2CppInspector
return usages.Values.ToList(); return usages.Values.ToList();
} }
public List<MetadataUsage> buildLateBindingMetadataUsages() private List<MetadataUsage> buildLateBindingMetadataUsages()
{ {
// plagiarism. noun - https://www.lexico.com/en/definition/plagiarism // plagiarism. noun - https://www.lexico.com/en/definition/plagiarism
// the practice of taking someone else's work or ideas and passing them off as one's own. // the practice of taking someone else's work or ideas and passing them off as one's own.
@@ -314,7 +314,8 @@ namespace Il2CppInspector
// Merge all metadata usage references into a single distinct list // Merge all metadata usage references into a single distinct list
MetadataUsages = buildMetadataUsages(); MetadataUsages = buildMetadataUsages();
// TODO: Plugin hook PostProcessPackage // Plugin hook PostProcessPackage
PluginHooks.PostProcessPackage(this);
} }
// Get a method pointer if available // Get a method pointer if available

View File

@@ -44,6 +44,14 @@ namespace Il2CppInspector.PluginAPI.V100
void GetStringLiterals(Metadata metadata, PluginGetStringLiteralsEventInfo data); void GetStringLiterals(Metadata metadata, PluginGetStringLiteralsEventInfo data);
} }
/// <summary>
/// Post-process the entire IL2CPP application package after the metadata and binary have been loaded and merged
/// </summary>
public interface IPostProcessPackage
{
void PostProcessPackage(Il2CppInspector package, PluginPostProcessPackageEventInfo data);
}
/// <summary> /// <summary>
/// Post-process the .NET type model to make changes after it has been fully created /// Post-process the .NET type model to make changes after it has been fully created
/// </summary> /// </summary>

View File

@@ -88,6 +88,11 @@ namespace Il2CppInspector.PluginAPI.V100
public List<string> StringLiterals { get; set; } = new List<string>(); public List<string> StringLiterals { get; set; } = new List<string>();
} }
/// <summary>
/// Event info for PostProcessPackage
/// </summary>
public class PluginPostProcessPackageEventInfo : PluginEventInfo { }
/// <summary> /// <summary>
/// Event info for PostProcessTypeModel /// Event info for PostProcessTypeModel
/// </summary> /// </summary>

View File

@@ -30,6 +30,9 @@ namespace Il2CppInspector
public static PluginGetStringLiteralsEventInfo GetStringLiterals(Metadata metadata) public static PluginGetStringLiteralsEventInfo GetStringLiterals(Metadata metadata)
=> PluginManager.Try<IGetStringLiterals, PluginGetStringLiteralsEventInfo>((p, e) => p.GetStringLiterals(metadata, e)); => PluginManager.Try<IGetStringLiterals, PluginGetStringLiteralsEventInfo>((p, e) => p.GetStringLiterals(metadata, e));
public static PluginPostProcessPackageEventInfo PostProcessPackage(Il2CppInspector package)
=> PluginManager.Try<IPostProcessPackage, PluginPostProcessPackageEventInfo>((p, e) => p.PostProcessPackage(package, e));
public static PluginPostProcessTypeModelEventInfo PostProcessTypeModel(TypeModel typeModel) public static PluginPostProcessTypeModelEventInfo PostProcessTypeModel(TypeModel typeModel)
=> PluginManager.Try<IPostProcessTypeModel, PluginPostProcessTypeModelEventInfo>((p, e) => p.PostProcessTypeModel(typeModel, e)); => PluginManager.Try<IPostProcessTypeModel, PluginPostProcessTypeModelEventInfo>((p, e) => p.PostProcessTypeModel(typeModel, e));