diff --git a/Il2CppInspector/DefineConstants.cs b/Il2CppInspector/DefineConstants.cs index 43d7d99..1ef015d 100644 --- a/Il2CppInspector/DefineConstants.cs +++ b/Il2CppInspector/DefineConstants.cs @@ -39,7 +39,7 @@ public static class DefineConstants "string", "PTR", // Processed separately "BYREF", - "VALUETYPE", // Processed separately + "ValueType", // Processed separately "CLASS", // Processed separately "T", "Array", // Processed separately diff --git a/Il2CppInspector/Il2CppReflector.cs b/Il2CppInspector/Il2CppReflector.cs index e5dd752..f5b9b72 100644 --- a/Il2CppInspector/Il2CppReflector.cs +++ b/Il2CppInspector/Il2CppReflector.cs @@ -43,6 +43,7 @@ namespace Il2CppInspector.Reflection case Il2CppTypeEnum.IL2CPP_TYPE_SZARRAY: case Il2CppTypeEnum.IL2CPP_TYPE_PTR: case Il2CppTypeEnum.IL2CPP_TYPE_VAR: + case Il2CppTypeEnum.IL2CPP_TYPE_MVAR: // Everything that requires special handling return new TypeInfo(this, pType, memberType); diff --git a/Il2CppInspector/Reflection/MethodInfo.cs b/Il2CppInspector/Reflection/MethodInfo.cs index 49b03cc..f74e8bf 100644 --- a/Il2CppInspector/Reflection/MethodInfo.cs +++ b/Il2CppInspector/Reflection/MethodInfo.cs @@ -4,6 +4,7 @@ All rights reserved. */ +using System; using System.Reflection; namespace Il2CppInspector.Reflection @@ -14,6 +15,7 @@ namespace Il2CppInspector.Reflection public Il2CppMethodDefinition Definition { get; } public int Index { get; } public uint VirtualAddress { get; } + public bool HasBody { get; } public override MemberTypes MemberType => MemberTypes.Method; @@ -31,7 +33,10 @@ namespace Il2CppInspector.Reflection base(declaringType) { Definition = pkg.Metadata.Methods[methodIndex]; Index = methodIndex; - VirtualAddress = pkg.Binary.MethodPointers[methodIndex]; + if (Definition.methodIndex >= 0) { + VirtualAddress = pkg.Binary.MethodPointers[Definition.methodIndex]; + HasBody = true; + } Name = pkg.Strings[Definition.nameIndex]; returnType = pkg.TypeUsages[Definition.returnType]; diff --git a/Il2CppInspector/Reflection/TypeInfo.cs b/Il2CppInspector/Reflection/TypeInfo.cs index 5f978fb..1577cc7 100644 --- a/Il2CppInspector/Reflection/TypeInfo.cs +++ b/Il2CppInspector/Reflection/TypeInfo.cs @@ -43,7 +43,7 @@ namespace Il2CppInspector.Reflection { public List DeclaredEvents => throw new NotImplementedException(); public List DeclaredFields { get; } = new List(); public List DeclaredMembers => throw new NotImplementedException(); - public List DeclaredMethods => throw new NotImplementedException(); + public List DeclaredMethods { get; } = new List(); public List DeclaredNestedTypes => throw new NotImplementedException(); public List DeclaredProperties => throw new NotImplementedException(); @@ -136,9 +136,14 @@ namespace Il2CppInspector.Reflection { if (!IsInterface) Attributes |= TypeAttributes.Class; + // Add all fields for (var f = Definition.fieldStart; f < Definition.fieldStart + Definition.field_count; f++) DeclaredFields.Add(new FieldInfo(pkg, f, this)); + // Add all methods + for (var m = Definition.methodStart; m < Definition.methodStart + Definition.method_count; m++) + DeclaredMethods.Add(new MethodInfo(pkg, m, this)); + MemberType = MemberTypes.TypeInfo; } @@ -198,7 +203,7 @@ namespace Il2CppInspector.Reflection { } // Unresolved generic type variable - if (pType.type == Il2CppTypeEnum.IL2CPP_TYPE_VAR) { + if (pType.type == Il2CppTypeEnum.IL2CPP_TYPE_VAR || pType.type == Il2CppTypeEnum.IL2CPP_TYPE_MVAR) { ContainsGenericParameters = true; Attributes |= TypeAttributes.Class; IsGenericParameter = true;