重命名

This commit is contained in:
Perfare 2019-04-07 09:25:21 +08:00
parent 0dabcce8dc
commit 69abc36737
4 changed files with 100 additions and 124 deletions

View file

@ -71,7 +71,7 @@ namespace Il2CppDumper
}
}
//先单独处理,因为不知道会不会有问题
for (var index = 0; index < metadata.uiNumTypes; ++index)
for (var index = 0; index < metadata.typeDefs.Length; ++index)
{
var typeDef = metadata.typeDefs[index];
var typeDefinition = typeDefinitionDic[index];
@ -91,7 +91,7 @@ namespace Il2CppDumper
}
}
//处理field, method, property等等
for (var index = 0; index < metadata.uiNumTypes; ++index)
for (var index = 0; index < metadata.typeDefs.Length; ++index)
{
var typeDef = metadata.typeDefs[index];
var typeDefinition = typeDefinitionDic[index];
@ -297,81 +297,81 @@ namespace Il2CppDumper
}
}
private TypeReference GetTypeReference(MemberReference memberReference, Il2CppType pType)
private TypeReference GetTypeReference(MemberReference memberReference, Il2CppType il2CppType)
{
var moduleDefinition = memberReference.Module;
switch (pType.type)
switch (il2CppType.type)
{
case Il2CppTypeEnum.IL2CPP_TYPE_OBJECT:
return moduleDefinition.Import(typeof(Object));
return moduleDefinition.Import(typeof(object));
case Il2CppTypeEnum.IL2CPP_TYPE_VOID:
return moduleDefinition.Import(typeof(void));
case Il2CppTypeEnum.IL2CPP_TYPE_BOOLEAN:
return moduleDefinition.Import(typeof(Boolean));
return moduleDefinition.Import(typeof(bool));
case Il2CppTypeEnum.IL2CPP_TYPE_CHAR:
return moduleDefinition.Import(typeof(Char));
return moduleDefinition.Import(typeof(char));
case Il2CppTypeEnum.IL2CPP_TYPE_I1:
return moduleDefinition.Import(typeof(SByte));
return moduleDefinition.Import(typeof(sbyte));
case Il2CppTypeEnum.IL2CPP_TYPE_U1:
return moduleDefinition.Import(typeof(Byte));
return moduleDefinition.Import(typeof(byte));
case Il2CppTypeEnum.IL2CPP_TYPE_I2:
return moduleDefinition.Import(typeof(Int16));
return moduleDefinition.Import(typeof(short));
case Il2CppTypeEnum.IL2CPP_TYPE_U2:
return moduleDefinition.Import(typeof(UInt16));
return moduleDefinition.Import(typeof(ushort));
case Il2CppTypeEnum.IL2CPP_TYPE_I4:
return moduleDefinition.Import(typeof(Int32));
return moduleDefinition.Import(typeof(int));
case Il2CppTypeEnum.IL2CPP_TYPE_U4:
return moduleDefinition.Import(typeof(UInt32));
return moduleDefinition.Import(typeof(uint));
case Il2CppTypeEnum.IL2CPP_TYPE_I:
return moduleDefinition.Import(typeof(IntPtr));
case Il2CppTypeEnum.IL2CPP_TYPE_U:
return moduleDefinition.Import(typeof(UIntPtr));
case Il2CppTypeEnum.IL2CPP_TYPE_I8:
return moduleDefinition.Import(typeof(Int64));
return moduleDefinition.Import(typeof(long));
case Il2CppTypeEnum.IL2CPP_TYPE_U8:
return moduleDefinition.Import(typeof(UInt64));
return moduleDefinition.Import(typeof(ulong));
case Il2CppTypeEnum.IL2CPP_TYPE_R4:
return moduleDefinition.Import(typeof(Single));
return moduleDefinition.Import(typeof(float));
case Il2CppTypeEnum.IL2CPP_TYPE_R8:
return moduleDefinition.Import(typeof(Double));
return moduleDefinition.Import(typeof(double));
case Il2CppTypeEnum.IL2CPP_TYPE_STRING:
return moduleDefinition.Import(typeof(String));
return moduleDefinition.Import(typeof(string));
case Il2CppTypeEnum.IL2CPP_TYPE_TYPEDBYREF:
return moduleDefinition.Import(typeof(TypedReference));
case Il2CppTypeEnum.IL2CPP_TYPE_CLASS:
case Il2CppTypeEnum.IL2CPP_TYPE_VALUETYPE:
{
var typeDefinition = typeDefinitionDic[pType.data.klassIndex];
var typeDefinition = typeDefinitionDic[il2CppType.data.klassIndex];
return moduleDefinition.Import(typeDefinition);
}
case Il2CppTypeEnum.IL2CPP_TYPE_ARRAY:
{
var arrayType = il2cpp.MapVATR<Il2CppArrayType>(pType.data.array);
var type = il2cpp.GetIl2CppType(arrayType.etype);
return new ArrayType(GetTypeReference(memberReference, type), arrayType.rank);
var arrayType = il2cpp.MapVATR<Il2CppArrayType>(il2CppType.data.array);
var oriType = il2cpp.GetIl2CppType(arrayType.etype);
return new ArrayType(GetTypeReference(memberReference, oriType), arrayType.rank);
}
case Il2CppTypeEnum.IL2CPP_TYPE_GENERICINST:
{
var generic_class = il2cpp.MapVATR<Il2CppGenericClass>(pType.data.generic_class);
var typeDefinition = typeDefinitionDic[generic_class.typeDefinitionIndex];
var genericClass = il2cpp.MapVATR<Il2CppGenericClass>(il2CppType.data.generic_class);
var typeDefinition = typeDefinitionDic[genericClass.typeDefinitionIndex];
var genericInstanceType = new GenericInstanceType(moduleDefinition.Import(typeDefinition));
var pInst = il2cpp.MapVATR<Il2CppGenericInst>(generic_class.context.class_inst);
var pointers = il2cpp.GetPointers(pInst.type_argv, (long)pInst.type_argc);
var genericInst = il2cpp.MapVATR<Il2CppGenericInst>(genericClass.context.class_inst);
var pointers = il2cpp.GetPointers(genericInst.type_argv, (long)genericInst.type_argc);
foreach (var pointer in pointers)
{
var pOriType = il2cpp.GetIl2CppType(pointer);
genericInstanceType.GenericArguments.Add(GetTypeReference(memberReference, pOriType));
var oriType = il2cpp.GetIl2CppType(pointer);
genericInstanceType.GenericArguments.Add(GetTypeReference(memberReference, oriType));
}
return genericInstanceType;
}
case Il2CppTypeEnum.IL2CPP_TYPE_SZARRAY:
{
var type = il2cpp.GetIl2CppType(pType.data.type);
return new ArrayType(GetTypeReference(memberReference, type));
var oriType = il2cpp.GetIl2CppType(il2CppType.data.type);
return new ArrayType(GetTypeReference(memberReference, oriType));
}
case Il2CppTypeEnum.IL2CPP_TYPE_VAR:
{
if (genericParameterDic.TryGetValue(pType, out var genericParameter))
if (genericParameterDic.TryGetValue(il2CppType, out var genericParameter))
{
return genericParameter;
}
@ -380,19 +380,19 @@ namespace Il2CppDumper
var genericName = "T" + (methodDefinition.DeclaringType.GenericParameters.Count + 1);
genericParameter = new GenericParameter(genericName, methodDefinition.DeclaringType);
methodDefinition.DeclaringType.GenericParameters.Add(genericParameter);
genericParameterDic.Add(pType, genericParameter);
genericParameterDic.Add(il2CppType, genericParameter);
return genericParameter;
}
var typeDefinition = (TypeDefinition)memberReference;
var genericName2 = "T" + (typeDefinition.GenericParameters.Count + 1);
genericParameter = new GenericParameter(genericName2, typeDefinition);
typeDefinition.GenericParameters.Add(genericParameter);
genericParameterDic.Add(pType, genericParameter);
genericParameterDic.Add(il2CppType, genericParameter);
return genericParameter;
}
case Il2CppTypeEnum.IL2CPP_TYPE_MVAR:
{
if (genericParameterDic.TryGetValue(pType, out var genericParameter))
if (genericParameterDic.TryGetValue(il2CppType, out var genericParameter))
{
return genericParameter;
}
@ -400,16 +400,16 @@ namespace Il2CppDumper
var genericName = "T" + (methodDefinition.GenericParameters.Count + 1);
genericParameter = new GenericParameter(genericName, methodDefinition);
methodDefinition.GenericParameters.Add(genericParameter);
genericParameterDic.Add(pType, genericParameter);
genericParameterDic.Add(il2CppType, genericParameter);
return genericParameter;
}
case Il2CppTypeEnum.IL2CPP_TYPE_PTR:
{
var type = il2cpp.GetIl2CppType(pType.data.type);
return new PointerType(GetTypeReference(memberReference, type));
var oriType = il2cpp.GetIl2CppType(il2CppType.data.type);
return new PointerType(GetTypeReference(memberReference, oriType));
}
default:
return moduleDefinition.Import(typeof(Object));
return moduleDefinition.Import(typeof(object));
}
}
@ -418,9 +418,9 @@ namespace Il2CppDumper
var pointer = metadata.GetDefaultValueFromIndex(dataIndex);
if (pointer > 0)
{
var pTypeToUse = il2cpp.types[typeIndex];
var defaultValueType = il2cpp.types[typeIndex];
metadata.Position = pointer;
switch (pTypeToUse.type)
switch (defaultValueType.type)
{
case Il2CppTypeEnum.IL2CPP_TYPE_BOOLEAN:
return metadata.ReadBoolean();
@ -447,8 +447,8 @@ namespace Il2CppDumper
case Il2CppTypeEnum.IL2CPP_TYPE_R8:
return metadata.ReadDouble();
case Il2CppTypeEnum.IL2CPP_TYPE_STRING:
var uiLen = metadata.ReadInt32();
return Encoding.UTF8.GetString(metadata.ReadBytes(uiLen));
var len = metadata.ReadInt32();
return Encoding.UTF8.GetString(metadata.ReadBytes(len));
}
}
return null;

