mirror of
https://github.com/Jacobwasbeast/LegacyWeaveLoader.git
synced 2026-05-22 05:34:36 +00:00
26 lines
784 B
C#
26 lines
784 B
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace WeaveLoader.API.Native;
|
|
|
|
public static class NativeMemory
|
|
{
|
|
public static byte ReadByte(nint basePtr, int offset)
|
|
=> Marshal.ReadByte(basePtr, offset);
|
|
|
|
public static int ReadInt32(nint basePtr, int offset)
|
|
=> Marshal.ReadInt32(basePtr, offset);
|
|
|
|
public static long ReadInt64(nint basePtr, int offset)
|
|
=> Marshal.ReadInt64(basePtr, offset);
|
|
|
|
public static double ReadDouble(nint basePtr, int offset)
|
|
=> BitConverter.Int64BitsToDouble(ReadInt64(basePtr, offset));
|
|
|
|
public static bool ReadBool(nint basePtr, int offset)
|
|
=> ReadByte(basePtr, offset) != 0;
|
|
|
|
public static nint ReadPtr(nint basePtr, int offset)
|
|
=> Marshal.ReadIntPtr(basePtr, offset);
|
|
}
|