aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Aud/IAudioDevice.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2018-09-23 15:11:46 -0300
committerThomas Guillemard <thog@protonmail.com>2018-09-23 20:11:46 +0200
commit7de7b559adc1924d3ff31cc58b281f70e468155f (patch)
tree3701e1687f7fc4c4bafdffd5abda1966e6ce320f /Ryujinx.HLE/HOS/Services/Aud/IAudioDevice.cs
parent54ed9096bd4add5cf2ca320123f551f60c06a57f (diff)
Improve kernel events implementation (#430)
* Improve kernel events implementation * Some cleanup * Address PR feedback
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Aud/IAudioDevice.cs')
-rw-r--r--Ryujinx.HLE/HOS/Services/Aud/IAudioDevice.cs18
1 files changed, 14 insertions, 4 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Aud/IAudioDevice.cs b/Ryujinx.HLE/HOS/Services/Aud/IAudioDevice.cs
index adecc721..a1a228ed 100644
--- a/Ryujinx.HLE/HOS/Services/Aud/IAudioDevice.cs
+++ b/Ryujinx.HLE/HOS/Services/Aud/IAudioDevice.cs
@@ -2,6 +2,7 @@ using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel;
using Ryujinx.HLE.HOS.SystemState;
using Ryujinx.HLE.Logging;
+using System;
using System.Collections.Generic;
using System.Text;
@@ -35,7 +36,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud
SystemEvent = new KEvent(System);
//TODO: We shouldn't be signaling this here.
- SystemEvent.Signal();
+ SystemEvent.ReadableEvent.Signal();
}
public long ListAudioDeviceName(ServiceCtx Context)
@@ -107,7 +108,10 @@ namespace Ryujinx.HLE.HOS.Services.Aud
public long QueryAudioDeviceSystemEvent(ServiceCtx Context)
{
- int Handle = Context.Process.HandleTable.OpenHandle(SystemEvent);
+ if (Context.Process.HandleTable.GenerateHandle(SystemEvent.ReadableEvent, out int Handle) != KernelResult.Success)
+ {
+ throw new InvalidOperationException("Out of handles!");
+ }
Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle);
@@ -200,7 +204,10 @@ namespace Ryujinx.HLE.HOS.Services.Aud
public long QueryAudioDeviceInputEvent(ServiceCtx Context)
{
- int Handle = Context.Process.HandleTable.OpenHandle(SystemEvent);
+ if (Context.Process.HandleTable.GenerateHandle(SystemEvent.ReadableEvent, out int Handle) != KernelResult.Success)
+ {
+ throw new InvalidOperationException("Out of handles!");
+ }
Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle);
@@ -211,7 +218,10 @@ namespace Ryujinx.HLE.HOS.Services.Aud
public long QueryAudioDeviceOutputEvent(ServiceCtx Context)
{
- int Handle = Context.Process.HandleTable.OpenHandle(SystemEvent);
+ if (Context.Process.HandleTable.GenerateHandle(SystemEvent.ReadableEvent, out int Handle) != KernelResult.Success)
+ {
+ throw new InvalidOperationException("Out of handles!");
+ }
Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle);