Improve kernel events implementation (#430)

* Improve kernel events implementation

* Some cleanup

* Address PR feedback
This commit is contained in:
gdkchan 2018-09-23 15:11:46 -03:00 committed by Thomas Guillemard
parent 54ed9096bd
commit 7de7b559ad
38 changed files with 597 additions and 161 deletions

View file

@ -1,6 +1,7 @@
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel;
using Ryujinx.HLE.Logging;
using System;
using System.Collections.Generic;
namespace Ryujinx.HLE.HOS.Services.Nifm
@ -48,8 +49,15 @@ namespace Ryujinx.HLE.HOS.Services.Nifm
public long GetSystemEventReadableHandles(ServiceCtx Context)
{
int Handle0 = Context.Process.HandleTable.OpenHandle(Event0);
int Handle1 = Context.Process.HandleTable.OpenHandle(Event1);
if (Context.Process.HandleTable.GenerateHandle(Event0.ReadableEvent, out int Handle0) != KernelResult.Success)
{
throw new InvalidOperationException("Out of handles!");
}
if (Context.Process.HandleTable.GenerateHandle(Event1.ReadableEvent, out int Handle1) != KernelResult.Success)
{
throw new InvalidOperationException("Out of handles!");
}
Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle0, Handle1);