mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-10-05 06:49:00 +02:00
misc: Use nint/nuint instead of IntPtr/UIntPtr
This commit is contained in:
@@ -7,11 +7,11 @@ namespace Ryujinx.Memory
|
||||
[SuppressMessage("Interoperability", "CA1416:Validate platform compatibility")]
|
||||
public static class MemoryManagement
|
||||
{
|
||||
public static IntPtr Allocate(ulong size, bool forJit)
|
||||
public static nint Allocate(ulong size, bool forJit)
|
||||
{
|
||||
if (OperatingSystem.IsWindows())
|
||||
{
|
||||
return MemoryManagementWindows.Allocate((IntPtr)size);
|
||||
return MemoryManagementWindows.Allocate((nint)size);
|
||||
}
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || PlatformInfo.IsBionic)
|
||||
{
|
||||
@@ -23,11 +23,11 @@ namespace Ryujinx.Memory
|
||||
}
|
||||
}
|
||||
|
||||
public static IntPtr Reserve(ulong size, bool forJit, bool viewCompatible)
|
||||
public static nint Reserve(ulong size, bool forJit, bool viewCompatible)
|
||||
{
|
||||
if (OperatingSystem.IsWindows())
|
||||
{
|
||||
return MemoryManagementWindows.Reserve((IntPtr)size, viewCompatible);
|
||||
return MemoryManagementWindows.Reserve((nint)size, viewCompatible);
|
||||
}
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || PlatformInfo.IsBionic)
|
||||
{
|
||||
@@ -39,11 +39,11 @@ namespace Ryujinx.Memory
|
||||
}
|
||||
}
|
||||
|
||||
public static void Commit(IntPtr address, ulong size, bool forJit)
|
||||
public static void Commit(nint address, ulong size, bool forJit)
|
||||
{
|
||||
if (OperatingSystem.IsWindows())
|
||||
{
|
||||
MemoryManagementWindows.Commit(address, (IntPtr)size);
|
||||
MemoryManagementWindows.Commit(address, (nint)size);
|
||||
}
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || PlatformInfo.IsBionic)
|
||||
{
|
||||
@@ -55,11 +55,11 @@ namespace Ryujinx.Memory
|
||||
}
|
||||
}
|
||||
|
||||
public static void Decommit(IntPtr address, ulong size)
|
||||
public static void Decommit(nint address, ulong size)
|
||||
{
|
||||
if (OperatingSystem.IsWindows())
|
||||
{
|
||||
MemoryManagementWindows.Decommit(address, (IntPtr)size);
|
||||
MemoryManagementWindows.Decommit(address, (nint)size);
|
||||
}
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || PlatformInfo.IsBionic)
|
||||
{
|
||||
@@ -71,11 +71,11 @@ namespace Ryujinx.Memory
|
||||
}
|
||||
}
|
||||
|
||||
public static void MapView(IntPtr sharedMemory, ulong srcOffset, IntPtr address, ulong size, MemoryBlock owner)
|
||||
public static void MapView(nint sharedMemory, ulong srcOffset, nint address, ulong size, MemoryBlock owner)
|
||||
{
|
||||
if (OperatingSystem.IsWindows())
|
||||
{
|
||||
MemoryManagementWindows.MapView(sharedMemory, srcOffset, address, (IntPtr)size, owner);
|
||||
MemoryManagementWindows.MapView(sharedMemory, srcOffset, address, (nint)size, owner);
|
||||
}
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || PlatformInfo.IsBionic)
|
||||
{
|
||||
@@ -87,11 +87,11 @@ namespace Ryujinx.Memory
|
||||
}
|
||||
}
|
||||
|
||||
public static void UnmapView(IntPtr sharedMemory, IntPtr address, ulong size, MemoryBlock owner)
|
||||
public static void UnmapView(nint sharedMemory, nint address, ulong size, MemoryBlock owner)
|
||||
{
|
||||
if (OperatingSystem.IsWindows())
|
||||
{
|
||||
MemoryManagementWindows.UnmapView(sharedMemory, address, (IntPtr)size, owner);
|
||||
MemoryManagementWindows.UnmapView(sharedMemory, address, (nint)size, owner);
|
||||
}
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || PlatformInfo.IsBionic)
|
||||
{
|
||||
@@ -103,13 +103,13 @@ namespace Ryujinx.Memory
|
||||
}
|
||||
}
|
||||
|
||||
public static void Reprotect(IntPtr address, ulong size, MemoryPermission permission, bool forView, bool throwOnFail)
|
||||
public static void Reprotect(nint address, ulong size, MemoryPermission permission, bool forView, bool throwOnFail)
|
||||
{
|
||||
bool result;
|
||||
|
||||
if (OperatingSystem.IsWindows())
|
||||
{
|
||||
result = MemoryManagementWindows.Reprotect(address, (IntPtr)size, permission, forView);
|
||||
result = MemoryManagementWindows.Reprotect(address, (nint)size, permission, forView);
|
||||
}
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || PlatformInfo.IsBionic)
|
||||
{
|
||||
@@ -126,11 +126,11 @@ namespace Ryujinx.Memory
|
||||
}
|
||||
}
|
||||
|
||||
public static bool Free(IntPtr address, ulong size)
|
||||
public static bool Free(nint address, ulong size)
|
||||
{
|
||||
if (OperatingSystem.IsWindows())
|
||||
{
|
||||
return MemoryManagementWindows.Free(address, (IntPtr)size);
|
||||
return MemoryManagementWindows.Free(address, (nint)size);
|
||||
}
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || PlatformInfo.IsBionic)
|
||||
{
|
||||
@@ -142,11 +142,11 @@ namespace Ryujinx.Memory
|
||||
}
|
||||
}
|
||||
|
||||
public static IntPtr CreateSharedMemory(ulong size, bool reserve)
|
||||
public static nint CreateSharedMemory(ulong size, bool reserve)
|
||||
{
|
||||
if (OperatingSystem.IsWindows())
|
||||
{
|
||||
return MemoryManagementWindows.CreateSharedMemory((IntPtr)size, reserve);
|
||||
return MemoryManagementWindows.CreateSharedMemory((nint)size, reserve);
|
||||
}
|
||||
else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS() || PlatformInfo.IsBionic)
|
||||
{
|
||||
@@ -158,7 +158,7 @@ namespace Ryujinx.Memory
|
||||
}
|
||||
}
|
||||
|
||||
public static void DestroySharedMemory(IntPtr handle)
|
||||
public static void DestroySharedMemory(nint handle)
|
||||
{
|
||||
if (OperatingSystem.IsWindows())
|
||||
{
|
||||
@@ -174,7 +174,7 @@ namespace Ryujinx.Memory
|
||||
}
|
||||
}
|
||||
|
||||
public static IntPtr MapSharedMemory(IntPtr handle, ulong size)
|
||||
public static nint MapSharedMemory(nint handle, ulong size)
|
||||
{
|
||||
if (OperatingSystem.IsWindows())
|
||||
{
|
||||
@@ -190,7 +190,7 @@ namespace Ryujinx.Memory
|
||||
}
|
||||
}
|
||||
|
||||
public static void UnmapSharedMemory(IntPtr address, ulong size)
|
||||
public static void UnmapSharedMemory(nint address, ulong size)
|
||||
{
|
||||
if (OperatingSystem.IsWindows())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user