diff --git a/ChocolArm64/Memory/AMemory.cs b/ChocolArm64/Memory/AMemory.cs index 90a1907bff..a3a46b65db 100644 --- a/ChocolArm64/Memory/AMemory.cs +++ b/ChocolArm64/Memory/AMemory.cs @@ -228,7 +228,7 @@ namespace ChocolArm64.Memory PageTable[L0][L1] = Ptr; } - public bool[] IsRegionModified(long Position, long Size) + public (bool[], int) IsRegionModified(long Position, long Size) { long EndPosition = (Position + Size + PageMask) & ~PageMask; @@ -238,6 +238,8 @@ namespace ChocolArm64.Memory bool[] Modified = new bool[Size >> PTPageBits]; + int Count = 0; + lock (ObservedPages) { for (int Page = 0; Page < Modified.Length; Page++) @@ -257,7 +259,10 @@ namespace ChocolArm64.Memory if (Lvl1 != null) { - Modified[Page] = Lvl1[L1] != null; + if (Modified[Page] = Lvl1[L1] != null) + { + Count++; + } } } diff --git a/Ryujinx.HLE/Gpu/Memory/NvGpuVmmCache.cs b/Ryujinx.HLE/Gpu/Memory/NvGpuVmmCache.cs index d647ec7533..b3f253b3ea 100644 --- a/Ryujinx.HLE/Gpu/Memory/NvGpuVmmCache.cs +++ b/Ryujinx.HLE/Gpu/Memory/NvGpuVmmCache.cs @@ -130,6 +130,8 @@ namespace Ryujinx.HLE.Gpu.Memory { (bool[] Modified, long ModifiedCount) = Memory.IsRegionModified(PA, Size); + PA = Memory.GetPhysicalAddress(PA); + ClearCachedPagesIfNeeded(); long PageSize = AMemory.PageSize;