forked from SamboyCoding/Cpp2IL
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathIl2CppRGCTXDefinition.cs
More file actions
78 lines (65 loc) · 2.56 KB
/
Il2CppRGCTXDefinition.cs
File metadata and controls
78 lines (65 loc) · 2.56 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
66
67
68
69
70
71
72
73
74
75
76
77
78
using LibCpp2IL.Reflection;
namespace LibCpp2IL.BinaryStructures;
public class Il2CppRGCTXDefinition : ReadableClass
{
public Il2CppRGCTXDataType type;
public int _rawIndex;
public int MethodIndex => _defData?.MethodIndex ?? _constrainedData!.MethodIndex;
public int TypeIndex => _defData?.TypeIndex ?? _constrainedData!.TypeIndex;
public Il2CppMethodSpec? MethodSpec => LibCpp2IlMain.Binary?.GetMethodSpec(MethodIndex);
public Il2CppTypeReflectionData? Type => LibCpp2ILUtils.GetTypeReflectionData(LibCpp2IlMain.Binary!.GetType(TypeIndex));
public class Il2CppRGCTXDefinitionData : ReadableClass
{
private int rgctxDataDummy;
public int MethodIndex => rgctxDataDummy;
public int TypeIndex => rgctxDataDummy;
public override void Read(ClassReadingBinaryReader reader)
{
rgctxDataDummy = reader.ReadInt32();
}
}
public class Il2CppRGCTXConstrainedData : ReadableClass
{
public int _typeIndex;
public int _encodedMethodIndex;
public int TypeIndex => _typeIndex;
public int MethodIndex => _encodedMethodIndex;
public override void Read(ClassReadingBinaryReader reader)
{
_typeIndex = reader.ReadInt32();
_encodedMethodIndex = reader.ReadInt32();
}
}
[Version(Min = 27.2f)]
private Il2CppRGCTXConstrainedData? _constrainedData;
private Il2CppRGCTXDefinitionData? _defData;
public override void Read(ClassReadingBinaryReader reader)
{
type = IsLessThan(29) ? (Il2CppRGCTXDataType)reader.ReadInt32() : (Il2CppRGCTXDataType)reader.ReadInt64();
if (IsLessThan(27.2f))
{
_defData = new Il2CppRGCTXDefinitionData();
_defData.Read(reader);
}
else
{
var va = reader.ReadNUint();
if (type == Il2CppRGCTXDataType.IL2CPP_RGCTX_DATA_CONSTRAINED)
{
var bakPosition = reader.Position;
reader.Position = LibCpp2IlMain.Binary!.MapVirtualAddressToRaw(va);
_constrainedData = new Il2CppRGCTXConstrainedData();
_constrainedData.Read(reader);
reader.Position = bakPosition;
}
else
{
var bakPosition = reader.Position;
reader.Position = LibCpp2IlMain.Binary!.MapVirtualAddressToRaw(va);
_defData = new Il2CppRGCTXDefinitionData();
_defData.Read(reader);
reader.Position = bakPosition;
}
}
}
}