View file

@ -130,14 +130,14 @@ namespace Il2CppDumper
return fieldOffsets[fieldIndex];
}
public T[] MapVATR<T>(dynamic uiAddr, long count) where T : new()
public T[] MapVATR<T>(dynamic addr, long count) where T : new()
{
return ReadClassArray<T>(MapVATR(uiAddr), count);
return ReadClassArray<T>(MapVATR(addr), count);
}
public T MapVATR<T>(dynamic uiAddr) where T : new()
public T MapVATR<T>(dynamic addr) where T : new()
{
return ReadClass<T>(MapVATR(uiAddr));
return ReadClass<T>(MapVATR(addr));
}
public Il2CppType GetIl2CppType(ulong pointer)

View file

@ -8,9 +8,7 @@ namespace Il2CppDumper
{
public sealed class Metadata : MyBinaryReader
{
private Il2CppGlobalMetadataHeader pMetadataHdr;
public int uiImageCount;
public int uiNumTypes;
private Il2CppGlobalMetadataHeader metadataHeader;
public Il2CppImageDefinition[] imageDefs;
public Il2CppTypeDefinition[] typeDefs;
public Il2CppMethodDefinition[] methodDefs;
@ -35,13 +33,12 @@ namespace Il2CppDumper
public Metadata(Stream stream, float version) : base(stream)
{
this.version = version;
//pMetadataHdr
pMetadataHdr = ReadClass<Il2CppGlobalMetadataHeader>();
if (pMetadataHdr.sanity != 0xFAB11BAF)
metadataHeader = ReadClass<Il2CppGlobalMetadataHeader>();
if (metadataHeader.sanity != 0xFAB11BAF)
{
throw new Exception("ERROR: Metadata file supplied is not valid metadata file.");
}
switch (pMetadataHdr.version)
switch (metadataHeader.version)
{
case 16:
case 19:
@ -54,52 +51,32 @@ namespace Il2CppDumper
default:
throw new Exception($"ERROR: Metadata file supplied is not a supported version[{version}].");
}
//ImageDefinition
uiImageCount = pMetadataHdr.imagesCount / MySizeOf(typeof(Il2CppImageDefinition));
uiNumTypes = pMetadataHdr.typeDefinitionsCount / MySizeOf(typeof(Il2CppTypeDefinition));
imageDefs = ReadClassArray<Il2CppImageDefinition>(pMetadataHdr.imagesOffset, uiImageCount);
//GetTypeDefinitionFromIndex
typeDefs = ReadClassArray<Il2CppTypeDefinition>(pMetadataHdr.typeDefinitionsOffset, uiNumTypes);
//GetMethodDefinitionFromIndex
methodDefs = ReadClassArray<Il2CppMethodDefinition>(pMetadataHdr.methodsOffset, pMetadataHdr.methodsCount / MySizeOf(typeof(Il2CppMethodDefinition)));
//GetParameterDefinitionFromIndex
parameterDefs = ReadClassArray<Il2CppParameterDefinition>(pMetadataHdr.parametersOffset, pMetadataHdr.parametersCount / MySizeOf(typeof(Il2CppParameterDefinition)));
//GetFieldDefinitionFromIndex
fieldDefs = ReadClassArray<Il2CppFieldDefinition>(pMetadataHdr.fieldsOffset, pMetadataHdr.fieldsCount / MySizeOf(typeof(Il2CppFieldDefinition)));
//FieldDefaultValue
fieldDefaultValues = ReadClassArray<Il2CppFieldDefaultValue>(pMetadataHdr.fieldDefaultValuesOffset, pMetadataHdr.fieldDefaultValuesCount / MySizeOf(typeof(Il2CppFieldDefaultValue)));
//ParameterDefaultValue
parameterDefaultValues = ReadClassArray<Il2CppParameterDefaultValue>(pMetadataHdr.parameterDefaultValuesOffset, pMetadataHdr.parameterDefaultValuesCount / MySizeOf(typeof(Il2CppParameterDefaultValue)));
//GetPropertyDefinitionFromIndex
propertyDefs = ReadClassArray<Il2CppPropertyDefinition>(pMetadataHdr.propertiesOffset, pMetadataHdr.propertiesCount / MySizeOf(typeof(Il2CppPropertyDefinition)));
//GetInterfaceFromIndex
interfaceIndices = ReadClassArray<int>(pMetadataHdr.interfacesOffset, pMetadataHdr.interfacesCount / 4);
//GetNestedTypeFromIndex
nestedTypeIndices = ReadClassArray<int>(pMetadataHdr.nestedTypesOffset, pMetadataHdr.nestedTypesCount / 4);
//GetEventDefinitionFromIndex
eventDefs = ReadClassArray<Il2CppEventDefinition>(pMetadataHdr.eventsOffset, pMetadataHdr.eventsCount / MySizeOf(typeof(Il2CppEventDefinition)));
//GetGenericContainerFromIndex
genericContainers = ReadClassArray<Il2CppGenericContainer>(pMetadataHdr.genericContainersOffset, pMetadataHdr.genericContainersCount / MySizeOf(typeof(Il2CppGenericContainer)));
imageDefs = ReadMetadataClassArray<Il2CppImageDefinition>(metadataHeader.imagesOffset, metadataHeader.imagesCount);
typeDefs = ReadMetadataClassArray<Il2CppTypeDefinition>(metadataHeader.typeDefinitionsOffset, metadataHeader.typeDefinitionsCount);
methodDefs = ReadMetadataClassArray<Il2CppMethodDefinition>(metadataHeader.methodsOffset, metadataHeader.methodsCount);
parameterDefs = ReadMetadataClassArray<Il2CppParameterDefinition>(metadataHeader.parametersOffset, metadataHeader.parametersCount);
fieldDefs = ReadMetadataClassArray<Il2CppFieldDefinition>(metadataHeader.fieldsOffset, metadataHeader.fieldsCount);
fieldDefaultValues = ReadMetadataClassArray<Il2CppFieldDefaultValue>(metadataHeader.fieldDefaultValuesOffset, metadataHeader.fieldDefaultValuesCount);
parameterDefaultValues = ReadMetadataClassArray<Il2CppParameterDefaultValue>(metadataHeader.parameterDefaultValuesOffset, metadataHeader.parameterDefaultValuesCount);
propertyDefs = ReadMetadataClassArray<Il2CppPropertyDefinition>(metadataHeader.propertiesOffset, metadataHeader.propertiesCount);
interfaceIndices = ReadClassArray<int>(metadataHeader.interfacesOffset, metadataHeader.interfacesCount / 4);
nestedTypeIndices = ReadClassArray<int>(metadataHeader.nestedTypesOffset, metadataHeader.nestedTypesCount / 4);
eventDefs = ReadMetadataClassArray<Il2CppEventDefinition>(metadataHeader.eventsOffset, metadataHeader.eventsCount);
genericContainers = ReadMetadataClassArray<Il2CppGenericContainer>(metadataHeader.genericContainersOffset, metadataHeader.genericContainersCount);
if (version > 16)
{
//Il2CppStringLiteral
stringLiterals = ReadClassArray<Il2CppStringLiteral>(pMetadataHdr.stringLiteralOffset, pMetadataHdr.stringLiteralCount / MySizeOf(typeof(Il2CppStringLiteral)));
//Il2CppMetadataUsageList
metadataUsageLists = ReadClassArray<Il2CppMetadataUsageList>(pMetadataHdr.metadataUsageListsOffset, pMetadataHdr.metadataUsageListsCount / MySizeOf(typeof(Il2CppMetadataUsageList)));
//Il2CppMetadataUsagePair
metadataUsagePairs = ReadClassArray<Il2CppMetadataUsagePair>(pMetadataHdr.metadataUsagePairsOffset, pMetadataHdr.metadataUsagePairsCount / MySizeOf(typeof(Il2CppMetadataUsagePair)));
stringLiterals = ReadMetadataClassArray<Il2CppStringLiteral>(metadataHeader.stringLiteralOffset, metadataHeader.stringLiteralCount);
metadataUsageLists = ReadMetadataClassArray<Il2CppMetadataUsageList>(metadataHeader.metadataUsageListsOffset, metadataHeader.metadataUsageListsCount);
metadataUsagePairs = ReadMetadataClassArray<Il2CppMetadataUsagePair>(metadataHeader.metadataUsagePairsOffset, metadataHeader.metadataUsagePairsCount);
CreateStringLiteralDic();
//Il2CppFieldRef
fieldRefs = ReadMetadataClassArray<Il2CppFieldRef>(pMetadataHdr.fieldRefsOffset, pMetadataHdr.fieldRefsCount);
fieldRefs = ReadMetadataClassArray<Il2CppFieldRef>(metadataHeader.fieldRefsOffset, metadataHeader.fieldRefsCount);
}
if (version > 20)
{
//CustomAttributeTypeRange
attributeTypeRanges = ReadClassArray<Il2CppCustomAttributeTypeRange>(pMetadataHdr.attributesInfoOffset, pMetadataHdr.attributesInfoCount / MySizeOf(typeof(Il2CppCustomAttributeTypeRange)));
//AttributeTypes
attributeTypes = ReadClassArray<int>(pMetadataHdr.attributeTypesOffset, pMetadataHdr.attributeTypesCount / 4);
attributeTypeRanges = ReadMetadataClassArray<Il2CppCustomAttributeTypeRange>(metadataHeader.attributesInfoOffset, metadataHeader.attributesInfoCount);
attributeTypes = ReadClassArray<int>(metadataHeader.attributeTypesOffset, metadataHeader.attributeTypesCount / 4);
}
}
@ -120,12 +97,12 @@ namespace Il2CppDumper
public int GetDefaultValueFromIndex(int index)
{
return pMetadataHdr.fieldAndParameterDefaultValueDataOffset + index;
return metadataHeader.fieldAndParameterDefaultValueDataOffset + index;
}
public string GetStringFromIndex(int index)
{
return ReadStringToNull(pMetadataHdr.stringOffset + index);
return ReadStringToNull(metadataHeader.stringOffset + index);
}
public int GetCustomAttributeIndex(Il2CppImageDefinition imageDef, int customAttributeIndex, uint token)
@ -151,7 +128,7 @@ namespace Il2CppDumper
public string GetStringLiteralFromIndex(uint index)
{
var stringLiteral = stringLiterals[index];
Position = pMetadataHdr.stringLiteralDataOffset + stringLiteral.dataIndex;
Position = metadataHeader.stringLiteralDataOffset + stringLiteral.dataIndex;
return Encoding.UTF8.GetString(ReadBytes((int)stringLiteral.length));
}
@ -176,7 +153,6 @@ namespace Il2CppDumper
maxMetadataUsages = metadataUsageDic[5].Last().Key + 1;
}
private uint GetEncodedIndexType(uint index)
{
return (index & 0xE0000000) >> 29;

View file

@ -33,14 +33,14 @@ namespace Il2CppDumper
{
if (args[0] == "-h" || args[0] == "--help" || args[0] == "/?" || args[0] == "/h")
{
ShowHelp(System.AppDomain.CurrentDomain.FriendlyName);
ShowHelp(AppDomain.CurrentDomain.FriendlyName);
return;
}
}
if (args.Length > 2)
{
ShowHelp(System.AppDomain.CurrentDomain.FriendlyName);
ShowHelp(AppDomain.CurrentDomain.FriendlyName);
return;
}
@ -236,7 +236,7 @@ namespace Il2CppDumper
var scriptwriter = new StreamWriter(new FileStream("script.py", FileMode.Create), new UTF8Encoding(false));
scriptwriter.WriteLine(Resource1.ida);
//dump image
for (var imageIndex = 0; imageIndex < metadata.uiImageCount; imageIndex++)
for (var imageIndex = 0; imageIndex < metadata.imageDefs.Length; imageIndex++)
{
var imageDef = metadata.imageDefs[imageIndex];
writer.Write($"// Image {imageIndex}: {metadata.GetStringFromIndex(imageDef.nameIndex)} - {imageDef.typeStart}\n");
@ -331,7 +331,7 @@ namespace Il2CppDumper
//dump_field(i, idx, i - typeDef.fieldStart);
var fieldDef = metadata.fieldDefs[i];
var fieldType = il2cpp.types[fieldDef.typeIndex];
var fieldDefault = metadata.GetFieldDefaultValueFromIndex(i);
var fieldDefaultValue = metadata.GetFieldDefaultValueFromIndex(i);
writer.Write(GetCustomAttribute(imageDef, fieldDef.customAttributeIndex, fieldDef.token, "\t"));
writer.Write("\t");
var access = fieldType.attrs & FIELD_ATTRIBUTE_FIELD_ACCESS_MASK;
@ -366,15 +366,15 @@ namespace Il2CppDumper
writer.Write("readonly ");
}
writer.Write($"{GetTypeName(fieldType)} {metadata.GetStringFromIndex(fieldDef.nameIndex)}");
if (fieldDefault != null && fieldDefault.dataIndex != -1)
if (fieldDefaultValue != null && fieldDefaultValue.dataIndex != -1)
{
var pointer = metadata.GetDefaultValueFromIndex(fieldDefault.dataIndex);
var pointer = metadata.GetDefaultValueFromIndex(fieldDefaultValue.dataIndex);
if (pointer > 0)
{
var fieldDefaultType = il2cpp.types[fieldDefault.typeIndex];
var fieldDefaultValueType = il2cpp.types[fieldDefaultValue.typeIndex];
metadata.Position = pointer;
object val = null;
switch (fieldDefaultType.type)
switch (fieldDefaultValueType.type)
{
case Il2CppTypeEnum.IL2CPP_TYPE_BOOLEAN:
val = metadata.ReadBoolean();
@ -543,9 +543,9 @@ namespace Il2CppDumper
}
scriptwriter.WriteLine("print('Make method name done')");
//Script - MetadataUsage
scriptwriter.WriteLine("print('Setting MetadataUsage...')");
if (il2cpp.version > 16)
{
scriptwriter.WriteLine("print('Setting MetadataUsage...')");
foreach (var i in metadata.metadataUsageDic[1]) //kIl2CppMetadataUsageTypeInfo
{
var type = il2cpp.types[i.Value];
@ -614,8 +614,8 @@ namespace Il2CppDumper
}
scriptwriter.WriteLine($"idc.MakeComm(0x{il2cpp.metadataUsages[i.Key]:X}, r'0x{methodPointer:X}')");
}
scriptwriter.WriteLine("print('Set MetadataUsage done')");
}
scriptwriter.WriteLine("print('Set MetadataUsage done')");
//Script - MakeFunction
if (config.MakeFunction)
{
@ -656,15 +656,15 @@ namespace Il2CppDumper
}
}
private static string GetTypeName(Il2CppType pType, bool fullName = false)
private static string GetTypeName(Il2CppType type, bool fullName = false)
{
string ret;
switch (pType.type)
switch (type.type)
{
case Il2CppTypeEnum.IL2CPP_TYPE_CLASS:
case Il2CppTypeEnum.IL2CPP_TYPE_VALUETYPE:
{
var typeDef = metadata.typeDefs[pType.data.klassIndex];
var typeDef = metadata.typeDefs[type.data.klassIndex];
ret = string.Empty;
if (fullName)
{
@ -679,41 +679,41 @@ namespace Il2CppDumper
}
case Il2CppTypeEnum.IL2CPP_TYPE_GENERICINST:
{
var generic_class = il2cpp.MapVATR<Il2CppGenericClass>(pType.data.generic_class);
var pMainDef = metadata.typeDefs[generic_class.typeDefinitionIndex];
ret = metadata.GetStringFromIndex(pMainDef.nameIndex);
var generic_class = il2cpp.MapVATR<Il2CppGenericClass>(type.data.generic_class);
var typeDef = metadata.typeDefs[generic_class.typeDefinitionIndex];
ret = metadata.GetStringFromIndex(typeDef.nameIndex);
var typeNames = new List<string>();
var pInst = il2cpp.MapVATR<Il2CppGenericInst>(generic_class.context.class_inst);
var pointers = il2cpp.GetPointers(pInst.type_argv, (long)pInst.type_argc);
for (uint i = 0; i < pInst.type_argc; ++i)
var genericInst = il2cpp.MapVATR<Il2CppGenericInst>(generic_class.context.class_inst);
var pointers = il2cpp.GetPointers(genericInst.type_argv, (long)genericInst.type_argc);
for (uint i = 0; i < genericInst.type_argc; ++i)
{
var pOriType = il2cpp.GetIl2CppType(pointers[i]);
typeNames.Add(GetTypeName(pOriType));
var oriType = il2cpp.GetIl2CppType(pointers[i]);
typeNames.Add(GetTypeName(oriType));
}
ret += $"<{string.Join(", ", typeNames)}>";
break;
}
case Il2CppTypeEnum.IL2CPP_TYPE_ARRAY:
{
var arrayType = il2cpp.MapVATR<Il2CppArrayType>(pType.data.array);
var type = il2cpp.GetIl2CppType(arrayType.etype);
ret = $"{GetTypeName(type)}[{new string(',', arrayType.rank - 1)}]";
var arrayType = il2cpp.MapVATR<Il2CppArrayType>(type.data.array);
var oriType = il2cpp.GetIl2CppType(arrayType.etype);
ret = $"{GetTypeName(oriType)}[{new string(',', arrayType.rank - 1)}]";
break;
}
case Il2CppTypeEnum.IL2CPP_TYPE_SZARRAY:
{
var type = il2cpp.GetIl2CppType(pType.data.type);
ret = $"{GetTypeName(type)}[]";
var oriType = il2cpp.GetIl2CppType(type.data.type);
ret = $"{GetTypeName(oriType)}[]";
break;
}
case Il2CppTypeEnum.IL2CPP_TYPE_PTR:
{
var type = il2cpp.GetIl2CppType(pType.data.type);
ret = $"{GetTypeName(type)}*";
var oriType = il2cpp.GetIl2CppType(type.data.type);
ret = $"{GetTypeName(oriType)}*";
break;
}
default:
ret = TypeString[(int)pType.type];
ret = TypeString[(int)type.type];
break;
}