internal static Pointer <TSub> ReadSubStructure <TSuper, TSub>(Pointer <TSuper> super) where TSub : INativeSubclass <TSuper> where TSuper : INativeStructure { int size = Mem.QuickSizeOf <TSuper>(); return(super.Add(size).Cast <TSub>()); }
/// <summary> /// Read relative to base pointer /// </summary> internal T ReadRelative <T>(int offset) where T : struct { return(Pointer.Add(offset).ReadAs <T>()); }
internal void SetDescriptor <T>(int descriptor, T parValue) where T : struct { var ptr = Pointer.Add(Offsets.ObjectManager.DescriptorOffset).ReadAs <uint>(); Memory.Reader.Write(new IntPtr(ptr + descriptor), parValue); }
/// <summary> /// Get descriptor function to avoid some code /// </summary> internal T GetDescriptor <T>(int descriptor) where T : struct { var ptr = Pointer.Add(Offsets.ObjectManager.DescriptorOffset).ReadAs <uint>(); return(new IntPtr(ptr + descriptor).ReadAs <T>()); }