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/Sockets/Nsd | |
| 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/Sockets/Nsd')
| -rw-r--r-- | Ryujinx.HLE/HOS/Services/Sockets/Nsd/IManager.cs | 24 | ||||
| -rw-r--r-- | Ryujinx.HLE/HOS/Services/Sockets/Nsd/Manager/FqdnResolver.cs | 6 |
2 files changed, 15 insertions, 15 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Sockets/Nsd/IManager.cs b/Ryujinx.HLE/HOS/Services/Sockets/Nsd/IManager.cs index f6b83eaa..c64dddf0 100644 --- a/Ryujinx.HLE/HOS/Services/Sockets/Nsd/IManager.cs +++ b/Ryujinx.HLE/HOS/Services/Sockets/Nsd/IManager.cs @@ -37,7 +37,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Nsd // GetSettingName() -> buffer<unknown<0x100>, 0x16> public ResultCode GetSettingName(ServiceCtx context) { - (long outputPosition, long outputSize) = context.Request.GetBufferType0x22(); + (ulong outputPosition, ulong outputSize) = context.Request.GetBufferType0x22(); ResultCode result = _fqdnResolver.GetSettingName(context, out string settingName); @@ -45,7 +45,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Nsd { byte[] settingNameBuffer = Encoding.UTF8.GetBytes(settingName + '\0'); - context.Memory.Write((ulong)outputPosition, settingNameBuffer); + context.Memory.Write(outputPosition, settingNameBuffer); } return result; @@ -55,7 +55,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Nsd // GetEnvironmentIdentifier() -> buffer<unknown<8>, 0x16> public ResultCode GetEnvironmentIdentifier(ServiceCtx context) { - (long outputPosition, long outputSize) = context.Request.GetBufferType0x22(); + (ulong outputPosition, ulong outputSize) = context.Request.GetBufferType0x22(); ResultCode result = _fqdnResolver.GetEnvironmentIdentifier(context, out string identifier); @@ -63,7 +63,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Nsd { byte[] identifierBuffer = Encoding.UTF8.GetBytes(identifier + '\0'); - context.Memory.Write((ulong)outputPosition, identifierBuffer); + context.Memory.Write(outputPosition, identifierBuffer); } return result; @@ -133,12 +133,12 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Nsd // Resolve(buffer<unknown<0x100>, 0x15>) -> buffer<unknown<0x100>, 0x16> public ResultCode Resolve(ServiceCtx context) { - long outputPosition = context.Request.ReceiveBuff[0].Position; - long outputSize = context.Request.ReceiveBuff[0].Size; + ulong outputPosition = context.Request.ReceiveBuff[0].Position; + ulong outputSize = context.Request.ReceiveBuff[0].Size; ResultCode result = _fqdnResolver.ResolveEx(context, out _, out string resolvedAddress); - if (resolvedAddress.Length > outputSize) + if ((ulong)resolvedAddress.Length > outputSize) { return ResultCode.InvalidArgument; } @@ -147,7 +147,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Nsd MemoryHelper.FillWithZeros(context.Memory, outputPosition, (int)outputSize); - context.Memory.Write((ulong)outputPosition, resolvedAddressBuffer); + context.Memory.Write(outputPosition, resolvedAddressBuffer); return result; } @@ -156,12 +156,12 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Nsd // ResolveEx(buffer<unknown<0x100>, 0x15>) -> (u32, buffer<unknown<0x100>, 0x16>) public ResultCode ResolveEx(ServiceCtx context) { - long outputPosition = context.Request.ReceiveBuff[0].Position; - long outputSize = context.Request.ReceiveBuff[0].Size; + ulong outputPosition = context.Request.ReceiveBuff[0].Position; + ulong outputSize = context.Request.ReceiveBuff[0].Size; ResultCode result = _fqdnResolver.ResolveEx(context, out ResultCode errorCode, out string resolvedAddress); - if (resolvedAddress.Length > outputSize) + if ((ulong)resolvedAddress.Length > outputSize) { return ResultCode.InvalidArgument; } @@ -170,7 +170,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Nsd MemoryHelper.FillWithZeros(context.Memory, outputPosition, (int)outputSize); - context.Memory.Write((ulong)outputPosition, resolvedAddressBuffer); + context.Memory.Write(outputPosition, resolvedAddressBuffer); context.ResponseData.Write((int)errorCode); diff --git a/Ryujinx.HLE/HOS/Services/Sockets/Nsd/Manager/FqdnResolver.cs b/Ryujinx.HLE/HOS/Services/Sockets/Nsd/Manager/FqdnResolver.cs index 6bdf06ad..c400c3b8 100644 --- a/Ryujinx.HLE/HOS/Services/Sockets/Nsd/Manager/FqdnResolver.cs +++ b/Ryujinx.HLE/HOS/Services/Sockets/Nsd/Manager/FqdnResolver.cs @@ -97,12 +97,12 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Nsd.Manager public ResultCode ResolveEx(ServiceCtx context, out ResultCode resultCode, out string resolvedAddress) { - long inputPosition = context.Request.SendBuff[0].Position; - long inputSize = context.Request.SendBuff[0].Size; + ulong inputPosition = context.Request.SendBuff[0].Position; + ulong inputSize = context.Request.SendBuff[0].Size; byte[] addressBuffer = new byte[inputSize]; - context.Memory.Read((ulong)inputPosition, addressBuffer); + context.Memory.Read(inputPosition, addressBuffer); string address = Encoding.UTF8.GetString(addressBuffer).TrimEnd('\0'); |
