diff --git a/Il2CppDumper/Il2Cpp.cs b/Il2CppDumper/Il2Cpp.cs index b009cb0..6e604e2 100644 --- a/Il2CppDumper/Il2Cpp.cs +++ b/Il2CppDumper/Il2Cpp.cs @@ -10,6 +10,8 @@ namespace Il2CppDumper private Il2CppMetadataRegistration pMetadataRegistration; private Il2CppCodeRegistration pCodeRegistration; public ulong[] methodPointers; + public ulong[] genericMethodPointers; + public ulong[] invokerPointers; public ulong[] customAttributeGenerators; protected long[] fieldOffsets; public Il2CppType[] types; @@ -31,6 +33,8 @@ namespace Il2CppDumper pCodeRegistration = MapVATR(codeRegistration); pMetadataRegistration = MapVATR(metadataRegistration); methodPointers = Array.ConvertAll(MapVATR(pCodeRegistration.methodPointers, (long)pCodeRegistration.methodPointersCount), x => (ulong)x); + genericMethodPointers = Array.ConvertAll(MapVATR(pCodeRegistration.genericMethodPointers, (long)pCodeRegistration.genericMethodPointersCount), x => (ulong)x); + invokerPointers = Array.ConvertAll(MapVATR(pCodeRegistration.invokerPointers, (long)pCodeRegistration.invokerPointersCount), x => (ulong)x); customAttributeGenerators = Array.ConvertAll(MapVATR(pCodeRegistration.customAttributeGenerators, pCodeRegistration.customAttributeCount), x => (ulong)x); fieldOffsets = Array.ConvertAll(MapVATR(pMetadataRegistration.fieldOffsets, pMetadataRegistration.fieldOffsetsCount), x => (long)x); //TODO 在21版本中存在两种FieldOffset,通过判断前5个数值是否为0确认是指针还是int @@ -52,6 +56,8 @@ namespace Il2CppDumper pCodeRegistration = MapVATR(codeRegistration); pMetadataRegistration = MapVATR(metadataRegistration); methodPointers = MapVATR(pCodeRegistration.methodPointers, (long)pCodeRegistration.methodPointersCount); + genericMethodPointers = MapVATR(pCodeRegistration.genericMethodPointers, (long)pCodeRegistration.genericMethodPointersCount); + invokerPointers = MapVATR(pCodeRegistration.invokerPointers, (long)pCodeRegistration.invokerPointersCount); customAttributeGenerators = MapVATR(pCodeRegistration.customAttributeGenerators, pCodeRegistration.customAttributeCount); fieldOffsets = MapVATR(pMetadataRegistration.fieldOffsets, pMetadataRegistration.fieldOffsetsCount); //TODO 在21版本中存在两种FieldOffset,通过判断前5个数值是否为0确认是指针还是int diff --git a/Il2CppDumper/Program.cs b/Il2CppDumper/Program.cs index 5aecbb5..1fcc439 100644 --- a/Il2CppDumper/Program.cs +++ b/Il2CppDumper/Program.cs @@ -407,10 +407,14 @@ namespace Il2CppDumper } } //--MakeFunction - var orderedPointers = il2cpp.methodPointers.OrderBy(x => x).ToArray(); - for (int i = 0; i < orderedPointers.Length - 1; i++) + var orderedPointers = il2cpp.methodPointers.ToList(); + orderedPointers.AddRange(il2cpp.genericMethodPointers.Where(x => x > 0)); + orderedPointers.AddRange(il2cpp.invokerPointers); + orderedPointers.AddRange(il2cpp.customAttributeGenerators); + orderedPointers = orderedPointers.OrderBy(x => x).ToList(); + for (int i = 0; i < orderedPointers.Count - 1; i++) { - scriptwriter.WriteLine($"idc.MakeFunction(0x{orderedPointers[i]:X}, 0x{orderedPointers[i + 1]:X})"); + scriptwriter.WriteLine($"MakeFunction(0x{orderedPointers[i]:X}, 0x{orderedPointers[i + 1]:X})"); } // writer.Close(); diff --git a/Il2CppDumper/Resource1.Designer.cs b/Il2CppDumper/Resource1.Designer.cs index 46e78cb..e0a4d15 100644 --- a/Il2CppDumper/Resource1.Designer.cs +++ b/Il2CppDumper/Resource1.Designer.cs @@ -80,7 +80,8 @@ namespace Il2CppDumper { /// ret = idc.MakeNameEx(addr, str(new_name), SN_NOWARN) /// i = i + 1 /// - ///index = 1 的本地化字符串。 + ///def MakeFunction(start, end): + /// if GetFuncti [字符串的其余部分被截断]"; 的本地化字符串。 /// internal static string ida { get { diff --git a/Il2CppDumper/Resource1.resx b/Il2CppDumper/Resource1.resx index fa2dfe0..42b1f31 100644 --- a/Il2CppDumper/Resource1.resx +++ b/Il2CppDumper/Resource1.resx @@ -137,6 +137,12 @@ def SetMethod(addr, name): ret = idc.MakeNameEx(addr, str(new_name), SN_NOWARN) i = i + 1 +def MakeFunction(start, end): + if GetFunctionAttr(start, FUNCATTR_START) == 0xFFFFFFFF: + idc.MakeFunction(start, end) + else: + idc.SetFunctionEnd(start, end) + index = 1 \ No newline at end of file