forked from SamboyCoding/Cpp2IL
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIl2CppImageDefinition.cs
More file actions
65 lines (50 loc) · 2.21 KB
/
Copy pathIl2CppImageDefinition.cs
File metadata and controls
65 lines (50 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using System.Linq;
namespace LibCpp2IL.Metadata;
public class Il2CppImageDefinition : ReadableClass
{
public int nameIndex;
public int assemblyIndex;
public Il2CppVariableWidthIndex<Il2CppTypeDefinition> firstTypeIndex;
public uint typeCount;
[Version(Min = 24)] public Il2CppVariableWidthIndex<Il2CppTypeDefinition> exportedTypeStart;
[Version(Min = 24)] public uint exportedTypeCount;
public Il2CppVariableWidthIndex<Il2CppMethodDefinition> entryPointIndex;
public uint token;
[Version(Min = 24.1f)] public int customAttributeStart;
[Version(Min = 24.1f)] public uint customAttributeCount;
public string? Name => OwningContext.Metadata.GetStringFromIndex(nameIndex);
public Il2CppTypeDefinition[] Types => Enumerable
.Range(firstTypeIndex.Value, (int)typeCount)
.Select(Il2CppVariableWidthIndex<Il2CppTypeDefinition>.MakeTemporaryForFixedWidthUsage) // DynWidth: using Enumerable.Range, not read from file, so making temp is ok
.Select(OwningContext.Metadata.GetTypeDefinitionFromIndex)
.ToArray();
public Il2CppTypeDefinition[]? ExportedTypes => IsAtLeast(24)
? Enumerable
.Range(exportedTypeStart.Value, (int)exportedTypeCount)
.Select(OwningContext.Metadata.GetExportedTypeDefintionFromIndex)
.ToArray()
: null;
public override string ToString()
{
return $"Il2CppImageDefinition[Name={Name}]";
}
public override void Read(ClassReadingBinaryReader reader)
{
nameIndex = reader.ReadInt32();
assemblyIndex = reader.ReadInt32();
firstTypeIndex = Il2CppVariableWidthIndex<Il2CppTypeDefinition>.Read(reader);
typeCount = reader.ReadUInt32();
if (IsAtLeast(24f))
{
exportedTypeStart = Il2CppVariableWidthIndex<Il2CppTypeDefinition>.Read(reader);
exportedTypeCount = reader.ReadUInt32();
}
entryPointIndex = Il2CppVariableWidthIndex<Il2CppMethodDefinition>.Read(reader);
token = reader.ReadUInt32();
if (IsAtLeast(24.1f))
{
customAttributeStart = reader.ReadInt32();
customAttributeCount = reader.ReadUInt32();
}
}
}