diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2018-09-23 15:11:46 -0300 |
|---|---|---|
| committer | Thomas Guillemard <thog@protonmail.com> | 2018-09-23 20:11:46 +0200 |
| commit | 7de7b559adc1924d3ff31cc58b281f70e468155f (patch) | |
| tree | 3701e1687f7fc4c4bafdffd5abda1966e6ce320f /Ryujinx.HLE/HOS/Services/Aud | |
| parent | 54ed9096bd4add5cf2ca320123f551f60c06a57f (diff) | |
Improve kernel events implementation (#430)
* Improve kernel events implementation
* Some cleanup
* Address PR feedback
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Aud')
4 files changed, 24 insertions, 8 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Aud/AudioOut/IAudioOut.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioOut/IAudioOut.cs index 2b0b5293..cd3d6e49 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/AudioOut/IAudioOut.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioOut/IAudioOut.cs @@ -67,7 +67,10 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioOut public long RegisterBufferEvent(ServiceCtx Context) { - int Handle = Context.Process.HandleTable.OpenHandle(ReleaseEvent); + if (Context.Process.HandleTable.GenerateHandle(ReleaseEvent.ReadableEvent, out int Handle) != KernelResult.Success) + { + throw new InvalidOperationException("Out of handles!"); + } Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle); diff --git a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/IAudioRenderer.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/IAudioRenderer.cs index ae85bf01..85f82622 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/IAudioRenderer.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/IAudioRenderer.cs @@ -72,7 +72,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer private void AudioCallback() { - UpdateEvent.Signal(); + UpdateEvent.ReadableEvent.Signal(); } private static T[] CreateArray<T>(int Size) where T : new() @@ -218,7 +218,10 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer public long QuerySystemEvent(ServiceCtx Context) { - int Handle = Context.Process.HandleTable.OpenHandle(UpdateEvent); + if (Context.Process.HandleTable.GenerateHandle(UpdateEvent.ReadableEvent, out int Handle) != KernelResult.Success) + { + throw new InvalidOperationException("Out of handles!"); + } Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle); 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); diff --git a/Ryujinx.HLE/HOS/Services/Aud/IAudioOutManager.cs b/Ryujinx.HLE/HOS/Services/Aud/IAudioOutManager.cs index ef9250d9..44b856cd 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/IAudioOutManager.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/IAudioOutManager.cs @@ -150,7 +150,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud ReleaseCallback Callback = () => { - ReleaseEvent.Signal(); + ReleaseEvent.ReadableEvent.Signal(); }; IAalOutput AudioOut = Context.Device.AudioOut; |
