mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-12-29 03:53:05 +00:00
Use existing "GetBufferType0x21" for certain BSD socket methods
This commit is contained in:
parent
fa2cf7f89c
commit
e263c70f09
2 changed files with 25 additions and 37 deletions
|
@ -174,39 +174,39 @@ namespace Ryujinx.HLE.OsHle.Ipc
|
|||
return 0;
|
||||
}
|
||||
|
||||
public (long Position, long Size) GetBufferType0x21()
|
||||
public (long Position, long Size) GetBufferType0x21(int Index = 0)
|
||||
{
|
||||
if (PtrBuff.Count != 0 &&
|
||||
PtrBuff[0].Position != 0 &&
|
||||
PtrBuff[0].Size != 0)
|
||||
if (PtrBuff.Count != 0 &&
|
||||
PtrBuff[Index].Position != 0 &&
|
||||
PtrBuff[Index].Size != 0)
|
||||
{
|
||||
return (PtrBuff[0].Position, PtrBuff[0].Size);
|
||||
return (PtrBuff[Index].Position, PtrBuff[Index].Size);
|
||||
}
|
||||
|
||||
if (SendBuff.Count != 0 &&
|
||||
SendBuff[0].Position != 0 &&
|
||||
SendBuff[0].Size != 0)
|
||||
if (SendBuff.Count != 0 &&
|
||||
SendBuff[Index].Position != 0 &&
|
||||
SendBuff[Index].Size != 0)
|
||||
{
|
||||
return (SendBuff[0].Position, SendBuff[0].Size);
|
||||
return (SendBuff[Index].Position, SendBuff[Index].Size);
|
||||
}
|
||||
|
||||
return (0, 0);
|
||||
}
|
||||
|
||||
public (long Position, long Size) GetBufferType0x22()
|
||||
public (long Position, long Size) GetBufferType0x22(int Index = 0)
|
||||
{
|
||||
if (RecvListBuff.Count != 0 &&
|
||||
RecvListBuff[0].Position != 0 &&
|
||||
RecvListBuff[0].Size != 0)
|
||||
if (RecvListBuff.Count != 0 &&
|
||||
RecvListBuff[Index].Position != 0 &&
|
||||
RecvListBuff[Index].Size != 0)
|
||||
{
|
||||
return (RecvListBuff[0].Position, RecvListBuff[0].Size);
|
||||
return (RecvListBuff[Index].Position, RecvListBuff[Index].Size);
|
||||
}
|
||||
|
||||
if (ReceiveBuff.Count != 0 &&
|
||||
ReceiveBuff[0].Position != 0 &&
|
||||
ReceiveBuff[0].Size != 0)
|
||||
if (ReceiveBuff.Count != 0 &&
|
||||
ReceiveBuff[Index].Position != 0 &&
|
||||
ReceiveBuff[Index].Size != 0)
|
||||
{
|
||||
return (ReceiveBuff[0].Position, ReceiveBuff[0].Size);
|
||||
return (ReceiveBuff[Index].Position, ReceiveBuff[Index].Size);
|
||||
}
|
||||
|
||||
return (0, 0);
|
||||
|
|
|
@ -180,7 +180,8 @@ namespace Ryujinx.HLE.OsHle.Services.Bsd
|
|||
byte[] SentBuffer = Context.Memory.ReadBytes(Context.Request.SendBuff[0].Position,
|
||||
Context.Request.SendBuff[0].Size);
|
||||
|
||||
byte[] AddressBuffer = ReadSmartBuffer(Context, 1);
|
||||
(long AddressPosition, long AddressSize) = Context.Request.GetBufferType0x21(Index: 1);
|
||||
byte[] AddressBuffer = Context.Memory.ReadBytes(AddressPosition, AddressSize);
|
||||
|
||||
if (!Sockets[SocketId].Handle.Connected)
|
||||
{
|
||||
|
@ -284,8 +285,9 @@ namespace Ryujinx.HLE.OsHle.Services.Bsd
|
|||
public long Bind(ServiceCtx Context)
|
||||
{
|
||||
int SocketId = Context.RequestData.ReadInt32();
|
||||
|
||||
byte[] AddressBuffer = ReadSmartBuffer(Context, 0);
|
||||
|
||||
(long AddressPosition, long AddressSize) = Context.Request.GetBufferType0x21();
|
||||
byte[] AddressBuffer = Context.Memory.ReadBytes(AddressPosition, AddressSize);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -308,7 +310,8 @@ namespace Ryujinx.HLE.OsHle.Services.Bsd
|
|||
{
|
||||
int SocketId = Context.RequestData.ReadInt32();
|
||||
|
||||
byte[] AddressBuffer = ReadSmartBuffer(Context, 0);
|
||||
(long AddressPosition, long AddressSize) = Context.Request.GetBufferType0x21();
|
||||
byte[] AddressBuffer = Context.Memory.ReadBytes(AddressPosition, AddressSize);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -423,21 +426,6 @@ 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
|
||||
|
|
Loading…
Reference in a new issue