细节调整

This commit is contained in:
Perfare 2020-02-01 15:20:11 +08:00
parent ee09ac64a2
commit 3787bc959d
4 changed files with 13 additions and 13 deletions

View file

@ -86,8 +86,8 @@ namespace Il2CppDumper
for (uint i = 0; i < elf_header.e_shnum; i++)
{
var section = ReadClass<Elf32_Shdr>(elf_header.e_shoff + elf_header.e_shentsize * i);
string key = ReadStringToNull(section_name_block_off + section.sh_name);
if(!sectionWithName.ContainsKey(key))
var key = ReadStringToNull(section_name_block_off + section.sh_name);
if (!sectionWithName.ContainsKey(key))
{
sectionWithName.Add(key, section);
}

View file

@ -75,8 +75,8 @@ namespace Il2CppDumper
for (int i = 0; i < elf_header.e_shnum; i++)
{
var section = ReadClass<Elf64_Shdr>(elf_header.e_shoff + elf_header.e_shentsize * (ulong)i);
string key = ReadStringToNull(section_name_block_off + section.sh_name);
if(!sectionWithName.ContainsKey(key))
var key = ReadStringToNull(section_name_block_off + section.sh_name);
if (!sectionWithName.ContainsKey(key))
{
sectionWithName.Add(key, section);
}

View file

@ -102,7 +102,7 @@ namespace Il2CppDumper
writer.Write("enum ");
else
writer.Write("class ");
var typeName = GetTypeName(typeDef);
var typeName = GetTypeDefName(typeDef);
writer.Write($"{typeName}");
if (extends.Count > 0)
writer.Write($" : {string.Join(", ", extends)}");
@ -350,7 +350,7 @@ namespace Il2CppDumper
case Il2CppTypeEnum.IL2CPP_TYPE_VALUETYPE:
{
var typeDef = metadata.typeDefs[il2CppType.data.klassIndex];
ret = GetTypeName(typeDef);
ret = GetTypeDefName(typeDef);
break;
}
case Il2CppTypeEnum.IL2CPP_TYPE_GENERICINST:
@ -397,7 +397,7 @@ namespace Il2CppDumper
return ret;
}
public string GetTypeName(Il2CppTypeDefinition typeDef)
public string GetTypeDefName(Il2CppTypeDefinition typeDef)
{
var ret = string.Empty;
if (typeDef.declaringTypeIndex != -1)

View file

@ -54,7 +54,7 @@ namespace Il2CppDumper
for (int typeIndex = imageDef.typeStart; typeIndex < typeEnd; typeIndex++)
{
var typeDef = metadata.typeDefs[typeIndex];
var typeName = GetTypeName(typeDef);
var typeName = GetTypeDefName(typeDef);
typeDefImageIndices.Add(typeDef, imageIndex);
var methodEnd = typeDef.methodStart + typeDef.method_count;
for (var i = typeDef.methodStart; i < methodEnd; ++i)
@ -99,7 +99,7 @@ namespace Il2CppDumper
{
var methodDef = metadata.methodDefs[i.Value];
var typeDef = metadata.typeDefs[methodDef.declaringType];
var typeName = GetTypeName(typeDef);
var typeName = GetTypeDefName(typeDef);
var methodName = typeName + "." + metadata.GetStringFromIndex(methodDef.nameIndex) + "()";
writer.WriteLine($"SetName(0x{il2Cpp.metadataUsages[i.Key]:X}, '{"Method$" + methodName}')");
writer.WriteLine($"idc.set_cmt(0x{il2Cpp.metadataUsages[i.Key]:X}, '{"Method$" + methodName}', 1)");
@ -132,7 +132,7 @@ namespace Il2CppDumper
var methodSpec = il2Cpp.methodSpecs[i.Value];
var methodDef = metadata.methodDefs[methodSpec.methodDefinitionIndex];
var typeDef = metadata.typeDefs[methodDef.declaringType];
var typeName = GetTypeName(typeDef);
var typeName = GetTypeDefName(typeDef, false);
if (methodSpec.classIndexIndex != -1)
{
var classInst = il2Cpp.genericInsts[methodSpec.classIndexIndex];
@ -207,7 +207,7 @@ namespace Il2CppDumper
ret += ".";
}
}
ret += GetTypeName(typeDef);
ret += GetTypeDefName(typeDef);
break;
}
case Il2CppTypeEnum.IL2CPP_TYPE_GENERICINST:
@ -254,7 +254,7 @@ namespace Il2CppDumper
return ret;
}
public string GetTypeName(Il2CppTypeDefinition typeDef)
private string GetTypeDefName(Il2CppTypeDefinition typeDef, bool generic = true)
{
var ret = string.Empty;
if (typeDef.declaringTypeIndex != -1)
@ -263,7 +263,7 @@ namespace Il2CppDumper
}
ret += metadata.GetStringFromIndex(typeDef.nameIndex);
var names = new List<string>();
if (typeDef.genericContainerIndex >= 0)
if (generic && typeDef.genericContainerIndex >= 0)
{
var genericContainer = metadata.genericContainers[typeDef.genericContainerIndex];
for (int i = 0; i < genericContainer.type_argc; i++)