From e71432225010002954922aef0f0e0f1f66a2096d Mon Sep 17 00:00:00 2001 From: Thog Date: Tue, 26 Nov 2019 04:43:18 +0100 Subject: [PATCH] ro: Fixes some bugs --- Ryujinx.HLE/HOS/Services/Ro/IRoInterface.cs | 9 +++++++-- Ryujinx.HLE/HOS/Services/Ro/ResultCode.cs | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Ryujinx.HLE/HOS/Services/Ro/IRoInterface.cs b/Ryujinx.HLE/HOS/Services/Ro/IRoInterface.cs index 0153f4dd19..21c38e1bc1 100644 --- a/Ryujinx.HLE/HOS/Services/Ro/IRoInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Ro/IRoInterface.cs @@ -1,5 +1,6 @@ using ARMeilleure.Memory; using Ryujinx.Common; +using Ryujinx.Common.Logging; using Ryujinx.HLE.HOS.Kernel.Common; using Ryujinx.HLE.HOS.Kernel.Memory; using Ryujinx.HLE.HOS.Kernel.Process; @@ -265,13 +266,15 @@ namespace Ryujinx.HLE.HOS.Services.Ro int retryCount; - int addressSpacePageLimit = (int)((memMgr.GetAddrSpaceSize() - size) >> 12); + ulong addressSpacePageLimit = (memMgr.GetAddrSpaceSize() - size) >> 12; for (retryCount = 0; retryCount < MaxMapRetries; retryCount++) { while (true) { - targetAddress = memMgr.GetAddrSpaceBaseAddr() + (ulong)(_random.Next(addressSpacePageLimit) << 12); + int randomOffset = _random.Next(0, (int)addressSpacePageLimit) << 12; + + targetAddress = memMgr.GetAddrSpaceBaseAddr() + (ulong)randomOffset; if (memMgr.InsideAddrSpace(targetAddress, size) && !memMgr.InsideHeapRegion(targetAddress, size) && !memMgr.InsideAliasRegion(targetAddress, size)) { @@ -449,6 +452,8 @@ namespace Ryujinx.HLE.HOS.Services.Ro if (result == ResultCode.Success) { + info.NroMappedAddress = nroMappedAddress; + _nroInfos.Add(info); } } diff --git a/Ryujinx.HLE/HOS/Services/Ro/ResultCode.cs b/Ryujinx.HLE/HOS/Services/Ro/ResultCode.cs index ab1c6ac8c4..92bb550293 100644 --- a/Ryujinx.HLE/HOS/Services/Ro/ResultCode.cs +++ b/Ryujinx.HLE/HOS/Services/Ro/ResultCode.cs @@ -3,7 +3,7 @@ enum ResultCode { ModuleId = 22, - ErrorCodeShift = 22, + ErrorCodeShift = 9, Success = 0,