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
This commit is contained in:
parent
c46f6879ff
commit
305f06eb71
73 changed files with 707 additions and 716 deletions
|
@ -73,8 +73,8 @@ namespace Ryujinx.HLE.HOS.Services.Nv
|
|||
|
||||
private NvResult GetIoctlArgument(ServiceCtx context, NvIoctl ioctlCommand, out Span<byte> arguments)
|
||||
{
|
||||
(long inputDataPosition, long inputDataSize) = context.Request.GetBufferType0x21(0);
|
||||
(long outputDataPosition, long outputDataSize) = context.Request.GetBufferType0x22(0);
|
||||
(ulong inputDataPosition, ulong inputDataSize) = context.Request.GetBufferType0x21(0);
|
||||
(ulong outputDataPosition, ulong outputDataSize) = context.Request.GetBufferType0x22(0);
|
||||
|
||||
NvIoctl.Direction ioctlDirection = ioctlCommand.DirectionValue;
|
||||
uint ioctlSize = ioctlCommand.Size;
|
||||
|
@ -106,7 +106,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv
|
|||
|
||||
byte[] temp = new byte[inputDataSize];
|
||||
|
||||
context.Memory.Read((ulong)inputDataPosition, temp);
|
||||
context.Memory.Read(inputDataPosition, temp);
|
||||
|
||||
Buffer.BlockCopy(temp, 0, outputData, 0, temp.Length);
|
||||
|
||||
|
@ -122,7 +122,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv
|
|||
{
|
||||
byte[] temp = new byte[inputDataSize];
|
||||
|
||||
context.Memory.Read((ulong)inputDataPosition, temp);
|
||||
context.Memory.Read(inputDataPosition, temp);
|
||||
|
||||
arguments = new Span<byte>(temp);
|
||||
}
|
||||
|
@ -226,10 +226,10 @@ namespace Ryujinx.HLE.HOS.Services.Nv
|
|||
|
||||
if (errorCode == NvResult.Success)
|
||||
{
|
||||
long pathPtr = context.Request.SendBuff[0].Position;
|
||||
long pathSize = context.Request.SendBuff[0].Size;
|
||||
ulong pathPtr = context.Request.SendBuff[0].Position;
|
||||
ulong pathSize = context.Request.SendBuff[0].Size;
|
||||
|
||||
string path = MemoryHelper.ReadAsciiString(context.Memory, pathPtr, pathSize);
|
||||
string path = MemoryHelper.ReadAsciiString(context.Memory, pathPtr, (long)pathSize);
|
||||
|
||||
fd = Open(context, path);
|
||||
|
||||
|
@ -275,7 +275,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv
|
|||
|
||||
if ((ioctlCommand.DirectionValue & NvIoctl.Direction.Write) != 0)
|
||||
{
|
||||
context.Memory.Write((ulong)context.Request.GetBufferType0x22(0).Position, arguments.ToArray());
|
||||
context.Memory.Write(context.Request.GetBufferType0x22(0).Position, arguments.ToArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -470,13 +470,13 @@ namespace Ryujinx.HLE.HOS.Services.Nv
|
|||
int fd = context.RequestData.ReadInt32();
|
||||
NvIoctl ioctlCommand = context.RequestData.ReadStruct<NvIoctl>();
|
||||
|
||||
(long inlineInBufferPosition, long inlineInBufferSize) = context.Request.GetBufferType0x21(1);
|
||||
(ulong inlineInBufferPosition, ulong inlineInBufferSize) = context.Request.GetBufferType0x21(1);
|
||||
|
||||
errorCode = GetIoctlArgument(context, ioctlCommand, out Span<byte> arguments);
|
||||
|
||||
byte[] temp = new byte[inlineInBufferSize];
|
||||
|
||||
context.Memory.Read((ulong)inlineInBufferPosition, temp);
|
||||
context.Memory.Read(inlineInBufferPosition, temp);
|
||||
|
||||
Span<byte> inlineInBuffer = new Span<byte>(temp);
|
||||
|
||||
|
@ -497,7 +497,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv
|
|||
|
||||
if ((ioctlCommand.DirectionValue & NvIoctl.Direction.Write) != 0)
|
||||
{
|
||||
context.Memory.Write((ulong)context.Request.GetBufferType0x22(0).Position, arguments.ToArray());
|
||||
context.Memory.Write(context.Request.GetBufferType0x22(0).Position, arguments.ToArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -519,13 +519,13 @@ namespace Ryujinx.HLE.HOS.Services.Nv
|
|||
int fd = context.RequestData.ReadInt32();
|
||||
NvIoctl ioctlCommand = context.RequestData.ReadStruct<NvIoctl>();
|
||||
|
||||
(long inlineOutBufferPosition, long inlineOutBufferSize) = context.Request.GetBufferType0x22(1);
|
||||
(ulong inlineOutBufferPosition, ulong inlineOutBufferSize) = context.Request.GetBufferType0x22(1);
|
||||
|
||||
errorCode = GetIoctlArgument(context, ioctlCommand, out Span<byte> arguments);
|
||||
|
||||
byte[] temp = new byte[inlineOutBufferSize];
|
||||
|
||||
context.Memory.Read((ulong)inlineOutBufferPosition, temp);
|
||||
context.Memory.Read(inlineOutBufferPosition, temp);
|
||||
|
||||
Span<byte> inlineOutBuffer = new Span<byte>(temp);
|
||||
|
||||
|
@ -546,8 +546,8 @@ namespace Ryujinx.HLE.HOS.Services.Nv
|
|||
|
||||
if ((ioctlCommand.DirectionValue & NvIoctl.Direction.Write) != 0)
|
||||
{
|
||||
context.Memory.Write((ulong)context.Request.GetBufferType0x22(0).Position, arguments.ToArray());
|
||||
context.Memory.Write((ulong)inlineOutBufferPosition, inlineOutBuffer.ToArray());
|
||||
context.Memory.Write(context.Request.GetBufferType0x22(0).Position, arguments.ToArray());
|
||||
context.Memory.Write(inlineOutBufferPosition, inlineOutBuffer.ToArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue