diff --git a/Il2CppDumper/Attributes/VersionAttribute.cs b/Il2CppDumper/Attributes/VersionAttribute.cs index 3e7cdfd..e10855f 100644 --- a/Il2CppDumper/Attributes/VersionAttribute.cs +++ b/Il2CppDumper/Attributes/VersionAttribute.cs @@ -5,7 +5,7 @@ namespace Il2CppDumper [AttributeUsage(AttributeTargets.Field, AllowMultiple = true)] class VersionAttribute : Attribute { - public float Min { get; set; } = 0; - public float Max { get; set; } = 99; + public double Min { get; set; } = 0; + public double Max { get; set; } = 99; } } diff --git a/Il2CppDumper/Config.cs b/Il2CppDumper/Config.cs index 08a9c39..4f4f109 100644 --- a/Il2CppDumper/Config.cs +++ b/Il2CppDumper/Config.cs @@ -14,6 +14,6 @@ public bool DummyDllAddToken = true; public bool RequireAnyKey = true; public bool ForceIl2CppVersion = false; - public float ForceVersion = 24.3f; + public double ForceVersion = 24.3; } } diff --git a/Il2CppDumper/ExecutableFormats/Elf.cs b/Il2CppDumper/ExecutableFormats/Elf.cs index d7a602f..1900aef 100644 --- a/Il2CppDumper/ExecutableFormats/Elf.cs +++ b/Il2CppDumper/ExecutableFormats/Elf.cs @@ -106,7 +106,7 @@ namespace Il2CppDumper uint codeRegistration = 0; uint metadataRegistration = 0; var result = (uint)resultList[0]; - if (Version < 24f) + if (Version < 24) { if (elfHeader.e_machine == EM_ARM) { @@ -118,7 +118,7 @@ namespace Il2CppDumper metadataRegistration = ReadUInt32(); } } - else if (Version >= 24f) + else if (Version >= 24) { if (elfHeader.e_machine == EM_ARM) { diff --git a/Il2CppDumper/IO/BinaryStream.cs b/Il2CppDumper/IO/BinaryStream.cs index 913b8c0..2c7b9cd 100644 --- a/Il2CppDumper/IO/BinaryStream.cs +++ b/Il2CppDumper/IO/BinaryStream.cs @@ -9,7 +9,7 @@ namespace Il2CppDumper { public class BinaryStream : IDisposable { - public float Version; + public double Version; public bool Is32Bit; private Stream stream; private BinaryReader reader; diff --git a/Il2CppDumper/Il2Cpp/Il2Cpp.cs b/Il2CppDumper/Il2Cpp/Il2Cpp.cs index d49634a..f80c4e1 100644 --- a/Il2CppDumper/Il2Cpp/Il2Cpp.cs +++ b/Il2CppDumper/Il2Cpp/Il2Cpp.cs @@ -38,7 +38,7 @@ namespace Il2CppDumper protected Il2Cpp(Stream stream) : base(stream) { } - public void SetProperties(float version, long maxMetadataUsages) + public void SetProperties(double version, long maxMetadataUsages) { Version = version; this.maxMetadataUsages = maxMetadataUsages; @@ -48,12 +48,12 @@ namespace Il2CppDumper { if (codeRegistration != 0 && metadataRegistration != 0) { - if (Version == 24.2f) + if (Version == 24.2) { pCodeRegistration = MapVATR(codeRegistration); if (pCodeRegistration.reversePInvokeWrapperCount > 0x30000) //TODO { - Version = 24.4f; + Version = 24.4; codeRegistration -= PointerSize * 3; Console.WriteLine($"Change il2cpp version to: {Version}"); } @@ -64,7 +64,7 @@ namespace Il2CppDumper var genericMethodPointersCount = genericMethodTable.Max(x => x.indices.methodIndex) + 1; if (pCodeRegistration.reversePInvokeWrapperCount == genericMethodPointersCount) { - Version = 24.3f; + Version = 24.3; codeRegistration -= Is32Bit ? 8u : 16u; Console.WriteLine($"Change il2cpp version to: {Version}"); } @@ -83,22 +83,22 @@ namespace Il2CppDumper public virtual void Init(ulong codeRegistration, ulong metadataRegistration) { pCodeRegistration = MapVATR(codeRegistration); - if (Version == 27f) + if (Version == 27) { if (pCodeRegistration.reversePInvokeWrapperCount > 0x30000) //TODO { - Version = 27.1f; + Version = 27.1; codeRegistration -= PointerSize; Console.WriteLine($"Change il2cpp version to: {Version}"); Console.WriteLine("CodeRegistration : {0:x}", codeRegistration); pCodeRegistration = MapVATR(codeRegistration); } } - if (Version == 24.2f) + if (Version == 24.2) { if (pCodeRegistration.reversePInvokeWrapperCount > 0x30000) //TODO { - Version = 24.4f; + Version = 24.4; codeRegistration -= PointerSize * 3; Console.WriteLine($"Change il2cpp version to: {Version}"); Console.WriteLine("CodeRegistration : {0:x}", codeRegistration); @@ -108,7 +108,7 @@ namespace Il2CppDumper { if (pCodeRegistration.codeGenModules == 0) //TODO { - Version = 24.3f; + Version = 24.3; Console.WriteLine($"Change il2cpp version to: {Version}"); pCodeRegistration = MapVATR(codeRegistration); } @@ -156,7 +156,7 @@ namespace Il2CppDumper types[i].Init(); typeDic.Add(pTypes[i], types[i]); } - if (Version >= 24.2f) + if (Version >= 24.2) { var pCodeGenModules = MapVATR(pCodeRegistration.codeGenModules, pCodeRegistration.codeGenModulesCount); codeGenModules = new Dictionary(pCodeGenModules.Length, StringComparer.Ordinal); @@ -270,7 +270,7 @@ namespace Il2CppDumper public ulong GetMethodPointer(string imageName, Il2CppMethodDefinition methodDef) { - if (Version >= 24.2f) + if (Version >= 24.2) { var methodToken = methodDef.token; var ptrs = codeGenModuleMethodPointers[imageName]; diff --git a/Il2CppDumper/Il2Cpp/Il2CppClass.cs b/Il2CppDumper/Il2Cpp/Il2CppClass.cs index 1e4a421..948ade6 100644 --- a/Il2CppDumper/Il2Cpp/Il2CppClass.cs +++ b/Il2CppDumper/Il2Cpp/Il2CppClass.cs @@ -4,9 +4,9 @@ namespace Il2CppDumper { public class Il2CppCodeRegistration { - [Version(Max = 24.1f)] + [Version(Max = 24.1)] public long methodPointersCount; - [Version(Max = 24.1f)] + [Version(Max = 24.1)] public ulong methodPointers; [Version(Max = 21)] public ulong delegateWrappersFromNativeToManagedCount; @@ -30,14 +30,14 @@ namespace Il2CppDumper public ulong ccwMarshalingFunctions; public long genericMethodPointersCount; public ulong genericMethodPointers; - [Version(Min = 24.4f, Max = 24.4f )] - [Version(Min = 27.1f)] + [Version(Min = 24.4, Max = 24.4)] + [Version(Min = 27.1)] public ulong genericAdjustorThunks; public long invokerPointersCount; public ulong invokerPointers; - [Version(Max = 24.4f)] + [Version(Max = 24.4)] public long customAttributeCount; - [Version(Max = 24.4f)] + [Version(Max = 24.4)] public ulong customAttributeGenerators; [Version(Min = 21, Max = 22)] public long guidCount; @@ -51,13 +51,13 @@ namespace Il2CppDumper public ulong interopDataCount; [Version(Min = 23)] public ulong interopData; - [Version(Min = 24.3f)] + [Version(Min = 24.3)] public ulong windowsRuntimeFactoryCount; - [Version(Min = 24.3f)] + [Version(Min = 24.3)] public ulong windowsRuntimeFactoryTable; - [Version(Min = 24.2f)] + [Version(Min = 24.2)] public long codeGenModulesCount; - [Version(Min = 24.2f)] + [Version(Min = 24.2)] public ulong codeGenModules; } @@ -188,7 +188,7 @@ namespace Il2CppDumper public class Il2CppGenericClass { - [Version(Max = 24.4f)] + [Version(Max = 24.4)] public long typeDefinitionIndex; /* the generic type definition */ [Version(Min = 27)] public ulong type; /* the generic type definition */ @@ -230,8 +230,8 @@ namespace Il2CppDumper { public int methodIndex; public int invokerIndex; - [Version(Min = 24.4f, Max = 24.4f)] - [Version(Min = 27.1f)] + [Version(Min = 24.4, Max = 24.4)] + [Version(Min = 27.1)] public int adjustorThunk; }; @@ -247,11 +247,11 @@ namespace Il2CppDumper public ulong moduleName; public long methodPointerCount; public ulong methodPointers; - [Version(Min = 24.4f, Max = 24.4f)] - [Version(Min = 27.1f)] + [Version(Min = 24.4, Max = 24.4)] + [Version(Min = 27.1)] public long adjustorThunkCount; - [Version(Min = 24.4f, Max = 24.4f)] - [Version(Min = 27.1f)] + [Version(Min = 24.4, Max = 24.4)] + [Version(Min = 27.1)] public ulong adjustorThunks; public ulong invokerIndices; public ulong reversePInvokeWrapperCount; diff --git a/Il2CppDumper/Il2Cpp/Metadata.cs b/Il2CppDumper/Il2Cpp/Metadata.cs index 7cb90ef..5ba7130 100644 --- a/Il2CppDumper/Il2Cpp/Metadata.cs +++ b/Il2CppDumper/Il2Cpp/Metadata.cs @@ -56,7 +56,7 @@ namespace Il2CppDumper { if (header.stringLiteralOffset == 264) { - Version = 24.2f; + Version = 24.2; header = ReadClass(0); } else @@ -64,7 +64,7 @@ namespace Il2CppDumper imageDefs = ReadMetadataClassArray(header.imagesOffset, header.imagesCount); if (imageDefs.Any(x => x.token != 1)) { - Version = 24.1f; + Version = 24.1; } } } @@ -114,7 +114,7 @@ namespace Il2CppDumper } } } - if (Version <= 24.1f) + if (Version <= 24.1) { rgctxEntries = ReadMetadataClassArray(header.rgctxEntriesOffset, header.rgctxEntriesCount); } diff --git a/Il2CppDumper/Il2Cpp/MetadataClass.cs b/Il2CppDumper/Il2Cpp/MetadataClass.cs index 046a0c9..88296bc 100644 --- a/Il2CppDumper/Il2Cpp/MetadataClass.cs +++ b/Il2CppDumper/Il2Cpp/MetadataClass.cs @@ -46,21 +46,21 @@ namespace Il2CppDumper public int interfaceOffsetsCount; public uint typeDefinitionsOffset; // Il2CppTypeDefinition public int typeDefinitionsCount; - [Version(Max = 24.1f)] + [Version(Max = 24.1)] public uint rgctxEntriesOffset; // Il2CppRGCTXDefinition - [Version(Max = 24.1f)] + [Version(Max = 24.1)] public int rgctxEntriesCount; public uint imagesOffset; // Il2CppImageDefinition public int imagesCount; public int assembliesOffset; // Il2CppAssemblyDefinition public int assembliesCount; - [Version(Min = 19, Max = 24.4f)] + [Version(Min = 19, Max = 24.4)] public uint metadataUsageListsOffset; // Il2CppMetadataUsageList - [Version(Min = 19, Max = 24.4f)] + [Version(Min = 19, Max = 24.4)] public int metadataUsageListsCount; - [Version(Min = 19, Max = 24.4f)] + [Version(Min = 19, Max = 24.4)] public uint metadataUsagePairsOffset; // Il2CppMetadataUsagePair - [Version(Min = 19, Max = 24.4f)] + [Version(Min = 19, Max = 24.4)] public int metadataUsagePairsCount; [Version(Min = 19)] public uint fieldRefsOffset; // Il2CppFieldRef @@ -117,9 +117,9 @@ namespace Il2CppDumper [Version(Min = 19)] public uint token; - [Version(Min = 24.1f)] + [Version(Min = 24.1)] public int customAttributeStart; - [Version(Min = 24.1f)] + [Version(Min = 24.1)] public uint customAttributeCount; } @@ -130,16 +130,16 @@ namespace Il2CppDumper [Version(Max = 24)] public int customAttributeIndex; public int byvalTypeIndex; - [Version(Max = 24.4f)] + [Version(Max = 24.4)] public int byrefTypeIndex; public int declaringTypeIndex; public int parentIndex; public int elementTypeIndex; // we can probably remove this one. Only used for enums - [Version(Max = 24.1f)] + [Version(Max = 24.1)] public int rgctxStartIndex; - [Version(Max = 24.1f)] + [Version(Max = 24.1)] public int rgctxCount; public int genericContainerIndex; @@ -201,15 +201,15 @@ namespace Il2CppDumper [Version(Max = 24)] public int customAttributeIndex; public int genericContainerIndex; - [Version(Max = 24.1f)] + [Version(Max = 24.1)] public int methodIndex; - [Version(Max = 24.1f)] + [Version(Max = 24.1)] public int invokerIndex; - [Version(Max = 24.1f)] + [Version(Max = 24.1)] public int delegateWrapperIndex; - [Version(Max = 24.1f)] + [Version(Max = 24.1)] public int rgctxStartIndex; - [Version(Max = 24.1f)] + [Version(Max = 24.1)] public int rgctxCount; public uint token; public ushort flags; @@ -258,7 +258,7 @@ namespace Il2CppDumper public class Il2CppCustomAttributeTypeRange { - [Version(Min = 24.1f)] + [Version(Min = 24.1)] public uint token; public int start; public int count; diff --git a/Il2CppDumper/Outputs/StructGenerator.cs b/Il2CppDumper/Outputs/StructGenerator.cs index a01b306..4f15ac5 100644 --- a/Il2CppDumper/Outputs/StructGenerator.cs +++ b/Il2CppDumper/Outputs/StructGenerator.cs @@ -106,7 +106,7 @@ namespace Il2CppDumper var thisType = ParseType(il2Cpp.types[typeDef.byvalTypeIndex]); parameterStrs.Add($"{thisType} __this"); } - else if (il2Cpp.Version <= 24f) + else if (il2Cpp.Version <= 24) { parameterStrs.Add($"Il2CppObject* __this"); } @@ -183,7 +183,7 @@ namespace Il2CppDumper } parameterStrs.Add($"{thisType} __this"); } - else if (il2Cpp.Version <= 24f) + else if (il2Cpp.Version <= 24) { parameterStrs.Add($"Il2CppObject* __this"); } @@ -298,7 +298,7 @@ namespace Il2CppDumper } } List orderedPointers; - if (il2Cpp.Version >= 24.2f) + if (il2Cpp.Version >= 24.2) { orderedPointers = new List(); foreach (var pair in il2Cpp.codeGenModuleMethodPointers) @@ -348,23 +348,23 @@ namespace Il2CppDumper sb.Append(HeaderConstants.GenericHeader); switch (il2Cpp.Version) { - case 22f: + case 22: sb.Append(HeaderConstants.HeaderV22); break; - case 23f: - case 24f: + case 23: + case 24: sb.Append(HeaderConstants.HeaderV240); break; - case 24.1f: + case 24.1: sb.Append(HeaderConstants.HeaderV241); break; - case 24.2f: - case 24.3f: - case 24.4f: //TODO + case 24.2: + case 24.3: + case 24.4: //TODO sb.Append(HeaderConstants.HeaderV242); break; - case 27f: - case 27.1f: //TODO + case 27: + case 27.1: //TODO sb.Append(HeaderConstants.HeaderV27); break; default: @@ -1142,7 +1142,7 @@ namespace Il2CppDumper methodInfoHeader.Append($"\tIl2CppMethodPointer methodPointer;\n"); methodInfoHeader.Append($"\tvoid* invoker_method;\n"); methodInfoHeader.Append($"\tconst char* name;\n"); - if (il2Cpp.Version <= 24f) + if (il2Cpp.Version <= 24) { methodInfoHeader.Append($"\t{structTypeName}_c *declaring_type;\n"); } @@ -1165,7 +1165,7 @@ namespace Il2CppDumper methodInfoHeader.Append($"\t\tconst void* genericMethod;\n"); methodInfoHeader.Append($"\t\tconst void* genericContainer;\n"); methodInfoHeader.Append($"\t}};\n"); - if (il2Cpp.Version <= 24f) + if (il2Cpp.Version <= 24) { methodInfoHeader.Append($"\tint32_t customAttributeIndex;\n"); } diff --git a/Il2CppDumper/Utils/Il2CppExecutor.cs b/Il2CppDumper/Utils/Il2CppExecutor.cs index 5592209..e2ee7b0 100644 --- a/Il2CppDumper/Utils/Il2CppExecutor.cs +++ b/Il2CppDumper/Utils/Il2CppExecutor.cs @@ -234,7 +234,7 @@ namespace Il2CppDumper public Il2CppRGCTXDefinition[] GetRGCTXDefinition(string imageName, Il2CppTypeDefinition typeDef) { Il2CppRGCTXDefinition[] collection = null; - if (il2Cpp.Version >= 24.2f) + if (il2Cpp.Version >= 24.2) { il2Cpp.rgctxsDictionary[imageName].TryGetValue(typeDef.token, out collection); } @@ -252,7 +252,7 @@ namespace Il2CppDumper public Il2CppRGCTXDefinition[] GetRGCTXDefinition(string imageName, Il2CppMethodDefinition methodDef) { Il2CppRGCTXDefinition[] collection = null; - if (il2Cpp.Version >= 24.2f) + if (il2Cpp.Version >= 24.2) { il2Cpp.rgctxsDictionary[imageName].TryGetValue(methodDef.token, out collection); }