mirror of
https://github.com/Jacobwasbeast/LegacyWeaveLoader.git
synced 2026-05-26 15:44:31 +00:00
feat(modloader): pdb mapping, dynamic invoke, mixins
This commit is contained in:
25
WeaveLoader.API/Native/NativeMemory.cs
Normal file
25
WeaveLoader.API/Native/NativeMemory.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user