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:
Mary 2021-04-24 12:16:01 +02:00 committed by GitHub
parent c46f6879ff
commit 305f06eb71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
73 changed files with 707 additions and 716 deletions

View file

@ -26,12 +26,12 @@ namespace Ryujinx.HLE.HOS.Services.Ssl.SslService
// SetHostName(buffer<bytes, 5>)
public ResultCode SetHostName(ServiceCtx context)
{
long hostNameDataPosition = context.Request.SendBuff[0].Position;
long hostNameDataSize = context.Request.SendBuff[0].Size;
ulong hostNameDataPosition = context.Request.SendBuff[0].Position;
ulong hostNameDataSize = context.Request.SendBuff[0].Size;
byte[] hostNameData = new byte[hostNameDataSize];
context.Memory.Read((ulong)hostNameDataPosition, hostNameData);
context.Memory.Read(hostNameDataPosition, hostNameData);
string hostName = Encoding.ASCII.GetString(hostNameData).Trim('\0');
@ -75,12 +75,12 @@ namespace Ryujinx.HLE.HOS.Services.Ssl.SslService
// Write(buffer<bytes, 5>) -> u32
public ResultCode Write(ServiceCtx context)
{
long inputDataPosition = context.Request.SendBuff[0].Position;
long inputDataSize = context.Request.SendBuff[0].Size;
ulong inputDataPosition = context.Request.SendBuff[0].Position;
ulong inputDataSize = context.Request.SendBuff[0].Size;
byte[] data = new byte[inputDataSize];
context.Memory.Read((ulong)inputDataPosition, data);
context.Memory.Read(inputDataPosition, data);
// NOTE: Tell the guest everything is transferred.
uint transferredSize = (uint)inputDataSize;

View file

@ -41,8 +41,8 @@ namespace Ryujinx.HLE.HOS.Services.Ssl.SslService
{
CertificateFormat certificateFormat = (CertificateFormat)context.RequestData.ReadUInt32();
long certificateDataPosition = context.Request.SendBuff[0].Position;
long certificateDataSize = context.Request.SendBuff[0].Size;
ulong certificateDataPosition = context.Request.SendBuff[0].Position;
ulong certificateDataSize = context.Request.SendBuff[0].Size;
context.ResponseData.Write(_serverCertificateId++);
@ -55,15 +55,15 @@ namespace Ryujinx.HLE.HOS.Services.Ssl.SslService
// ImportClientPki(buffer<bytes, 5> certificate, buffer<bytes, 5> ascii_password) -> u64 certificateId
public ResultCode ImportClientPki(ServiceCtx context)
{
long certificateDataPosition = context.Request.SendBuff[0].Position;
long certificateDataSize = context.Request.SendBuff[0].Size;
ulong certificateDataPosition = context.Request.SendBuff[0].Position;
ulong certificateDataSize = context.Request.SendBuff[0].Size;
long asciiPasswordDataPosition = context.Request.SendBuff[1].Position;
long asciiPasswordDataSize = context.Request.SendBuff[1].Size;
ulong asciiPasswordDataPosition = context.Request.SendBuff[1].Position;
ulong asciiPasswordDataSize = context.Request.SendBuff[1].Size;
byte[] asciiPasswordData = new byte[asciiPasswordDataSize];
context.Memory.Read((ulong)asciiPasswordDataPosition, asciiPasswordData);
context.Memory.Read(asciiPasswordDataPosition, asciiPasswordData);
string asciiPassword = Encoding.ASCII.GetString(asciiPasswordData).Trim('\0');