Update BSD service to handle libnx's 'smart IPC buffers' for address info

This commit is contained in:
Sajid Anwar 2018-06-15 01:59:26 -07:00
parent e581abb2f5
commit fa2cf7f89c

View file

@ -180,8 +180,7 @@ namespace Ryujinx.HLE.OsHle.Services.Bsd
byte[] SentBuffer = Context.Memory.ReadBytes(Context.Request.SendBuff[0].Position,
Context.Request.SendBuff[0].Size);
byte[] AddressBuffer = Context.Memory.ReadBytes(Context.Request.SendBuff[1].Position,
Context.Request.SendBuff[1].Size);
byte[] AddressBuffer = ReadSmartBuffer(Context, 1);
if (!Sockets[SocketId].Handle.Connected)
{
@ -286,8 +285,7 @@ namespace Ryujinx.HLE.OsHle.Services.Bsd
{
int SocketId = Context.RequestData.ReadInt32();
byte[] AddressBuffer = Context.Memory.ReadBytes(Context.Request.SendBuff[0].Position,
Context.Request.SendBuff[0].Size);
byte[] AddressBuffer = ReadSmartBuffer(Context, 0);
try
{
@ -310,8 +308,7 @@ namespace Ryujinx.HLE.OsHle.Services.Bsd
{
int SocketId = Context.RequestData.ReadInt32();
byte[] AddressBuffer = Context.Memory.ReadBytes(Context.Request.SendBuff[0].Position,
Context.Request.SendBuff[0].Size);
byte[] AddressBuffer = ReadSmartBuffer(Context, 0);
try
{
@ -426,6 +423,21 @@ namespace Ryujinx.HLE.OsHle.Services.Bsd
}
}
private byte[] ReadSmartBuffer(ServiceCtx Context, int Index)
{
if (Context.Request.SendBuff[Index].Position != 0 &&
Context.Request.SendBuff[Index].Size != 0)
{
return Context.Memory.ReadBytes(Context.Request.SendBuff[Index].Position,
Context.Request.SendBuff[Index].Size);
}
else
{
return Context.Memory.ReadBytes(Context.Request.PtrBuff[Index].Position,
Context.Request.PtrBuff[Index].Size);
}
}
private int Get16(byte[] Data, int Address)
{
return