From 317681b9be39658bed8816f63c456d5cff5aa745 Mon Sep 17 00:00:00 2001 From: gdk Date: Thu, 10 Feb 2022 19:04:31 -0300 Subject: [PATCH] Update GetWritableRegion to also support unmapped ranges --- Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs b/Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs index e4975c8c5..bfd3c04fa 100644 --- a/Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs +++ b/Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs @@ -156,11 +156,13 @@ namespace Ryujinx.Graphics.Gpu.Memory int offset = 0; for (int i = 0; i < range.Count; i++) { - MemoryRange subrange = range.GetSubRange(i); - - GetSpan(subrange.Address, (int)subrange.Size).CopyTo(memory.Span.Slice(offset, (int)subrange.Size)); - - offset += (int)subrange.Size; + var currentRange = range.GetSubRange(i); + int size = (int)currentRange.Size; + if (currentRange.Address != MemoryManager.PteUnmapped) + { + GetSpan(currentRange.Address, size).CopyTo(memory.Span.Slice(offset, size)); + } + offset += size; } return new WritableRegion(new MultiRangeWritableBlock(range, this), 0, memory, tracked);