mirror of
https://github.com/Perfare/Il2CppDumper.git
synced 2025-01-25 02:03:02 -03:00
Fixed ##545
This commit is contained in:
parent
c8169373f3
commit
59eefafcf4
1 changed files with 50 additions and 42 deletions
|
@ -90,60 +90,68 @@ namespace Il2CppDumper
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (var index = 0; index < metadata.typeDefs.Length; ++index)
|
foreach (var imageDef in metadata.imageDefs)
|
||||||
{
|
{
|
||||||
var typeDef = metadata.typeDefs[index];
|
var typeEnd = imageDef.typeStart + imageDef.typeCount;
|
||||||
var typeDefinition = typeDefinitionDic[typeDef];
|
for (var index = imageDef.typeStart; index < typeEnd; ++index)
|
||||||
|
|
||||||
//nestedtype
|
|
||||||
for (int i = 0; i < typeDef.nested_type_count; i++)
|
|
||||||
{
|
{
|
||||||
var nestedIndex = metadata.nestedTypeIndices[typeDef.nestedTypesStart + i];
|
var typeDef = metadata.typeDefs[index];
|
||||||
var nestedTypeDef = metadata.typeDefs[nestedIndex];
|
var typeDefinition = typeDefinitionDic[typeDef];
|
||||||
var nestedTypeDefinition = typeDefinitionDic[nestedTypeDef];
|
|
||||||
typeDefinition.NestedTypes.Add(nestedTypeDefinition);
|
//nestedtype
|
||||||
|
for (int i = 0; i < typeDef.nested_type_count; i++)
|
||||||
|
{
|
||||||
|
var nestedIndex = metadata.nestedTypeIndices[typeDef.nestedTypesStart + i];
|
||||||
|
var nestedTypeDef = metadata.typeDefs[nestedIndex];
|
||||||
|
var nestedTypeDefinition = typeDefinitionDic[nestedTypeDef];
|
||||||
|
typeDefinition.NestedTypes.Add(nestedTypeDefinition);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//提前处理
|
//提前处理
|
||||||
for (var index = 0; index < metadata.typeDefs.Length; ++index)
|
foreach (var imageDef in metadata.imageDefs)
|
||||||
{
|
{
|
||||||
var typeDef = metadata.typeDefs[index];
|
var typeEnd = imageDef.typeStart + imageDef.typeCount;
|
||||||
var typeDefinition = typeDefinitionDic[typeDef];
|
for (var index = imageDef.typeStart; index < typeEnd; ++index)
|
||||||
|
|
||||||
if (addToken)
|
|
||||||
{
|
{
|
||||||
var customTokenAttribute = new CustomAttribute(typeDefinition.Module.ImportReference(tokenAttribute));
|
var typeDef = metadata.typeDefs[index];
|
||||||
customTokenAttribute.Fields.Add(new CustomAttributeNamedArgument("Token", new CustomAttributeArgument(stringType, $"0x{typeDef.token:X}")));
|
var typeDefinition = typeDefinitionDic[typeDef];
|
||||||
typeDefinition.CustomAttributes.Add(customTokenAttribute);
|
|
||||||
}
|
|
||||||
|
|
||||||
//genericParameter
|
if (addToken)
|
||||||
if (typeDef.genericContainerIndex >= 0)
|
|
||||||
{
|
|
||||||
var genericContainer = metadata.genericContainers[typeDef.genericContainerIndex];
|
|
||||||
for (int i = 0; i < genericContainer.type_argc; i++)
|
|
||||||
{
|
{
|
||||||
var genericParameterIndex = genericContainer.genericParameterStart + i;
|
var customTokenAttribute = new CustomAttribute(typeDefinition.Module.ImportReference(tokenAttribute));
|
||||||
var param = metadata.genericParameters[genericParameterIndex];
|
customTokenAttribute.Fields.Add(new CustomAttributeNamedArgument("Token", new CustomAttributeArgument(stringType, $"0x{typeDef.token:X}")));
|
||||||
var genericParameter = CreateGenericParameter(param, typeDefinition);
|
typeDefinition.CustomAttributes.Add(customTokenAttribute);
|
||||||
typeDefinition.GenericParameters.Add(genericParameter);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//parent
|
//genericParameter
|
||||||
if (typeDef.parentIndex >= 0)
|
if (typeDef.genericContainerIndex >= 0)
|
||||||
{
|
{
|
||||||
var parentType = il2Cpp.types[typeDef.parentIndex];
|
var genericContainer = metadata.genericContainers[typeDef.genericContainerIndex];
|
||||||
var parentTypeRef = GetTypeReference(typeDefinition, parentType);
|
for (int i = 0; i < genericContainer.type_argc; i++)
|
||||||
typeDefinition.BaseType = parentTypeRef;
|
{
|
||||||
}
|
var genericParameterIndex = genericContainer.genericParameterStart + i;
|
||||||
|
var param = metadata.genericParameters[genericParameterIndex];
|
||||||
|
var genericParameter = CreateGenericParameter(param, typeDefinition);
|
||||||
|
typeDefinition.GenericParameters.Add(genericParameter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//interfaces
|
//parent
|
||||||
for (int i = 0; i < typeDef.interfaces_count; i++)
|
if (typeDef.parentIndex >= 0)
|
||||||
{
|
{
|
||||||
var interfaceType = il2Cpp.types[metadata.interfaceIndices[typeDef.interfacesStart + i]];
|
var parentType = il2Cpp.types[typeDef.parentIndex];
|
||||||
var interfaceTypeRef = GetTypeReference(typeDefinition, interfaceType);
|
var parentTypeRef = GetTypeReference(typeDefinition, parentType);
|
||||||
typeDefinition.Interfaces.Add(new InterfaceImplementation(interfaceTypeRef));
|
typeDefinition.BaseType = parentTypeRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
//interfaces
|
||||||
|
for (int i = 0; i < typeDef.interfaces_count; i++)
|
||||||
|
{
|
||||||
|
var interfaceType = il2Cpp.types[metadata.interfaceIndices[typeDef.interfacesStart + i]];
|
||||||
|
var interfaceTypeRef = GetTypeReference(typeDefinition, interfaceType);
|
||||||
|
typeDefinition.Interfaces.Add(new InterfaceImplementation(interfaceTypeRef));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//处理field, method, property等等
|
//处理field, method, property等等
|
||||||
|
|
Loading…
Add table
Reference in a new issue