diff --git a/Il2CppInspector.Common/IL2CPP/Il2CppBinary.cs b/Il2CppInspector.Common/IL2CPP/Il2CppBinary.cs index 2cf485d..b0b599b 100644 --- a/Il2CppInspector.Common/IL2CPP/Il2CppBinary.cs +++ b/Il2CppInspector.Common/IL2CPP/Il2CppBinary.cs @@ -235,7 +235,14 @@ namespace Il2CppInspector CodeGenModulePointers.Add(name, mp.Pointer); // Read method pointers - ModuleMethodPointers.Add(module, Image.ReadMappedArray(module.methodPointers, (int) module.methodPointerCount)); + // If a module contains only interfaces, abstract methods and/or non-concrete generic methods, + // the entire method pointer array will be NULL values, causing the methodPointer to be mapped to .bss + // and therefore out of scope of the binary image + try { + ModuleMethodPointers.Add(module, Image.ReadMappedArray(module.methodPointers, (int) module.methodPointerCount)); + } catch (InvalidOperationException) { + ModuleMethodPointers.Add(module, new ulong[module.methodPointerCount]); + } // Read method invoker pointer indices - one per method MethodInvokerIndices.Add(module, Image.ReadMappedArray(module.invokerIndices, (int) module.methodPointerCount)); diff --git a/Il2CppInspector.Common/Reflection/TypeModel.cs b/Il2CppInspector.Common/Reflection/TypeModel.cs index 6d990f5..adfe949 100644 --- a/Il2CppInspector.Common/Reflection/TypeModel.cs +++ b/Il2CppInspector.Common/Reflection/TypeModel.cs @@ -146,6 +146,7 @@ namespace Il2CppInspector.Reflection .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) + // Generic type definitions have an invoker index of -1 foreach (var method in MethodsByDefinitionIndex) { var index = package.GetInvokerIndex(method.DeclaringType.Assembly.ModuleDefinition, method.Definition); if (index != -1) { @@ -156,7 +157,6 @@ namespace Il2CppInspector.Reflection } } - // TODO: Some invokers are not initialized or missing, need to find out why // Create method invokers sourced from generic method invoker indices foreach (var spec in GenericMethods.Keys) { if (package.GenericMethodInvokerIndices.TryGetValue(spec, out var index)) {