move 29/31.1/.2 to use tags (-2022,-2023) instead of minor versions
This commit is contained in:
@@ -239,7 +239,7 @@ namespace Il2CppInspector
|
||||
if ((Image.Version == MetadataVersions.V290 || Image.Version == MetadataVersions.V310) &&
|
||||
cr.InteropData + cr.InteropDataCount >= (ulong)Image.Length)
|
||||
{
|
||||
Image.Version = new StructVersion(Image.Version.Major, 1, Image.Version.Tag);
|
||||
Image.Version = new StructVersion(Image.Version.Major, 0, MetadataVersions.Tag2022);
|
||||
cr = Image.ReadMappedVersionedObject<Il2CppCodeRegistration>(codeRegistration);
|
||||
}
|
||||
}
|
||||
@@ -250,9 +250,6 @@ namespace Il2CppInspector
|
||||
// The first item in CodeRegistration is the total number of method pointers
|
||||
vas = FindAllMappedWords(imageBytes, (ulong) metadata.Methods.Count(m => (uint) m.MethodIndex != 0xffff_ffff));
|
||||
|
||||
if (!vas.Any())
|
||||
return (0, 0);
|
||||
|
||||
// The count of method pointers will be followed some bytes later by
|
||||
// the count of custom attribute generators; the distance between them
|
||||
// depends on the il2cpp version so we just use ReadMappedObject to simplify the math
|
||||
|
||||
@@ -206,7 +206,7 @@ namespace Il2CppInspector
|
||||
var secondToken = Methods[1].Token;
|
||||
if (secondToken >> 24 != 0x6)
|
||||
{
|
||||
Version = new StructVersion(Version.Major, 1, Version.Tag);
|
||||
Version = new StructVersion(Version.Major, 0, MetadataVersions.Tag2023);
|
||||
|
||||
Methods = ReadVersionedObjectArray<Il2CppMethodDefinition>(Header.MethodsOffset,
|
||||
Header.MethodsSize / Sizeof<Il2CppMethodDefinition>());
|
||||
|
||||
@@ -69,23 +69,24 @@ public partial record struct Il2CppCodeRegistration
|
||||
public Pointer<Il2CppGuid> Guids;
|
||||
|
||||
[NativeInteger]
|
||||
[VersionCondition(GreaterThan = "22.0", LessThan = "29.0")]
|
||||
[VersionCondition(GreaterThan = "22.0", LessThan = "27.2")]
|
||||
[VersionCondition(EqualTo = "29.0", IncludingTag = "")]
|
||||
public int UnresolvedVirtualCallCount;
|
||||
|
||||
[NativeInteger]
|
||||
[VersionCondition(EqualTo = "29.1"), VersionCondition(EqualTo = "31.1")]
|
||||
[VersionCondition(EqualTo = "29.2"), VersionCondition(EqualTo = "31.2")]
|
||||
[VersionCondition(EqualTo = "29.0", IncludingTag = "2022"), VersionCondition(EqualTo = "31.0", IncludingTag = "2022")]
|
||||
[VersionCondition(EqualTo = "29.0", IncludingTag = "2023"), VersionCondition(EqualTo = "31.0", IncludingTag = "2023")]
|
||||
public uint UnresolvedIndirectCallCount; // UnresolvedVirtualCallCount pre 29.1
|
||||
|
||||
[VersionCondition(GreaterThan = "22.0")]
|
||||
public Pointer<Il2CppMethodPointer> UnresolvedVirtualCallPointers;
|
||||
|
||||
[VersionCondition(EqualTo = "29.1"), VersionCondition(EqualTo = "31.1")]
|
||||
[VersionCondition(EqualTo = "29.2"), VersionCondition(EqualTo = "31.2")]
|
||||
[VersionCondition(EqualTo = "29.0", IncludingTag = "2022"), VersionCondition(EqualTo = "31.0", IncludingTag = "2022")]
|
||||
[VersionCondition(EqualTo = "29.0", IncludingTag = "2023"), VersionCondition(EqualTo = "31.0", IncludingTag = "2023")]
|
||||
public Pointer<Il2CppMethodPointer> UnresolvedInstanceCallWrappers;
|
||||
|
||||
[VersionCondition(EqualTo = "29.1"), VersionCondition(EqualTo = "31.1")]
|
||||
[VersionCondition(EqualTo = "29.2"), VersionCondition(EqualTo = "31.2")]
|
||||
[VersionCondition(EqualTo = "29.0", IncludingTag = "2022"), VersionCondition(EqualTo = "31.0", IncludingTag = "2022")]
|
||||
[VersionCondition(EqualTo = "29.0", IncludingTag = "2023"), VersionCondition(EqualTo = "31.0", IncludingTag = "2023")]
|
||||
public Pointer<Il2CppMethodPointer> UnresolvedStaticCallPointers;
|
||||
|
||||
[NativeInteger]
|
||||
|
||||
@@ -19,8 +19,6 @@ public partial record struct Il2CppMethodDefinition
|
||||
public TypeIndex ReturnType { get; private set; }
|
||||
|
||||
[VersionCondition(EqualTo = "31.0")]
|
||||
[VersionCondition(EqualTo = "31.1")]
|
||||
[VersionCondition(EqualTo = "31.2")]
|
||||
public uint ReturnParameterToken { get; private set; }
|
||||
|
||||
public ParameterIndex ParameterStart { get; private set; }
|
||||
@@ -51,8 +49,8 @@ public partial record struct Il2CppMethodDefinition
|
||||
public ushort Slot { get; private set; }
|
||||
public ushort ParameterCount { get; private set; }
|
||||
|
||||
[VersionCondition(EqualTo = "29.2")]
|
||||
[VersionCondition(EqualTo = "31.2")]
|
||||
[VersionCondition(EqualTo = "29.0", IncludingTag = "2023")]
|
||||
[VersionCondition(EqualTo = "31.0", IncludingTag = "2023")]
|
||||
public bool IsUnmanagedCallersOnly { get; private set; }
|
||||
|
||||
public readonly MethodAttributes Attributes => (MethodAttributes)Flags;
|
||||
|
||||
@@ -22,12 +22,10 @@ public static class MetadataVersions
|
||||
public static readonly StructVersion V271 = new(27, 1);
|
||||
public static readonly StructVersion V272 = new(27, 2);
|
||||
|
||||
// These two versions have three variations:
|
||||
public static readonly StructVersion V290 = new(29);
|
||||
public static readonly StructVersion V310 = new(31);
|
||||
|
||||
public static readonly StructVersion V291 = new(29, 1);
|
||||
public static readonly StructVersion V311 = new(31, 1);
|
||||
|
||||
public static readonly StructVersion V292 = new(29, 2);
|
||||
public static readonly StructVersion V312 = new(31, 2);
|
||||
// No tag - 29.0/31.0
|
||||
public static readonly string Tag2022 = "2022"; // 29.1/31.1
|
||||
public static readonly string Tag2023 = "2023"; // 29.2/31.2
|
||||
}
|
||||
@@ -154,10 +154,14 @@ namespace VersionedSerialization.Generator
|
||||
generator.AppendLine($"&& version == Versions.{GetVersionIdentifier(condition.EqualTo.Value)}");
|
||||
|
||||
if (condition.IncludingTag != null)
|
||||
generator.AppendLine($"&& version.Tag == \"{condition.IncludingTag}\"");
|
||||
generator.AppendLine(condition.IncludingTag == ""
|
||||
? "&& version.Tag == null"
|
||||
: $"&& version.Tag == \"{condition.IncludingTag}\"");
|
||||
|
||||
if (condition.ExcludingTag != null)
|
||||
generator.AppendLine($"&& version.Tag != \"{condition.ExcludingTag}\"");
|
||||
generator.AppendLine(condition.IncludingTag == ""
|
||||
? "&& version.Tag != null"
|
||||
: $"&& version.Tag != \"{condition.IncludingTag}\"");
|
||||
|
||||
generator.AppendLine(")");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user