misc: Replace IntPtr/UIntPtr with nint/nuint

This commit is contained in:
KeatonTheBot
2026-04-21 16:26:47 -05:00
parent 20a9ecaebf
commit 36767d7fce
3 changed files with 23 additions and 23 deletions
@@ -42,12 +42,12 @@ namespace Ryujinx.Audio.Backends.Apple
int result = AudioQueueNewOutput( int result = AudioQueueNewOutput(
ref format, ref format,
IntPtr.Zero, nint.Zero,
IntPtr.Zero, nint.Zero,
IntPtr.Zero, nint.Zero,
IntPtr.Zero, nint.Zero,
0, 0,
out IntPtr testQueue); out nint testQueue);
if (result == 0) if (result == 0)
{ {
@@ -24,8 +24,8 @@ namespace Ryujinx.Audio.Backends.Apple
private readonly AudioQueueOutputCallback _callbackDelegate; private readonly AudioQueueOutputCallback _callbackDelegate;
private readonly GCHandle _gcHandle; private readonly GCHandle _gcHandle;
private IntPtr _audioQueue; private nint _audioQueue;
private readonly IntPtr[] _audioQueueBuffers = new IntPtr[NumBuffers]; private readonly nint[] _audioQueueBuffers = new nint[NumBuffers];
private readonly int[] _bufferBytesFilled = new int[NumBuffers]; private readonly int[] _bufferBytesFilled = new int[NumBuffers];
private readonly int _bytesPerFrame; private readonly int _bytesPerFrame;
@@ -38,9 +38,9 @@ namespace Ryujinx.Audio.Backends.Apple
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate void AudioQueueOutputCallback( private delegate void AudioQueueOutputCallback(
IntPtr userData, nint userData,
IntPtr audioQueue, nint audioQueue,
IntPtr buffer); nint buffer);
public AppleHardwareDeviceSession( public AppleHardwareDeviceSession(
AppleHardwareDeviceDriver driver, AppleHardwareDeviceDriver driver,
@@ -69,15 +69,15 @@ namespace Ryujinx.Audio.Backends.Apple
RequestedSampleRate, RequestedSampleRate,
RequestedChannelCount); RequestedChannelCount);
IntPtr callbackPtr = Marshal.GetFunctionPointerForDelegate(_callbackDelegate); nint callbackPtr = Marshal.GetFunctionPointerForDelegate(_callbackDelegate);
IntPtr userData = GCHandle.ToIntPtr(_gcHandle); nint userData = GCHandle.ToIntPtr(_gcHandle);
int result = AudioQueueNewOutput( int result = AudioQueueNewOutput(
ref format, ref format,
callbackPtr, callbackPtr,
userData, userData,
IntPtr.Zero, nint.Zero,
IntPtr.Zero, nint.Zero,
0, 0,
out _audioQueue); out _audioQueue);
@@ -99,7 +99,7 @@ namespace Ryujinx.Audio.Backends.Apple
} }
} }
private unsafe void PrimeBuffer(IntPtr bufferPtr, int bufferIndex) private unsafe void PrimeBuffer(nint bufferPtr, int bufferIndex)
{ {
AudioQueueBuffer* buffer = (AudioQueueBuffer*)bufferPtr; AudioQueueBuffer* buffer = (AudioQueueBuffer*)bufferPtr;
@@ -123,12 +123,12 @@ namespace Ryujinx.Audio.Backends.Apple
buffer->AudioDataByteSize = (uint)capacityBytes; buffer->AudioDataByteSize = (uint)capacityBytes;
_bufferBytesFilled[bufferIndex] = bytesToRead; _bufferBytesFilled[bufferIndex] = bytesToRead;
AudioQueueEnqueueBuffer(_audioQueue, bufferPtr, 0, IntPtr.Zero); AudioQueueEnqueueBuffer(_audioQueue, bufferPtr, 0, nint.Zero);
} }
private void OutputCallback(IntPtr userData, IntPtr audioQueue, IntPtr bufferPtr) private void OutputCallback(nint userData, nint audioQueue, nint bufferPtr)
{ {
if (!_started || bufferPtr == IntPtr.Zero) if (!_started || bufferPtr == nint.Zero)
return; return;
int bufferIndex = Array.IndexOf(_audioQueueBuffers, bufferPtr); int bufferIndex = Array.IndexOf(_audioQueueBuffers, bufferPtr);
@@ -173,7 +173,7 @@ namespace Ryujinx.Audio.Backends.Apple
} }
} }
private unsafe void ApplyVolume(IntPtr dataPtr, int byteSize) private unsafe void ApplyVolume(nint dataPtr, int byteSize)
{ {
float volume = Math.Clamp(_volume * _driver.Volume, 0f, 1f); float volume = Math.Clamp(_volume * _driver.Volume, 0f, 1f);
if (volume >= 0.999f) if (volume >= 0.999f)
@@ -223,7 +223,7 @@ namespace Ryujinx.Audio.Backends.Apple
return; return;
_started = true; _started = true;
AudioQueueStart(_audioQueue, IntPtr.Zero); AudioQueueStart(_audioQueue, nint.Zero);
} }
} }
@@ -262,11 +262,11 @@ namespace Ryujinx.Audio.Backends.Apple
{ {
Stop(); Stop();
if (_audioQueue != IntPtr.Zero) if (_audioQueue != nint.Zero)
{ {
AudioQueueStop(_audioQueue, true); AudioQueueStop(_audioQueue, true);
AudioQueueDispose(_audioQueue, true); AudioQueueDispose(_audioQueue, true);
_audioQueue = IntPtr.Zero; _audioQueue = nint.Zero;
} }
if (_gcHandle.IsAllocated) if (_gcHandle.IsAllocated)
+1 -1
View File
@@ -148,7 +148,7 @@ namespace Ryujinx.Headless
fixed (byte* iconPtr = iconBytes) fixed (byte* iconPtr = iconBytes)
{ {
SDL_IOStream* rwOpsStruct = SDL_IOFromConstMem((nint)iconPtr, (UIntPtr)iconBytes.Length); SDL_IOStream* rwOpsStruct = SDL_IOFromConstMem((nint)iconPtr, (uint)iconBytes.Length);
SDL_Surface* iconHandle = SDL_LoadBMP_IO(rwOpsStruct, true); SDL_Surface* iconHandle = SDL_LoadBMP_IO(rwOpsStruct, true);
SDL_SetWindowIcon(WindowHandle, iconHandle); SDL_SetWindowIcon(WindowHandle, iconHandle);