Implement DeclaredMethods; MVAR, ValueType fixes
This commit is contained in:
@@ -39,7 +39,7 @@ public static class DefineConstants
|
|||||||
"string",
|
"string",
|
||||||
"PTR", // Processed separately
|
"PTR", // Processed separately
|
||||||
"BYREF",
|
"BYREF",
|
||||||
"VALUETYPE", // Processed separately
|
"ValueType", // Processed separately
|
||||||
"CLASS", // Processed separately
|
"CLASS", // Processed separately
|
||||||
"T",
|
"T",
|
||||||
"Array", // Processed separately
|
"Array", // Processed separately
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ namespace Il2CppInspector.Reflection
|
|||||||
case Il2CppTypeEnum.IL2CPP_TYPE_SZARRAY:
|
case Il2CppTypeEnum.IL2CPP_TYPE_SZARRAY:
|
||||||
case Il2CppTypeEnum.IL2CPP_TYPE_PTR:
|
case Il2CppTypeEnum.IL2CPP_TYPE_PTR:
|
||||||
case Il2CppTypeEnum.IL2CPP_TYPE_VAR:
|
case Il2CppTypeEnum.IL2CPP_TYPE_VAR:
|
||||||
|
case Il2CppTypeEnum.IL2CPP_TYPE_MVAR:
|
||||||
// Everything that requires special handling
|
// Everything that requires special handling
|
||||||
return new TypeInfo(this, pType, memberType);
|
return new TypeInfo(this, pType, memberType);
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
All rights reserved.
|
All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace Il2CppInspector.Reflection
|
namespace Il2CppInspector.Reflection
|
||||||
@@ -14,6 +15,7 @@ namespace Il2CppInspector.Reflection
|
|||||||
public Il2CppMethodDefinition Definition { get; }
|
public Il2CppMethodDefinition Definition { get; }
|
||||||
public int Index { get; }
|
public int Index { get; }
|
||||||
public uint VirtualAddress { get; }
|
public uint VirtualAddress { get; }
|
||||||
|
public bool HasBody { get; }
|
||||||
|
|
||||||
public override MemberTypes MemberType => MemberTypes.Method;
|
public override MemberTypes MemberType => MemberTypes.Method;
|
||||||
|
|
||||||
@@ -31,7 +33,10 @@ namespace Il2CppInspector.Reflection
|
|||||||
base(declaringType) {
|
base(declaringType) {
|
||||||
Definition = pkg.Metadata.Methods[methodIndex];
|
Definition = pkg.Metadata.Methods[methodIndex];
|
||||||
Index = 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];
|
Name = pkg.Strings[Definition.nameIndex];
|
||||||
|
|
||||||
returnType = pkg.TypeUsages[Definition.returnType];
|
returnType = pkg.TypeUsages[Definition.returnType];
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace Il2CppInspector.Reflection {
|
|||||||
public List<EventInfo> DeclaredEvents => throw new NotImplementedException();
|
public List<EventInfo> DeclaredEvents => throw new NotImplementedException();
|
||||||
public List<FieldInfo> DeclaredFields { get; } = new List<FieldInfo>();
|
public List<FieldInfo> DeclaredFields { get; } = new List<FieldInfo>();
|
||||||
public List<MemberInfo> DeclaredMembers => throw new NotImplementedException();
|
public List<MemberInfo> DeclaredMembers => throw new NotImplementedException();
|
||||||
public List<MethodInfo> DeclaredMethods => throw new NotImplementedException();
|
public List<MethodInfo> DeclaredMethods { get; } = new List<MethodInfo>();
|
||||||
public List<TypeInfo> DeclaredNestedTypes => throw new NotImplementedException();
|
public List<TypeInfo> DeclaredNestedTypes => throw new NotImplementedException();
|
||||||
public List<PropertyInfo> DeclaredProperties => throw new NotImplementedException();
|
public List<PropertyInfo> DeclaredProperties => throw new NotImplementedException();
|
||||||
|
|
||||||
@@ -136,9 +136,14 @@ namespace Il2CppInspector.Reflection {
|
|||||||
if (!IsInterface)
|
if (!IsInterface)
|
||||||
Attributes |= TypeAttributes.Class;
|
Attributes |= TypeAttributes.Class;
|
||||||
|
|
||||||
|
// Add all fields
|
||||||
for (var f = Definition.fieldStart; f < Definition.fieldStart + Definition.field_count; f++)
|
for (var f = Definition.fieldStart; f < Definition.fieldStart + Definition.field_count; f++)
|
||||||
DeclaredFields.Add(new FieldInfo(pkg, f, this));
|
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;
|
MemberType = MemberTypes.TypeInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,7 +203,7 @@ namespace Il2CppInspector.Reflection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unresolved generic type variable
|
// 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;
|
ContainsGenericParameters = true;
|
||||||
Attributes |= TypeAttributes.Class;
|
Attributes |= TypeAttributes.Class;
|
||||||
IsGenericParameter = true;
|
IsGenericParameter = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user