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
85 lines
2.8 KiB
C#
85 lines
2.8 KiB
C#
using Ryujinx.Horizon.Sdk.OsTypes.Impl;
|
|
using Ryujinx.Horizon.Common;
|
|
using System;
|
|
|
|
namespace Ryujinx.Horizon.Sdk.OsTypes
|
|
{
|
|
static partial class Os
|
|
{
|
|
public static Result CreateSystemEvent(out SystemEventType sysEvent, EventClearMode clearMode, bool interProcess)
|
|
{
|
|
sysEvent = new SystemEventType();
|
|
|
|
if (interProcess)
|
|
{
|
|
Result result = InterProcessEvent.Create(ref sysEvent.InterProcessEvent, clearMode);
|
|
|
|
if (result != Result.Success)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
sysEvent.State = SystemEventType.InitializationState.InitializedAsInterProcess;
|
|
}
|
|
else
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
return Result.Success;
|
|
}
|
|
|
|
public static void DestroySystemEvent(ref SystemEventType sysEvent)
|
|
{
|
|
var oldState = sysEvent.State;
|
|
sysEvent.State = SystemEventType.InitializationState.NotInitialized;
|
|
|
|
switch (oldState)
|
|
{
|
|
case SystemEventType.InitializationState.InitializedAsInterProcess:
|
|
InterProcessEvent.Destroy(ref sysEvent.InterProcessEvent);
|
|
break;
|
|
}
|
|
}
|
|
|
|
public static int DetachReadableHandleOfSystemEvent(ref SystemEventType sysEvent)
|
|
{
|
|
return InterProcessEvent.DetachReadableHandle(ref sysEvent.InterProcessEvent);
|
|
}
|
|
|
|
public static int DetachWritableHandleOfSystemEvent(ref SystemEventType sysEvent)
|
|
{
|
|
return InterProcessEvent.DetachWritableHandle(ref sysEvent.InterProcessEvent);
|
|
}
|
|
|
|
public static int GetReadableHandleOfSystemEvent(ref SystemEventType sysEvent)
|
|
{
|
|
return InterProcessEvent.GetReadableHandle(ref sysEvent.InterProcessEvent);
|
|
}
|
|
|
|
public static int GetWritableHandleOfSystemEvent(ref SystemEventType sysEvent)
|
|
{
|
|
return InterProcessEvent.GetWritableHandle(ref sysEvent.InterProcessEvent);
|
|
}
|
|
|
|
public static void SignalSystemEvent(ref SystemEventType sysEvent)
|
|
{
|
|
switch (sysEvent.State)
|
|
{
|
|
case SystemEventType.InitializationState.InitializedAsInterProcess:
|
|
InterProcessEvent.Signal(ref sysEvent.InterProcessEvent);
|
|
break;
|
|
}
|
|
}
|
|
|
|
public static void ClearSystemEvent(ref SystemEventType sysEvent)
|
|
{
|
|
switch (sysEvent.State)
|
|
{
|
|
case SystemEventType.InitializationState.InitializedAsInterProcess:
|
|
InterProcessEvent.Clear(ref sysEvent.InterProcessEvent);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|