From 5de3814a167edf33c30bd19b2a253d6b57604401 Mon Sep 17 00:00:00 2001 From: LotP1 <68976644+LotP1@users.noreply.github.com> Date: Sun, 26 Oct 2025 19:23:07 +0100 Subject: [PATCH] skip potentially unnecessary copy --- src/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs b/src/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs index 99acd06bb..89ef76616 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs @@ -519,12 +519,12 @@ namespace Ryujinx.HLE.HOS.Services.Nv (ulong inlineOutBufferPosition, ulong inlineOutBufferSize) = context.Request.GetBufferType0x22(1); errorCode = GetIoctlArgument(context, ioctlCommand, out Span arguments); - - byte[] temp = new byte[inlineOutBufferSize]; - - context.Memory.Read(inlineOutBufferPosition, temp); - - Span inlineOutBuffer = new(temp); + + if (!context.Memory.TryReadUnsafe(inlineOutBufferPosition, (int)inlineOutBufferSize, out Span inlineOutBuffer)) + { + inlineOutBuffer = new byte[inlineOutBufferSize]; + context.Memory.Read(inlineOutBufferPosition, inlineOutBuffer); + } if (errorCode == NvResult.Success) {