Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions LibCpp2IL/BinaryStructures/Il2CppRGCTXDataType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ public enum Il2CppRGCTXDataType : int
IL2CPP_RGCTX_DATA_CLASS,
IL2CPP_RGCTX_DATA_METHOD,
IL2CPP_RGCTX_DATA_ARRAY,
IL2CPP_RGCTX_DATA_CONSTRAINED,
}
63 changes: 59 additions & 4 deletions LibCpp2IL/BinaryStructures/Il2CppRGCTXDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,72 @@ public class Il2CppRGCTXDefinition : ReadableClass
public Il2CppRGCTXDataType type;
public int _rawIndex;

public int MethodIndex => _rawIndex;
public int MethodIndex => type == Il2CppRGCTXDataType.IL2CPP_RGCTX_DATA_CONSTRAINED ? _constrainedData.MethodIndex : _defData.MethodIndex;

public int TypeIndex => _rawIndex;
public int TypeIndex => type == Il2CppRGCTXDataType.IL2CPP_RGCTX_DATA_CONSTRAINED ? _constrainedData.TypeIndex : _defData.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 = (Il2CppRGCTXDataType)reader.ReadInt32();
_rawIndex = reader.ReadInt32();
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;
}

}

}
}