Roll up Il2CppInspector.Binary and Il2CppInspector.Metadata

This commit is contained in:
Katy Coe
2019-10-16 17:00:30 +02:00
parent 950c2d6f16
commit 3345d4566a
9 changed files with 43 additions and 28 deletions

View File

@@ -1,5 +1,5 @@
/*
Copyright 2017 Katy Coe - http://www.hearthcode.org - http://www.djkaty.com
Copyright 2017-2019 Katy Coe - http://www.hearthcode.org - http://www.djkaty.com
All rights reserved.
*/
@@ -34,7 +34,7 @@ namespace Il2CppInspector.Reflection {
// Initialize from specified assembly index in package
public Assembly(Il2CppReflector model, int imageIndex) {
Model = model;
Definition = Model.Package.Metadata.Images[imageIndex];
Definition = Model.Package.Images[imageIndex];
Index = Definition.assemblyIndex;
FullName = Model.Package.Strings[Definition.nameIndex];
@@ -43,8 +43,8 @@ namespace Il2CppInspector.Reflection {
}
// Find corresponding module (we'll need this for method pointers)
if (Model.Package.Metadata.Version >= 24.1)
Module = Model.Package.Binary.Modules[FullName];
if (Model.Package.Version >= 24.1)
Module = Model.Package.Modules[FullName];
// Generate types in DefinedTypes from typeStart to typeStart+typeCount-1
for (var t = Definition.typeStart; t < Definition.typeStart + Definition.typeCount; t++)

View File

@@ -1,5 +1,5 @@
/*
Copyright 2017 Katy Coe - http://www.hearthcode.org - http://www.djkaty.com
Copyright 2017-2019 Katy Coe - http://www.hearthcode.org - http://www.djkaty.com
All rights reserved.
*/
@@ -33,7 +33,7 @@ namespace Il2CppInspector.Reflection
public EventInfo(Il2CppInspector pkg, int eventIndex, TypeInfo declaringType) :
base(declaringType) {
Definition = pkg.Metadata.Events[eventIndex];
Definition = pkg.Events[eventIndex];
Index = eventIndex;
Name = pkg.Strings[Definition.nameIndex];

View File

@@ -1,5 +1,5 @@
/*
Copyright 2017 Katy Coe - http://www.hearthcode.org - http://www.djkaty.com
Copyright 2017-2019 Katy Coe - http://www.hearthcode.org - http://www.djkaty.com
All rights reserved.
*/
@@ -83,7 +83,7 @@ namespace Il2CppInspector.Reflection {
public FieldInfo(Il2CppInspector pkg, int fieldIndex, TypeInfo declaringType) :
base(declaringType) {
Definition = pkg.Metadata.Fields[fieldIndex];
Definition = pkg.Fields[fieldIndex];
Index = fieldIndex;
Offset = pkg.FieldOffsets[fieldIndex];
Name = pkg.Strings[Definition.nameIndex];

View File

@@ -31,7 +31,7 @@ namespace Il2CppInspector.Reflection
public MethodInfo(Il2CppInspector pkg, int methodIndex, TypeInfo declaringType) :
base(declaringType) {
Definition = pkg.Metadata.Methods[methodIndex];
Definition = pkg.Methods[methodIndex];
Index = methodIndex;
Name = pkg.Strings[Definition.nameIndex];
@@ -39,16 +39,16 @@ namespace Il2CppInspector.Reflection
if (Definition.methodIndex >= 0) {
// Global method pointer array
if (pkg.Metadata.Version < 24.1) {
VirtualAddress = pkg.Binary.MethodPointers[Definition.methodIndex];
if (pkg.Version < 24.1) {
VirtualAddress = pkg.MethodPointers[Definition.methodIndex];
}
// Per-module method pointer array uses the bottom 24 bits of the method's metadata token
// Derived from il2cpp::vm::MetadataCache::GetMethodPointer
else {
var method = (Definition.token & 0xffffff) - 1;
pkg.Binary.Image.Position = pkg.Binary.Image.MapVATR(Assembly.Module.methodPointers + method * 4);
VirtualAddress = pkg.Binary.Image.ReadUInt32();
pkg.BinaryImage.Position = pkg.BinaryImage.MapVATR(Assembly.Module.methodPointers + method * 4);
VirtualAddress = pkg.BinaryImage.ReadUInt32();
}
// Remove ARM Thumb marker LSB if necessary

View File

@@ -1,5 +1,5 @@
/*
Copyright 2017 Katy Coe - http://www.hearthcode.org - http://www.djkaty.com
Copyright 2017-2019 Katy Coe - http://www.hearthcode.org - http://www.djkaty.com
All rights reserved.
*/
@@ -51,8 +51,8 @@ namespace Il2CppInspector.Reflection
return;
}
var param = pkg.Metadata.Params[paramIndex];
Name = pkg.Metadata.Strings[param.nameIndex];
var param = pkg.Params[paramIndex];
Name = pkg.Strings[param.nameIndex];
Position = paramIndex - declaringMethod.Definition.parameterStart;
paramType = pkg.TypeUsages[param.typeIndex];

View File

@@ -1,5 +1,5 @@
/*
Copyright 2017 Katy Coe - http://www.hearthcode.org - http://www.djkaty.com
Copyright 2017-2019 Katy Coe - http://www.hearthcode.org - http://www.djkaty.com
All rights reserved.
*/
@@ -25,7 +25,7 @@ namespace Il2CppInspector.Reflection {
public PropertyInfo(Il2CppInspector pkg, int propIndex, TypeInfo declaringType) :
base(declaringType) {
var prop = pkg.Metadata.Properties[propIndex];
var prop = pkg.Properties[propIndex];
Name = pkg.Strings[prop.nameIndex];

View File

@@ -1,5 +1,5 @@
/*
Copyright 2017 Katy Coe - http://www.hearthcode.org - http://www.djkaty.com
Copyright 2017-2019 Katy Coe - http://www.hearthcode.org - http://www.djkaty.com
All rights reserved.
*/
@@ -183,7 +183,7 @@ namespace Il2CppInspector.Reflection {
// Add all implemented interfaces
implementedInterfaces = new Il2CppType[Definition.interfaces_count];
for (var i = 0; i < Definition.interfaces_count; i++)
implementedInterfaces[i] = pkg.TypeUsages[pkg.Metadata.InterfaceUsageIndices[Definition.interfacesStart + i]];
implementedInterfaces[i] = pkg.TypeUsages[pkg.InterfaceUsageIndices[Definition.interfacesStart + i]];
// Add all fields
for (var f = Definition.fieldStart; f < Definition.fieldStart + Definition.field_count; f++)
@@ -205,7 +205,7 @@ namespace Il2CppInspector.Reflection {
// Initialize type from binary usage
public TypeInfo(Il2CppReflector model, Il2CppType pType, MemberTypes memberType) : base(null) {
var image = model.Package.Binary.Image;
var image = model.Package.BinaryImage;
IsNested = true;
MemberType = memberType;