mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-21 18:12:00 +00:00
bsd: Fix Poll writting in input buffer (#3630)
This is a very old oversight on our Poll implementation. This worked so far reliably because games and homebrews pass the same buffer as input and output.
This commit is contained in:
parent
923089a298
commit
9bad71afbf
1 changed files with 6 additions and 5 deletions
|
@ -219,9 +219,10 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
|
||||||
int fdsCount = context.RequestData.ReadInt32();
|
int fdsCount = context.RequestData.ReadInt32();
|
||||||
int timeout = context.RequestData.ReadInt32();
|
int timeout = context.RequestData.ReadInt32();
|
||||||
|
|
||||||
(ulong bufferPosition, ulong bufferSize) = context.Request.GetBufferType0x21();
|
(ulong inputBufferPosition, ulong inputBufferSize) = context.Request.GetBufferType0x21();
|
||||||
|
(ulong outputBufferPosition, ulong outputBufferSize) = context.Request.GetBufferType0x22();
|
||||||
|
|
||||||
if (timeout < -1 || fdsCount < 0 || (ulong)(fdsCount * 8) > bufferSize)
|
if (timeout < -1 || fdsCount < 0 || (ulong)(fdsCount * 8) > inputBufferSize)
|
||||||
{
|
{
|
||||||
return WriteBsdResult(context, -1, LinuxError.EINVAL);
|
return WriteBsdResult(context, -1, LinuxError.EINVAL);
|
||||||
}
|
}
|
||||||
|
@ -230,7 +231,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
|
||||||
|
|
||||||
for (int i = 0; i < fdsCount; i++)
|
for (int i = 0; i < fdsCount; i++)
|
||||||
{
|
{
|
||||||
PollEventData pollEventData = context.Memory.Read<PollEventData>(bufferPosition + (ulong)(i * Unsafe.SizeOf<PollEventData>()));
|
PollEventData pollEventData = context.Memory.Read<PollEventData>(inputBufferPosition + (ulong)(i * Unsafe.SizeOf<PollEventData>()));
|
||||||
|
|
||||||
IFileDescriptor fileDescriptor = _context.RetrieveFileDescriptor(pollEventData.SocketFd);
|
IFileDescriptor fileDescriptor = _context.RetrieveFileDescriptor(pollEventData.SocketFd);
|
||||||
|
|
||||||
|
@ -277,7 +278,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
|
||||||
{
|
{
|
||||||
bool IsUnexpectedLinuxError(LinuxError error)
|
bool IsUnexpectedLinuxError(LinuxError error)
|
||||||
{
|
{
|
||||||
return errno != LinuxError.SUCCESS && errno != LinuxError.ETIMEDOUT;
|
return error != LinuxError.SUCCESS && error != LinuxError.ETIMEDOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hybrid approach
|
// Hybrid approach
|
||||||
|
@ -332,7 +333,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
|
||||||
// TODO: Spanify
|
// TODO: Spanify
|
||||||
for (int i = 0; i < fdsCount; i++)
|
for (int i = 0; i < fdsCount; i++)
|
||||||
{
|
{
|
||||||
context.Memory.Write(bufferPosition + (ulong)(i * Unsafe.SizeOf<PollEventData>()), events[i].Data);
|
context.Memory.Write(outputBufferPosition + (ulong)(i * Unsafe.SizeOf<PollEventData>()), events[i].Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return WriteBsdResult(context, updateCount, errno);
|
return WriteBsdResult(context, updateCount, errno);
|
||||||
|
|
Loading…
Reference in a new issue