Memory changes 2.1

* Fixes a few crashes

* Simplifies a few functions

* Changes a few calls to use faster methods
This commit is contained in:
LotP
2025-08-31 20:42:31 -05:00
committed by KeatonTheBot
parent a62deb8cfd
commit 61da23cb9e
7 changed files with 160 additions and 83 deletions
+3 -11
View File
@@ -81,15 +81,7 @@ namespace Ryujinx.Graphics.Device
{
uint alignedOffset = index * RegisterSize;
var readCallback = Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(_readCallbacks), (IntPtr)index);
if (readCallback != null)
{
return readCallback();
}
else
{
return GetRefUnchecked<int>(alignedOffset);
}
return _readCallbacks[index]?.Invoke() ?? GetRefUnchecked<int>(alignedOffset);
}
return 0;
@@ -106,7 +98,7 @@ namespace Ryujinx.Graphics.Device
GetRefIntAlignedUncheck(index) = data;
Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(_writeCallbacks), (IntPtr)index)?.Invoke(data);
_writeCallbacks[index]?.Invoke(data);
}
}
@@ -123,7 +115,7 @@ namespace Ryujinx.Graphics.Device
changed = storage != data;
storage = data;
Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(_writeCallbacks), (IntPtr)index)?.Invoke(data);
_writeCallbacks[index]?.Invoke(data);
}
else
{