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
|
@ -27,10 +27,10 @@ namespace Ryujinx.HLE.HOS.Services.Audio
|
|||
{
|
||||
string[] deviceNames = _impl.ListAudioOuts();
|
||||
|
||||
long position = context.Request.ReceiveBuff[0].Position;
|
||||
long size = context.Request.ReceiveBuff[0].Size;
|
||||
ulong position = context.Request.ReceiveBuff[0].Position;
|
||||
ulong size = context.Request.ReceiveBuff[0].Size;
|
||||
|
||||
long basePosition = position;
|
||||
ulong basePosition = position;
|
||||
|
||||
int count = 0;
|
||||
|
||||
|
@ -38,15 +38,15 @@ namespace Ryujinx.HLE.HOS.Services.Audio
|
|||
{
|
||||
byte[] buffer = Encoding.ASCII.GetBytes(name);
|
||||
|
||||
if ((position - basePosition) + buffer.Length > size)
|
||||
if ((position - basePosition) + (ulong)buffer.Length > size)
|
||||
{
|
||||
Logger.Error?.Print(LogClass.ServiceAudio, $"Output buffer size {size} too small!");
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
context.Memory.Write((ulong)position, buffer);
|
||||
MemoryHelper.FillWithZeros(context.Memory, position + buffer.Length, AudioOutNameSize - buffer.Length);
|
||||
context.Memory.Write(position, buffer);
|
||||
MemoryHelper.FillWithZeros(context.Memory, position + (ulong)buffer.Length, AudioOutNameSize - buffer.Length);
|
||||
|
||||
position += AudioOutNameSize;
|
||||
count++;
|
||||
|
@ -65,15 +65,15 @@ namespace Ryujinx.HLE.HOS.Services.Audio
|
|||
AudioInputConfiguration inputConfiguration = context.RequestData.ReadStruct<AudioInputConfiguration>();
|
||||
ulong appletResourceUserId = context.RequestData.ReadUInt64();
|
||||
|
||||
long deviceNameInputPosition = context.Request.SendBuff[0].Position;
|
||||
long deviceNameInputSize = context.Request.SendBuff[0].Size;
|
||||
ulong deviceNameInputPosition = context.Request.SendBuff[0].Position;
|
||||
ulong deviceNameInputSize = context.Request.SendBuff[0].Size;
|
||||
|
||||
long deviceNameOutputPosition = context.Request.ReceiveBuff[0].Position;
|
||||
long deviceNameOutputSize = context.Request.ReceiveBuff[0].Size;
|
||||
ulong deviceNameOutputPosition = context.Request.ReceiveBuff[0].Position;
|
||||
ulong deviceNameOutputSize = context.Request.ReceiveBuff[0].Size;
|
||||
|
||||
uint processHandle = (uint)context.Request.HandleDesc.ToCopy[0];
|
||||
|
||||
string inputDeviceName = MemoryHelper.ReadAsciiString(context.Memory, deviceNameInputPosition, deviceNameInputSize);
|
||||
string inputDeviceName = MemoryHelper.ReadAsciiString(context.Memory, deviceNameInputPosition, (long)deviceNameInputSize);
|
||||
|
||||
ResultCode resultCode = _impl.OpenAudioOut(context, out string outputDeviceName, out AudioOutputConfiguration outputConfiguration, out IAudioOut obj, inputDeviceName, ref inputConfiguration, appletResourceUserId, processHandle);
|
||||
|
||||
|
@ -83,8 +83,8 @@ namespace Ryujinx.HLE.HOS.Services.Audio
|
|||
|
||||
byte[] outputDeviceNameRaw = Encoding.ASCII.GetBytes(outputDeviceName);
|
||||
|
||||
context.Memory.Write((ulong)deviceNameOutputPosition, outputDeviceNameRaw);
|
||||
MemoryHelper.FillWithZeros(context.Memory, deviceNameOutputPosition + outputDeviceNameRaw.Length, AudioOutNameSize - outputDeviceNameRaw.Length);
|
||||
context.Memory.Write(deviceNameOutputPosition, outputDeviceNameRaw);
|
||||
MemoryHelper.FillWithZeros(context.Memory, deviceNameOutputPosition + (ulong)outputDeviceNameRaw.Length, AudioOutNameSize - outputDeviceNameRaw.Length);
|
||||
|
||||
MakeObject(context, new AudioOutServer(obj));
|
||||
}
|
||||
|
@ -98,9 +98,9 @@ namespace Ryujinx.HLE.HOS.Services.Audio
|
|||
{
|
||||
string[] deviceNames = _impl.ListAudioOuts();
|
||||
|
||||
(long position, long size) = context.Request.GetBufferType0x22();
|
||||
(ulong position, ulong size) = context.Request.GetBufferType0x22();
|
||||
|
||||
long basePosition = position;
|
||||
ulong basePosition = position;
|
||||
|
||||
int count = 0;
|
||||
|
||||
|
@ -108,15 +108,15 @@ namespace Ryujinx.HLE.HOS.Services.Audio
|
|||
{
|
||||
byte[] buffer = Encoding.ASCII.GetBytes(name);
|
||||
|
||||
if ((position - basePosition) + buffer.Length > size)
|
||||
if ((position - basePosition) + (ulong)buffer.Length > size)
|
||||
{
|
||||
Logger.Error?.Print(LogClass.ServiceAudio, $"Output buffer size {size} too small!");
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
context.Memory.Write((ulong)position, buffer);
|
||||
MemoryHelper.FillWithZeros(context.Memory, position + buffer.Length, AudioOutNameSize - buffer.Length);
|
||||
context.Memory.Write(position, buffer);
|
||||
MemoryHelper.FillWithZeros(context.Memory, position + (ulong)buffer.Length, AudioOutNameSize - buffer.Length);
|
||||
|
||||
position += AudioOutNameSize;
|
||||
count++;
|
||||
|
@ -135,12 +135,12 @@ namespace Ryujinx.HLE.HOS.Services.Audio
|
|||
AudioInputConfiguration inputConfiguration = context.RequestData.ReadStruct<AudioInputConfiguration>();
|
||||
ulong appletResourceUserId = context.RequestData.ReadUInt64();
|
||||
|
||||
(long deviceNameInputPosition, long deviceNameInputSize) = context.Request.GetBufferType0x21();
|
||||
(long deviceNameOutputPosition, long deviceNameOutputSize) = context.Request.GetBufferType0x22();
|
||||
(ulong deviceNameInputPosition, ulong deviceNameInputSize) = context.Request.GetBufferType0x21();
|
||||
(ulong deviceNameOutputPosition, ulong deviceNameOutputSize) = context.Request.GetBufferType0x22();
|
||||
|
||||
uint processHandle = (uint)context.Request.HandleDesc.ToCopy[0];
|
||||
|
||||
string inputDeviceName = MemoryHelper.ReadAsciiString(context.Memory, deviceNameInputPosition, deviceNameInputSize);
|
||||
string inputDeviceName = MemoryHelper.ReadAsciiString(context.Memory, deviceNameInputPosition, (long)deviceNameInputSize);
|
||||
|
||||
ResultCode resultCode = _impl.OpenAudioOut(context, out string outputDeviceName, out AudioOutputConfiguration outputConfiguration, out IAudioOut obj, inputDeviceName, ref inputConfiguration, appletResourceUserId, processHandle);
|
||||
|
||||
|
@ -150,8 +150,8 @@ namespace Ryujinx.HLE.HOS.Services.Audio
|
|||
|
||||
byte[] outputDeviceNameRaw = Encoding.ASCII.GetBytes(outputDeviceName);
|
||||
|
||||
context.Memory.Write((ulong)deviceNameOutputPosition, outputDeviceNameRaw);
|
||||
MemoryHelper.FillWithZeros(context.Memory, deviceNameOutputPosition + outputDeviceNameRaw.Length, AudioOutNameSize - outputDeviceNameRaw.Length);
|
||||
context.Memory.Write(deviceNameOutputPosition, outputDeviceNameRaw);
|
||||
MemoryHelper.FillWithZeros(context.Memory, deviceNameOutputPosition + (ulong)outputDeviceNameRaw.Length, AudioOutNameSize - outputDeviceNameRaw.Length);
|
||||
|
||||
MakeObject(context, new AudioOutServer(obj));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue