aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Bcat/ServiceCreator/IDeliveryCacheFileService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Bcat/ServiceCreator/IDeliveryCacheFileService.cs')
-rw-r--r--Ryujinx.HLE/HOS/Services/Bcat/ServiceCreator/IDeliveryCacheFileService.cs17
1 files changed, 8 insertions, 9 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Bcat/ServiceCreator/IDeliveryCacheFileService.cs b/Ryujinx.HLE/HOS/Services/Bcat/ServiceCreator/IDeliveryCacheFileService.cs
index b7b03447..c7706f92 100644
--- a/Ryujinx.HLE/HOS/Services/Bcat/ServiceCreator/IDeliveryCacheFileService.cs
+++ b/Ryujinx.HLE/HOS/Services/Bcat/ServiceCreator/IDeliveryCacheFileService.cs
@@ -38,20 +38,19 @@ namespace Ryujinx.HLE.HOS.Services.Bcat.ServiceCreator
// Read(u64) -> (u64, buffer<bytes, 6>)
public ResultCode Read(ServiceCtx context)
{
- ulong position = context.Request.ReceiveBuff[0].Position;
- ulong size = context.Request.ReceiveBuff[0].Size;
+ ulong bufferAddress = context.Request.ReceiveBuff[0].Position;
+ ulong bufferLen = context.Request.ReceiveBuff[0].Size;
long offset = context.RequestData.ReadInt64();
- byte[] data = new byte[size];
-
- Result result = _base.Get.Read(out long bytesRead, offset, data);
-
- context.Memory.Write(position, data);
+ using (var region = context.Memory.GetWritableRegion(bufferAddress, (int)bufferLen, true))
+ {
+ Result result = _base.Get.Read(out long bytesRead, offset, region.Memory.Span);
- context.ResponseData.Write(bytesRead);
+ context.ResponseData.Write(bytesRead);
- return (ResultCode)result.Value;
+ return (ResultCode)result.Value;
+ }
}
[CommandHipc(2)]