From 5afa6553240947a77d2278b0a5d5a22afe327687 Mon Sep 17 00:00:00 2001 From: Perfare Date: Wed, 26 Feb 2020 22:06:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dnew=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Il2CppDumper/Outputs/ScriptGenerator.cs | 28 ++++++++++++++++++------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/Il2CppDumper/Outputs/ScriptGenerator.cs b/Il2CppDumper/Outputs/ScriptGenerator.cs index 8878180..3fb8b86 100644 --- a/Il2CppDumper/Outputs/ScriptGenerator.cs +++ b/Il2CppDumper/Outputs/ScriptGenerator.cs @@ -254,6 +254,14 @@ namespace Il2CppDumper { field.FieldName = "_monitor"; } + if (field.FieldName == "register") //hack + { + field.FieldName = "_register"; + } + if (field.FieldName == "_cs") //hack + { + field.FieldName = "__cs"; + } headerClass.Append($"\t{field.FieldTypeName} {field.FieldName};\n"); } headerClass.Append("};\n"); @@ -478,14 +486,6 @@ namespace Il2CppDumper var structFieldInfo = new StructFieldInfo(); structFieldInfo.FieldTypeName = ParseType(fieldType, context); var fieldName = FixName(metadata.GetStringFromIndex(fieldDef.nameIndex)); - if (isParent) - { - var access = fieldType.attrs & FIELD_ATTRIBUTE_FIELD_ACCESS_MASK; - if (access == FIELD_ATTRIBUTE_PRIVATE) - { - fieldName = $"{FixName(metadata.GetStringFromIndex(typeDef.nameIndex))}_{fieldName}"; - } - } structFieldInfo.FieldName = fieldName; if ((fieldType.attrs & FIELD_ATTRIBUTE_STATIC) != 0) { @@ -496,6 +496,18 @@ namespace Il2CppDumper } else { + if (isParent) + { + var access = fieldType.attrs & FIELD_ATTRIBUTE_FIELD_ACCESS_MASK; + if (access == FIELD_ATTRIBUTE_PRIVATE) + { + structFieldInfo.FieldName = $"{FixName(metadata.GetStringFromIndex(typeDef.nameIndex))}_{fieldName}"; + } + } + if (fields.Any(x => x.FieldName == structFieldInfo.FieldName)) + { + structFieldInfo.FieldName = "new_" + structFieldInfo.FieldName; + } fields.Add(structFieldInfo); } }