diff options
| author | Mary <me@thog.eu> | 2021-04-24 12:16:01 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-24 12:16:01 +0200 |
| commit | 305f06eb71a7832e6b0081a67015b66ced8a23cd (patch) | |
| tree | 98bcb3ed465332a04af449cb5c74bdca7855a141 /Ryujinx.HLE/HOS/Services/Nv | |
| parent | c46f6879ff9171a1e024965618242e8bad373b6b (diff) | |
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
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Nv')
| -rw-r--r-- | Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs b/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs index 35bb4e6f..25279af3 100644 --- a/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs @@ -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()); } } } |
