MemoryManagement: Change return types for Commit/Decommit to void (#5325)
* Replace return type with void for Commit/Decommit * Small cleanup
This commit is contained in:
parent
bf96bc84a8
commit
7d160e98fd
6 changed files with 32 additions and 33 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue