diff --git a/Source/Libraries/HedgeModManager.CodeCompiler/Resources/MemoryService.cs b/Source/Libraries/HedgeModManager.CodeCompiler/Resources/MemoryService.cs index ef35905..5ae22ee 100644 --- a/Source/Libraries/HedgeModManager.CodeCompiler/Resources/MemoryService.cs +++ b/Source/Libraries/HedgeModManager.CodeCompiler/Resources/MemoryService.cs @@ -1,4 +1,6 @@ -using System; +#pragma warning disable + +using System; using System.Collections.Generic; using System.Linq; using System.Reflection; @@ -39,20 +41,20 @@ public static bool IsAligned(nint address) public static long ASLR(long address) => ModuleBase + (address - (IntPtr.Size == 8 ? 0x140000000 : 0x400000)); - public static void Write(IntPtr address, IntPtr dataPtr, IntPtr length) + public static void Write(IntPtr destination, IntPtr source, IntPtr length) { - if (!IsMemoryWritable(address)) + if (!IsMemoryWritable(destination)) { return; } - if (IsAligned(address) && IsAligned(dataPtr)) + if (IsAligned(destination) && IsAligned(source)) { - Unsafe.CopyBlock(dataPtr.ToPointer(), address.ToPointer(), (uint)length); + Unsafe.CopyBlock(destination, source, (uint)length); } else { - Unsafe.CopyBlockUnaligned(dataPtr.ToPointer(), address.ToPointer(), (uint)length); + Unsafe.CopyBlockUnaligned(destination, source, (uint)length); } } @@ -316,6 +318,10 @@ public static TTo BitCast(TFrom source) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static extern void Copy(ref T destination, void* source); + [CompilerGenerated] + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static extern void CopyBlock(IntPtr destination, IntPtr source, uint byteCount); + [CompilerGenerated] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static extern void CopyBlock(void* destination, void* source, uint byteCount); @@ -324,6 +330,10 @@ public static TTo BitCast(TFrom source) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static extern void CopyBlock(ref byte destination, ref byte source, uint byteCount); + [CompilerGenerated] + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static extern void CopyBlockUnaligned(IntPtr destination, IntPtr source, uint byteCount); + [CompilerGenerated] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static extern void CopyBlockUnaligned(void* destination, void* source, uint byteCount);