diff --git a/Il2CppInspector.Common/Reflection/TypeModel.cs b/Il2CppInspector.Common/Reflection/TypeModel.cs index 493bb6d..9eacd40 100644 --- a/Il2CppInspector.Common/Reflection/TypeModel.cs +++ b/Il2CppInspector.Common/Reflection/TypeModel.cs @@ -51,6 +51,9 @@ namespace Il2CppInspector.Reflection // List of unique custom attributes generators indexed by type (multiple indices above may refer to a single generator function) public Dictionary> CustomAttributeGenerators { get; } + // List of unique custom attributes generators indexed by virtual address + public Dictionary> CustomAttributeGeneratorsByAddress { get; } + // Get an assembly by its image name public Assembly GetAssembly(string name) => Assemblies.FirstOrDefault(a => a.ShortName == name); @@ -137,6 +140,11 @@ namespace Il2CppInspector.Reflection .GroupBy(a => a.AttributeType) .ToDictionary(g => g.Key, g => g.GroupBy(a => a.VirtualAddress.Start).Select(g => g.First()).ToList()); + // Populate list of unique custom attribute generators for each address + CustomAttributeGeneratorsByAddress = AttributesByIndices.Values + .GroupBy(a => a.VirtualAddress.Start) + .ToDictionary(g => g.Key, g => g.GroupBy(a => a.AttributeType).Select(g => g.First()).ToList()); + // Create method invokers (one per signature, in invoker index order) foreach (var method in MethodsByDefinitionIndex) { var index = package.GetInvokerIndex(method.DeclaringType.Assembly.ModuleDefinition, method.Definition);