mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-17 03:36:29 +02:00
misc: Replace references to IntPtr/UIntPtr with nint/nuint + code cleanups.
This commit is contained in:
parent
a09d314817
commit
dfb4854d19
172 changed files with 902 additions and 914 deletions
|
@ -268,11 +268,11 @@ namespace ARMeilleure.Translation.PTC
|
|||
return false;
|
||||
}
|
||||
|
||||
IntPtr intPtr = IntPtr.Zero;
|
||||
nint intPtr = nint.Zero;
|
||||
|
||||
try
|
||||
{
|
||||
intPtr = Marshal.AllocHGlobal(new IntPtr(outerHeader.UncompressedStreamSize));
|
||||
intPtr = Marshal.AllocHGlobal(new nint(outerHeader.UncompressedStreamSize));
|
||||
|
||||
using UnmanagedMemoryStream stream = new((byte*)intPtr.ToPointer(), outerHeader.UncompressedStreamSize, outerHeader.UncompressedStreamSize, FileAccess.ReadWrite);
|
||||
try
|
||||
|
@ -373,7 +373,7 @@ namespace ARMeilleure.Translation.PTC
|
|||
}
|
||||
finally
|
||||
{
|
||||
if (intPtr != IntPtr.Zero)
|
||||
if (intPtr != nint.Zero)
|
||||
{
|
||||
Marshal.FreeHGlobal(intPtr);
|
||||
}
|
||||
|
@ -455,11 +455,11 @@ namespace ARMeilleure.Translation.PTC
|
|||
|
||||
outerHeader.SetHeaderHash();
|
||||
|
||||
IntPtr intPtr = IntPtr.Zero;
|
||||
nint intPtr = nint.Zero;
|
||||
|
||||
try
|
||||
{
|
||||
intPtr = Marshal.AllocHGlobal(new IntPtr(outerHeader.UncompressedStreamSize));
|
||||
intPtr = Marshal.AllocHGlobal(new nint(outerHeader.UncompressedStreamSize));
|
||||
|
||||
using UnmanagedMemoryStream stream = new((byte*)intPtr.ToPointer(), outerHeader.UncompressedStreamSize, outerHeader.UncompressedStreamSize, FileAccess.ReadWrite);
|
||||
stream.Seek((long)Unsafe.SizeOf<InnerHeader>(), SeekOrigin.Begin);
|
||||
|
@ -513,7 +513,7 @@ namespace ARMeilleure.Translation.PTC
|
|||
}
|
||||
finally
|
||||
{
|
||||
if (intPtr != IntPtr.Zero)
|
||||
if (intPtr != nint.Zero)
|
||||
{
|
||||
Marshal.FreeHGlobal(intPtr);
|
||||
}
|
||||
|
@ -664,7 +664,7 @@ namespace ARMeilleure.Translation.PTC
|
|||
|
||||
foreach (RelocEntry relocEntry in relocEntries)
|
||||
{
|
||||
IntPtr? imm = null;
|
||||
nint? imm = null;
|
||||
Symbol symbol = relocEntry.Symbol;
|
||||
|
||||
if (symbol.Type == SymbolType.FunctionTable)
|
||||
|
@ -675,7 +675,7 @@ namespace ARMeilleure.Translation.PTC
|
|||
{
|
||||
unsafe
|
||||
{
|
||||
imm = (IntPtr)Unsafe.AsPointer(ref translator.FunctionTable.GetValue(guestAddress));
|
||||
imm = (nint)Unsafe.AsPointer(ref translator.FunctionTable.GetValue(guestAddress));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -683,7 +683,7 @@ namespace ARMeilleure.Translation.PTC
|
|||
{
|
||||
int index = (int)symbol.Value;
|
||||
|
||||
if (Delegates.TryGetDelegateFuncPtrByIndex(index, out IntPtr funcPtr))
|
||||
if (Delegates.TryGetDelegateFuncPtrByIndex(index, out nint funcPtr))
|
||||
{
|
||||
imm = funcPtr;
|
||||
}
|
||||
|
@ -698,7 +698,7 @@ namespace ARMeilleure.Translation.PTC
|
|||
|
||||
unsafe
|
||||
{
|
||||
imm = (IntPtr)Unsafe.AsPointer(ref callCounter.Value);
|
||||
imm = (nint)Unsafe.AsPointer(ref callCounter.Value);
|
||||
}
|
||||
}
|
||||
else if (symbol == DispatchStubSymbol)
|
||||
|
@ -744,7 +744,7 @@ namespace ARMeilleure.Translation.PTC
|
|||
bool highCq)
|
||||
{
|
||||
var cFunc = new CompiledFunction(code, unwindInfo, RelocInfo.Empty);
|
||||
var gFunc = cFunc.MapWithPointer<GuestFunction>(out IntPtr gFuncPointer);
|
||||
var gFunc = cFunc.MapWithPointer<GuestFunction>(out nint gFuncPointer);
|
||||
|
||||
return new TranslatedFunction(gFunc, gFuncPointer, callCounter, guestSize, highCq);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue