[shader] add scalar memory fallback

This commit is contained in:
ParantezTech
2026-07-18 23:02:12 +03:00
parent ce243b3622
commit 2064c1eda6
3 changed files with 102 additions and 2 deletions
@@ -27,7 +27,7 @@ internal static class AgcShaderCompilerHooks
internal static void Install()
{
Gen5ShaderScalarEvaluator.FallbackMemoryReader =
KernelMemoryCompatExports.TryReadTrackedLibcHeap;
KernelMemoryCompatExports.TryReadShaderGuestMemory;
Gen5ShaderScalarEvaluator.GlobalMemoryPool =
GuestDataPool.Shared;
}
@@ -2350,7 +2350,8 @@ public static class Gen5ShaderScalarEvaluator
private static bool TryReadUInt32(CpuContext ctx, ulong address, out uint value)
{
Span<byte> bytes = stackalloc byte[sizeof(uint)];
if (!ctx.Memory.TryRead(address, bytes))
if (!ctx.Memory.TryRead(address, bytes) &&
FallbackMemoryReader?.Invoke(address, bytes) != true)
{
value = 0;
return false;