From b08d889f952b76145e38427f13736824cd8b6f06 Mon Sep 17 00:00:00 2001 From: Thomas Guillemard Date: Tue, 21 Aug 2018 18:05:12 +0200 Subject: [PATCH] SvcSetHeapSize: match kernel check for invalid size (#374) This fix games like DK Country --- Ryujinx.HLE/HOS/Kernel/SvcMemory.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Ryujinx.HLE/HOS/Kernel/SvcMemory.cs b/Ryujinx.HLE/HOS/Kernel/SvcMemory.cs index b9bca74ad2..b9e71b183c 100644 --- a/Ryujinx.HLE/HOS/Kernel/SvcMemory.cs +++ b/Ryujinx.HLE/HOS/Kernel/SvcMemory.cs @@ -9,9 +9,9 @@ namespace Ryujinx.HLE.HOS.Kernel { private void SvcSetHeapSize(AThreadState ThreadState) { - long Size = (long)ThreadState.X1; + ulong Size = ThreadState.X1; - if ((Size & 0x1fffff) != 0 || Size != (uint)Size) + if ((Size & 0xFFFFFFFE001FFFFF) != 0) { Device.Log.PrintWarning(LogClass.KernelSvc, $"Heap size 0x{Size:x16} is not aligned!"); @@ -20,7 +20,7 @@ namespace Ryujinx.HLE.HOS.Kernel return; } - long Result = Process.MemoryManager.TrySetHeapSize(Size, out long Position); + long Result = Process.MemoryManager.TrySetHeapSize((long)Size, out long Position); ThreadState.X0 = (ulong)Result;