mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-08 17:48:32 +00:00
08831eecf7
* IPC refactor part 3 + 4: New server HIPC message processor with source generator based serialization * Make types match on calls to AlignUp/AlignDown * Formatting * Address some PR feedback * Move BitfieldExtensions to Ryujinx.Common.Utilities and consolidate implementations * Rename Reader/Writer to SpanReader/SpanWriter and move to Ryujinx.Common.Memory * Implement EventType * Address more PR feedback * Log request processing errors since they are not normal * Rename waitable to multiwait and add missing lock * PR feedback * Ac_K PR feedback
72 lines
1.7 KiB
C#
72 lines
1.7 KiB
C#
using Ryujinx.HLE.HOS.Kernel.Common;
|
|
using Ryujinx.Horizon.Common;
|
|
|
|
namespace Ryujinx.HLE.HOS.Kernel.Ipc
|
|
{
|
|
class KPort : KAutoObject
|
|
{
|
|
public KServerPort ServerPort { get; }
|
|
public KClientPort ClientPort { get; }
|
|
|
|
private string _name;
|
|
|
|
private ChannelState _state;
|
|
|
|
public bool IsLight { get; private set; }
|
|
|
|
public KPort(KernelContext context, int maxSessions, bool isLight, string name) : base(context)
|
|
{
|
|
ServerPort = new KServerPort(context, this);
|
|
ClientPort = new KClientPort(context, this, maxSessions);
|
|
|
|
IsLight = isLight;
|
|
_name = name;
|
|
|
|
_state = ChannelState.Open;
|
|
}
|
|
|
|
public Result EnqueueIncomingSession(KServerSession session)
|
|
{
|
|
Result result;
|
|
|
|
KernelContext.CriticalSection.Enter();
|
|
|
|
if (_state == ChannelState.Open)
|
|
{
|
|
ServerPort.EnqueueIncomingSession(session);
|
|
|
|
result = Result.Success;
|
|
}
|
|
else
|
|
{
|
|
result = KernelResult.PortClosed;
|
|
}
|
|
|
|
KernelContext.CriticalSection.Leave();
|
|
|
|
return result;
|
|
}
|
|
|
|
public Result EnqueueIncomingLightSession(KLightServerSession session)
|
|
{
|
|
Result result;
|
|
|
|
KernelContext.CriticalSection.Enter();
|
|
|
|
if (_state == ChannelState.Open)
|
|
{
|
|
ServerPort.EnqueueIncomingLightSession(session);
|
|
|
|
result = Result.Success;
|
|
}
|
|
else
|
|
{
|
|
result = KernelResult.PortClosed;
|
|
}
|
|
|
|
KernelContext.CriticalSection.Leave();
|
|
|
|
return result;
|
|
}
|
|
}
|
|
} |