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/Am | |
| 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/Am')
| -rw-r--r-- | Ryujinx.HLE/HOS/Services/Am/AppletAE/IStorageAccessor.cs | 22 | ||||
| -rw-r--r-- | Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs | 16 |
2 files changed, 19 insertions, 19 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Am/AppletAE/IStorageAccessor.cs b/Ryujinx.HLE/HOS/Services/Am/AppletAE/IStorageAccessor.cs index cdc59678..33f5393f 100644 --- a/Ryujinx.HLE/HOS/Services/Am/AppletAE/IStorageAccessor.cs +++ b/Ryujinx.HLE/HOS/Services/Am/AppletAE/IStorageAccessor.cs @@ -29,20 +29,20 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE return ResultCode.ObjectInvalid; } - long writePosition = context.RequestData.ReadInt64(); + ulong writePosition = context.RequestData.ReadUInt64(); - if (writePosition > _storage.Data.Length) + if (writePosition > (ulong)_storage.Data.Length) { return ResultCode.OutOfBounds; } - (long position, long size) = context.Request.GetBufferType0x21(); + (ulong position, ulong size) = context.Request.GetBufferType0x21(); - size = Math.Min(size, _storage.Data.Length - writePosition); + size = Math.Min(size, (ulong)_storage.Data.Length - writePosition); if (size > 0) { - long maxSize = _storage.Data.Length - writePosition; + ulong maxSize = (ulong)_storage.Data.Length - writePosition; if (size > maxSize) { @@ -51,7 +51,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE byte[] data = new byte[size]; - context.Memory.Read((ulong)position, data); + context.Memory.Read(position, data); Buffer.BlockCopy(data, 0, _storage.Data, (int)writePosition, (int)size); } @@ -63,22 +63,22 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE // Read(u64) -> buffer<bytes, 0x22> public ResultCode Read(ServiceCtx context) { - long readPosition = context.RequestData.ReadInt64(); + ulong readPosition = context.RequestData.ReadUInt64(); - if (readPosition > _storage.Data.Length) + if (readPosition > (ulong)_storage.Data.Length) { return ResultCode.OutOfBounds; } - (long position, long size) = context.Request.GetBufferType0x22(); + (ulong position, ulong size) = context.Request.GetBufferType0x22(); - size = Math.Min(size, _storage.Data.Length - readPosition); + size = Math.Min(size, (ulong)_storage.Data.Length - readPosition); byte[] data = new byte[size]; Buffer.BlockCopy(_storage.Data, (int)readPosition, data, 0, (int)size); - context.Memory.Write((ulong)position, data); + context.Memory.Write(position, data); return ResultCode.Success; } diff --git a/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs b/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs index a1a5d8c4..7c04a4d1 100644 --- a/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs +++ b/Ryujinx.HLE/HOS/Services/Am/AppletOE/ApplicationProxyService/ApplicationProxy/IApplicationFunctions.cs @@ -359,13 +359,13 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati // SetApplicationCopyrightImage(buffer<bytes, 0x45> frame_buffer, s32 x, s32 y, s32 width, s32 height, s32 window_origin_mode) public ResultCode SetApplicationCopyrightImage(ServiceCtx context) { - long frameBufferPos = context.Request.SendBuff[0].Position; - long frameBufferSize = context.Request.SendBuff[0].Size; - int x = context.RequestData.ReadInt32(); - int y = context.RequestData.ReadInt32(); - int width = context.RequestData.ReadInt32(); - int height = context.RequestData.ReadInt32(); - uint windowOriginMode = context.RequestData.ReadUInt32(); + ulong frameBufferPos = context.Request.SendBuff[0].Position; + ulong frameBufferSize = context.Request.SendBuff[0].Size; + int x = context.RequestData.ReadInt32(); + int y = context.RequestData.ReadInt32(); + int width = context.RequestData.ReadInt32(); + int height = context.RequestData.ReadInt32(); + uint windowOriginMode = context.RequestData.ReadUInt32(); ResultCode resultCode = ResultCode.InvalidParameters; @@ -388,7 +388,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati return resultCode; } - private ResultCode SetApplicationCopyrightImageImpl(int x, int y, int width, int height, long frameBufferPos, long frameBufferSize, uint windowOriginMode) + private ResultCode SetApplicationCopyrightImageImpl(int x, int y, int width, int height, ulong frameBufferPos, ulong frameBufferSize, uint windowOriginMode) { /* if (_copyrightBuffer == null) |
