From 305f06eb71a7832e6b0081a67015b66ced8a23cd Mon Sep 17 00:00:00 2001 From: Mary Date: Sat, 24 Apr 2021 12:16:01 +0200 Subject: HLE: Fix integer sign inconcistency accross the codebase (#2222) * Make all title id instances unsigned * Replace address and size with ulong instead of signed types Long overdue change. Also change some logics here and there to optimize with the new memory manager. * Address Ac_K's comments * Remove uneeded cast all around * Fixes some others misalignment --- Ryujinx.HLE/HOS/Services/Ro/IRoInterface.cs | 16 ++++++++-------- Ryujinx.HLE/HOS/Services/Ro/Types/NrrInfo.cs | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'Ryujinx.HLE/HOS/Services/Ro') diff --git a/Ryujinx.HLE/HOS/Services/Ro/IRoInterface.cs b/Ryujinx.HLE/HOS/Services/Ro/IRoInterface.cs index c8277699..8070cf54 100644 --- a/Ryujinx.HLE/HOS/Services/Ro/IRoInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Ro/IRoInterface.cs @@ -40,7 +40,7 @@ namespace Ryujinx.HLE.HOS.Services.Ro _owner = null; } - private ResultCode ParseNrr(out NrrInfo nrrInfo, ServiceCtx context, long nrrAddress, long nrrSize) + private ResultCode ParseNrr(out NrrInfo nrrInfo, ServiceCtx context, ulong nrrAddress, ulong nrrSize) { nrrInfo = null; @@ -71,12 +71,12 @@ namespace Ryujinx.HLE.HOS.Services.Ro { byte[] temp = new byte[0x20]; - _owner.CpuMemory.Read((ulong)(nrrAddress + header.HashOffset + (i * 0x20)), temp); + _owner.CpuMemory.Read(nrrAddress + header.HashOffset + (uint)(i * 0x20), temp); hashes.Add(temp); } - nrrInfo = new NrrInfo(nrrAddress, header, hashes); + nrrInfo = new NrrInfo((ulong)nrrAddress, header, hashes); return ResultCode.Success; } @@ -333,7 +333,7 @@ namespace Ryujinx.HLE.HOS.Services.Ro process.CpuMemory.Write(roStart, relocatableObject.Ro); process.CpuMemory.Write(dataStart, relocatableObject.Data); - MemoryHelper.FillWithZeros(process.CpuMemory, (long)bssStart, (int)(bssEnd - bssStart)); + MemoryHelper.FillWithZeros(process.CpuMemory, bssStart, (int)(bssEnd - bssStart)); KernelResult result; @@ -354,7 +354,7 @@ namespace Ryujinx.HLE.HOS.Services.Ro return process.MemoryManager.SetProcessMemoryPermission(dataStart, bssEnd - dataStart, KMemoryPermission.ReadAndWrite); } - private ResultCode RemoveNrrInfo(long nrrAddress) + private ResultCode RemoveNrrInfo(ulong nrrAddress) { foreach (NrrInfo info in _nrrInfos) { @@ -508,8 +508,8 @@ namespace Ryujinx.HLE.HOS.Services.Ro // pid placeholder, zero context.RequestData.ReadUInt64(); - long nrrAddress = context.RequestData.ReadInt64(); - long nrrSize = context.RequestData.ReadInt64(); + ulong nrrAddress = context.RequestData.ReadUInt64(); + ulong nrrSize = context.RequestData.ReadUInt64(); if (result == ResultCode.Success) { @@ -541,7 +541,7 @@ namespace Ryujinx.HLE.HOS.Services.Ro // pid placeholder, zero context.RequestData.ReadUInt64(); - long nrrHeapAddress = context.RequestData.ReadInt64(); + ulong nrrHeapAddress = context.RequestData.ReadUInt64(); if (result == ResultCode.Success) { diff --git a/Ryujinx.HLE/HOS/Services/Ro/Types/NrrInfo.cs b/Ryujinx.HLE/HOS/Services/Ro/Types/NrrInfo.cs index 8e038fcb..45c34f1c 100644 --- a/Ryujinx.HLE/HOS/Services/Ro/Types/NrrInfo.cs +++ b/Ryujinx.HLE/HOS/Services/Ro/Types/NrrInfo.cs @@ -6,9 +6,9 @@ namespace Ryujinx.HLE.HOS.Services.Ro { public NrrHeader Header { get; private set; } public List Hashes { get; private set; } - public long NrrAddress { get; private set; } + public ulong NrrAddress { get; private set; } - public NrrInfo(long nrrAddress, NrrHeader header, List hashes) + public NrrInfo(ulong nrrAddress, NrrHeader header, List hashes) { NrrAddress = nrrAddress; Header = header; -- cgit v1.2.3