diff options
Diffstat (limited to 'src/Ryujinx.Memory/MemoryManagementWindows.cs')
-rw-r--r-- | src/Ryujinx.Memory/MemoryManagementWindows.cs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/Ryujinx.Memory/MemoryManagementWindows.cs b/src/Ryujinx.Memory/MemoryManagementWindows.cs index cbf3ecba..d7d78bd8 100644 --- a/src/Ryujinx.Memory/MemoryManagementWindows.cs +++ b/src/Ryujinx.Memory/MemoryManagementWindows.cs @@ -10,7 +10,7 @@ namespace Ryujinx.Memory { public const int PageSize = 0x1000; - private static readonly PlaceholderManager _placeholders = new PlaceholderManager(); + private static readonly PlaceholderManager _placeholders = new(); public static IntPtr Allocate(IntPtr size) { @@ -55,14 +55,20 @@ namespace Ryujinx.Memory return ptr; } - public static bool Commit(IntPtr location, IntPtr size) + public static void Commit(IntPtr location, IntPtr size) { - return WindowsApi.VirtualAlloc(location, size, AllocationType.Commit, MemoryProtection.ReadWrite) != IntPtr.Zero; + if (WindowsApi.VirtualAlloc(location, size, AllocationType.Commit, MemoryProtection.ReadWrite) == IntPtr.Zero) + { + throw new SystemException(Marshal.GetLastPInvokeErrorMessage()); + } } - public static bool Decommit(IntPtr location, IntPtr size) + public static void Decommit(IntPtr location, IntPtr size) { - return WindowsApi.VirtualFree(location, size, AllocationType.Decommit); + if (!WindowsApi.VirtualFree(location, size, AllocationType.Decommit)) + { + throw new SystemException(Marshal.GetLastPInvokeErrorMessage()); + } } public static void MapView(IntPtr sharedMemory, ulong srcOffset, IntPtr location, IntPtr size, MemoryBlock owner) |