From cc624ef29312cea5535573a6d0a3af532e90576a Mon Sep 17 00:00:00 2001 From: Perfare Date: Thu, 13 Feb 2020 01:15:10 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Il2CppDumper/ExecutableFormats/Elf.cs | 6 +++--- Il2CppDumper/ExecutableFormats/Il2Cpp.cs | 16 ++++++++-------- Il2CppDumper/ExecutableFormats/Macho.cs | 4 ++-- Il2CppDumper/ExecutableFormats/Macho64.cs | 6 +++--- Il2CppDumper/ExecutableFormats/Metadata.cs | 6 +++--- Il2CppDumper/ExecutableFormats/NSO.cs | 2 +- Il2CppDumper/ExecutableFormats/PE.cs | 2 +- Il2CppDumper/IO/BinaryStream.cs | 10 +++++----- Il2CppDumper/Outputs/Il2CppDecompiler.cs | 2 +- Il2CppDumper/Outputs/ScriptGenerator.cs | 6 +++--- Il2CppDumper/Program.cs | 2 +- Il2CppDumper/Utils/DummyAssemblyGenerator.cs | 2 +- Il2CppDumper/Utils/PlusSearch.cs | 8 ++++---- 13 files changed, 36 insertions(+), 36 deletions(-) diff --git a/Il2CppDumper/ExecutableFormats/Elf.cs b/Il2CppDumper/ExecutableFormats/Elf.cs index adfe7b3..0a28d72 100644 --- a/Il2CppDumper/ExecutableFormats/Elf.cs +++ b/Il2CppDumper/ExecutableFormats/Elf.cs @@ -27,7 +27,7 @@ namespace Il2CppDumper public Elf(Stream stream, float version, long maxMetadataUsages) : base(stream, version, maxMetadataUsages) { - is32Bit = true; + Is32Bit = true; elfHeader = ReadClass(); programSegment = ReadClassArray(elfHeader.e_phoff, elfHeader.e_phnum); try @@ -89,7 +89,7 @@ namespace Il2CppDumper uint codeRegistration = 0; uint metadataRegistration = 0; var result = (uint)resultList[0]; - if (version < 24f) + if (Version < 24f) { if (elfHeader.e_machine == EM_ARM) { @@ -101,7 +101,7 @@ namespace Il2CppDumper metadataRegistration = ReadUInt32(); } } - else if (version >= 24f) + else if (Version >= 24f) { if (elfHeader.e_machine == EM_ARM) { diff --git a/Il2CppDumper/ExecutableFormats/Il2Cpp.cs b/Il2CppDumper/ExecutableFormats/Il2Cpp.cs index d0d7b1f..d36f1f3 100644 --- a/Il2CppDumper/ExecutableFormats/Il2Cpp.cs +++ b/Il2CppDumper/ExecutableFormats/Il2Cpp.cs @@ -35,7 +35,7 @@ namespace Il2CppDumper protected Il2Cpp(Stream stream, float version, long maxMetadataUsages) : base(stream) { - this.version = version; + this.Version = version; this.maxMetadataUsages = maxMetadataUsages; } @@ -58,18 +58,18 @@ namespace Il2CppDumper genericMethodPointers = MapVATR(pCodeRegistration.genericMethodPointers, pCodeRegistration.genericMethodPointersCount); invokerPointers = MapVATR(pCodeRegistration.invokerPointers, pCodeRegistration.invokerPointersCount); customAttributeGenerators = MapVATR(pCodeRegistration.customAttributeGenerators, pCodeRegistration.customAttributeCount); - if (version > 16) + if (Version > 16) { metadataUsages = MapVATR(pMetadataRegistration.metadataUsages, maxMetadataUsages); } - if (version >= 22) + if (Version >= 22) { reversePInvokeWrappers = MapVATR(pCodeRegistration.reversePInvokeWrappers, pCodeRegistration.reversePInvokeWrapperCount); unresolvedVirtualCallPointers = MapVATR(pCodeRegistration.unresolvedVirtualCallPointers, pCodeRegistration.unresolvedVirtualCallCount); } genericInsts = Array.ConvertAll(MapVATR(pMetadataRegistration.genericInsts, pMetadataRegistration.genericInstsCount), x => MapVATR(x)); - fieldOffsetsArePointers = version > 21; - if (version == 21) + fieldOffsetsArePointers = Version > 21; + if (Version == 21) { var fieldTest = MapVATR(pMetadataRegistration.fieldOffsets, 6); fieldOffsetsArePointers = fieldTest[0] == 0 && fieldTest[1] == 0 && fieldTest[2] == 0 && fieldTest[3] == 0 && fieldTest[4] == 0 && fieldTest[5] > 0; @@ -90,7 +90,7 @@ namespace Il2CppDumper types[i].Init(); typeDic.Add(pTypes[i], types[i]); } - if (version >= 24.2f) + if (Version >= 24.2f) { var pCodeGenModules = MapVATR(pCodeRegistration.codeGenModules, pCodeRegistration.codeGenModulesCount); codeGenModules = new Il2CppCodeGenModule[pCodeGenModules.Length]; @@ -159,7 +159,7 @@ namespace Il2CppDumper { if (isValueType) { - if (is32Bit) + if (Is32Bit) { offset -= 8; } @@ -184,7 +184,7 @@ namespace Il2CppDumper public ulong GetMethodPointer(int methodIndex, int methodDefinitionIndex, int imageIndex, uint methodToken) { - if (version >= 24.2f) + if (Version >= 24.2f) { if (genericMethoddDictionary.TryGetValue(methodDefinitionIndex, out var methodPointer)) { diff --git a/Il2CppDumper/ExecutableFormats/Macho.cs b/Il2CppDumper/ExecutableFormats/Macho.cs index e3d5d93..2337896 100644 --- a/Il2CppDumper/ExecutableFormats/Macho.cs +++ b/Il2CppDumper/ExecutableFormats/Macho.cs @@ -16,7 +16,7 @@ namespace Il2CppDumper public Macho(Stream stream, float version, long maxMetadataUsages) : base(stream, version, maxMetadataUsages) { - is32Bit = true; + Is32Bit = true; Position += 16; //skip magic, cputype, cpusubtype, filetype var ncmds = ReadUInt32(); Position += 8; //skip sizeofcmds, flags @@ -64,7 +64,7 @@ namespace Il2CppDumper public override bool Search() { - if (version < 21) + if (Version < 21) { var __mod_init_func = sections.First(x => x.sectname == "__mod_init_func"); var addrs = ReadClassArray(__mod_init_func.offset, __mod_init_func.size / 4u); diff --git a/Il2CppDumper/ExecutableFormats/Macho64.cs b/Il2CppDumper/ExecutableFormats/Macho64.cs index 59564fb..6aa3040 100644 --- a/Il2CppDumper/ExecutableFormats/Macho64.cs +++ b/Il2CppDumper/ExecutableFormats/Macho64.cs @@ -56,7 +56,7 @@ namespace Il2CppDumper public override bool Search() { - if (version < 23) + if (Version < 23) { var __mod_init_func = sections.First(x => x.sectname == "__mod_init_func"); var addrs = ReadClassArray(__mod_init_func.offset, (long)__mod_init_func.size / 8); @@ -89,7 +89,7 @@ namespace Il2CppDumper } } } - if (version == 23) + if (Version == 23) { /* ADRP X0, unk * ADD X0, X0, unk @@ -130,7 +130,7 @@ namespace Il2CppDumper } } } - if (version >= 24) + if (Version >= 24) { /* ADRP X0, unk * ADD X0, X0, unk diff --git a/Il2CppDumper/ExecutableFormats/Metadata.cs b/Il2CppDumper/ExecutableFormats/Metadata.cs index 7da39f1..c17307b 100644 --- a/Il2CppDumper/ExecutableFormats/Metadata.cs +++ b/Il2CppDumper/ExecutableFormats/Metadata.cs @@ -35,7 +35,7 @@ namespace Il2CppDumper public Metadata(Stream stream, float version) : base(stream) { - this.version = version; + this.Version = version; metadataHeader = ReadClass(); if (metadataHeader.sanity != 0xFAB11BAF) { @@ -117,7 +117,7 @@ namespace Il2CppDumper public int GetCustomAttributeIndex(Il2CppImageDefinition imageDef, int customAttributeIndex, uint token) { - if (version > 24) + if (Version > 24) { var end = imageDef.customAttributeStart + imageDef.customAttributeCount; for (int i = imageDef.customAttributeStart; i < end; i++) @@ -181,7 +181,7 @@ namespace Il2CppDumper var attr = (VersionAttribute)Attribute.GetCustomAttribute(i, typeof(VersionAttribute)); if (attr != null) { - if (version < attr.Min || version > attr.Max) + if (Version < attr.Min || Version > attr.Max) continue; } switch (i.FieldType.Name) diff --git a/Il2CppDumper/ExecutableFormats/NSO.cs b/Il2CppDumper/ExecutableFormats/NSO.cs index a620100..3147879 100644 --- a/Il2CppDumper/ExecutableFormats/NSO.cs +++ b/Il2CppDumper/ExecutableFormats/NSO.cs @@ -200,7 +200,7 @@ namespace Il2CppDumper } writer.Flush(); unCompressedStream.Position = 0; - return new NSO(unCompressedStream, version, maxMetadataUsages); + return new NSO(unCompressedStream, Version, maxMetadataUsages); } return this; } diff --git a/Il2CppDumper/ExecutableFormats/PE.cs b/Il2CppDumper/ExecutableFormats/PE.cs index 2233dda..710869b 100644 --- a/Il2CppDumper/ExecutableFormats/PE.cs +++ b/Il2CppDumper/ExecutableFormats/PE.cs @@ -27,7 +27,7 @@ namespace Il2CppDumper var pos = Position; if (fileHeader.Machine == 0x14c) //Intel 386 { - is32Bit = true; + Is32Bit = true; var optionalHeader = ReadClass(); imageBase = optionalHeader.ImageBase; } diff --git a/Il2CppDumper/IO/BinaryStream.cs b/Il2CppDumper/IO/BinaryStream.cs index 0804359..17d74eb 100644 --- a/Il2CppDumper/IO/BinaryStream.cs +++ b/Il2CppDumper/IO/BinaryStream.cs @@ -8,8 +8,8 @@ namespace Il2CppDumper { public class BinaryStream : IDisposable { - public float version; - public bool is32Bit; + public float Version; + public bool Is32Bit; private Stream stream; private BinaryReader reader; private BinaryWriter writer; @@ -94,11 +94,11 @@ namespace Il2CppDumper return ReadUInt16(); case "Byte": return ReadByte(); - case "Int64" when is32Bit: + case "Int64" when Is32Bit: return (long)ReadInt32(); case "Int64": return ReadInt64(); - case "UInt64" when is32Bit: + case "UInt64" when Is32Bit: return (ulong)ReadUInt32(); case "UInt64": return ReadUInt64(); @@ -135,7 +135,7 @@ namespace Il2CppDumper } if (versionAttribute != null) { - if (version < versionAttribute.Min || version > versionAttribute.Max) + if (Version < versionAttribute.Min || Version > versionAttribute.Max) continue; } var fieldType = i.FieldType; diff --git a/Il2CppDumper/Outputs/Il2CppDecompiler.cs b/Il2CppDumper/Outputs/Il2CppDecompiler.cs index 6560ba6..2f29e7c 100644 --- a/Il2CppDumper/Outputs/Il2CppDecompiler.cs +++ b/Il2CppDumper/Outputs/Il2CppDecompiler.cs @@ -362,7 +362,7 @@ namespace Il2CppDumper public string GetCustomAttribute(Il2CppImageDefinition image, int customAttributeIndex, uint token, string padding = "") { - if (il2Cpp.version < 21) + if (il2Cpp.Version < 21) return string.Empty; var attributeIndex = metadata.GetCustomAttributeIndex(image, customAttributeIndex, token); if (attributeIndex >= 0) diff --git a/Il2CppDumper/Outputs/ScriptGenerator.cs b/Il2CppDumper/Outputs/ScriptGenerator.cs index 1452818..657dc09 100644 --- a/Il2CppDumper/Outputs/ScriptGenerator.cs +++ b/Il2CppDumper/Outputs/ScriptGenerator.cs @@ -80,7 +80,7 @@ namespace Il2CppDumper } } writer.WriteLine("print('Make method name done')"); - if (il2Cpp.version > 16) + if (il2Cpp.Version > 16) { writer.WriteLine("print('Setting MetadataUsage...')"); foreach (var i in metadata.metadataUsageDic[1]) //kIl2CppMetadataUsageTypeInfo @@ -158,7 +158,7 @@ namespace Il2CppDumper if (config.MakeFunction) { List orderedPointers; - if (il2Cpp.version >= 24.2f) + if (il2Cpp.Version >= 24.2f) { orderedPointers = new List(); foreach (var methodPointers in il2Cpp.codeGenModuleMethodPointers) @@ -173,7 +173,7 @@ namespace Il2CppDumper orderedPointers.AddRange(il2Cpp.genericMethodPointers); orderedPointers.AddRange(il2Cpp.invokerPointers); orderedPointers.AddRange(il2Cpp.customAttributeGenerators); - if (il2Cpp.version >= 22) + if (il2Cpp.Version >= 22) { orderedPointers.AddRange(il2Cpp.reversePInvokeWrappers); orderedPointers.AddRange(il2Cpp.unresolvedVirtualCallPointers); diff --git a/Il2CppDumper/Program.cs b/Il2CppDumper/Program.cs index 5fa962f..3447b9e 100644 --- a/Il2CppDumper/Program.cs +++ b/Il2CppDumper/Program.cs @@ -194,7 +194,7 @@ namespace Il2CppDumper break; } - var version = config.ForceIl2CppVersion ? config.ForceVersion : metadata.version; + var version = config.ForceIl2CppVersion ? config.ForceVersion : metadata.Version; Console.WriteLine("Initializing il2cpp file..."); var il2CppMemory = new MemoryStream(il2cppBytes); if (isNSO) diff --git a/Il2CppDumper/Utils/DummyAssemblyGenerator.cs b/Il2CppDumper/Utils/DummyAssemblyGenerator.cs index 5ceedd9..755855b 100644 --- a/Il2CppDumper/Utils/DummyAssemblyGenerator.cs +++ b/Il2CppDumper/Utils/DummyAssemblyGenerator.cs @@ -313,7 +313,7 @@ namespace Il2CppDumper } } //第三遍,添加CustomAttribute - if (il2Cpp.version > 20) + if (il2Cpp.Version > 20) { PrepareCustomAttribute(); foreach (var imageDef in metadata.imageDefs) diff --git a/Il2CppDumper/Utils/PlusSearch.cs b/Il2CppDumper/Utils/PlusSearch.cs index 7665636..a46cfd5 100644 --- a/Il2CppDumper/Utils/PlusSearch.cs +++ b/Il2CppDumper/Utils/PlusSearch.cs @@ -148,15 +148,15 @@ namespace Il2CppDumper public ulong FindCodeRegistration() { - if (il2Cpp.is32Bit) + if (il2Cpp.Is32Bit) { - if (il2Cpp.version >= 24.2) + if (il2Cpp.Version >= 24.2) { return FindCodeRegistration32Bit2019(); } return FindCodeRegistration32Bit(); } - if (il2Cpp.version >= 24.2) + if (il2Cpp.Version >= 24.2) { return FindCodeRegistration64Bit2019(); } @@ -165,7 +165,7 @@ namespace Il2CppDumper public ulong FindMetadataRegistration() { - if (il2Cpp.is32Bit) + if (il2Cpp.Is32Bit) { return FindMetadataRegistration32Bit(); }