aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.HLE/HOS/Kernel
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2024-02-22 16:58:33 -0300
committerGitHub <noreply@github.com>2024-02-22 16:58:33 -0300
commitd4d0a48bfe89d6e8e12ce16829bb2c440b56007c (patch)
tree2376566ed2c06181b3dbc547b1f99f5b533d918b /src/Ryujinx.HLE/HOS/Kernel
parent57d8afd0c99bb43d1ba1e3cc630d257c5da92741 (diff)
Migrate Audio service to new IPC (#6285)
* Migrate audren to new IPC * Migrate audout * Migrate audin * Migrate hwopus * Bye bye old audio service * Switch volume control to IHardwareDeviceDriver * Somewhat unrelated changes * Remove Concentus reference from HLE * Implement OpenAudioRendererForManualExecution * Remove SetVolume/GetVolume methods that are not necessary * Remove SetVolume/GetVolume methods that are not necessary (2) * Fix incorrect volume update * PR feedback * PR feedback * Stub audrec * Init outParameter * Make FinalOutputRecorderParameter/Internal readonly * Make FinalOutputRecorder IDisposable * Fix HardwareOpusDecoderManager parameter buffers * Opus work buffer size and error handling improvements * Add AudioInProtocolName enum * Fix potential divisions by zero
Diffstat (limited to 'src/Ryujinx.HLE/HOS/Kernel')
-rw-r--r--src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/ExternalEvent.cs25
-rw-r--r--src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs32
2 files changed, 57 insertions, 0 deletions
diff --git a/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/ExternalEvent.cs b/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/ExternalEvent.cs
new file mode 100644
index 00000000..738d6b64
--- /dev/null
+++ b/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/ExternalEvent.cs
@@ -0,0 +1,25 @@
+using Ryujinx.HLE.HOS.Kernel.Threading;
+using Ryujinx.Horizon.Common;
+
+namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
+{
+ readonly struct ExternalEvent : IExternalEvent
+ {
+ private readonly KWritableEvent _writableEvent;
+
+ public ExternalEvent(KWritableEvent writableEvent)
+ {
+ _writableEvent = writableEvent;
+ }
+
+ public readonly void Signal()
+ {
+ _writableEvent.Signal();
+ }
+
+ public readonly void Clear()
+ {
+ _writableEvent.Clear();
+ }
+ }
+}
diff --git a/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs b/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs
index b07f5194..6595ecef 100644
--- a/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs
+++ b/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs
@@ -8,6 +8,7 @@ using Ryujinx.HLE.HOS.Kernel.Memory;
using Ryujinx.HLE.HOS.Kernel.Process;
using Ryujinx.HLE.HOS.Kernel.Threading;
using Ryujinx.Horizon.Common;
+using Ryujinx.Memory;
using System;
using System.Buffers;
using System.Threading;
@@ -3142,6 +3143,37 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
}
#pragma warning restore CA1822
+ // Not actual syscalls, used by HLE services and such.
+
+ public IExternalEvent GetExternalEvent(int handle)
+ {
+ KWritableEvent writableEvent = KernelStatic.GetCurrentProcess().HandleTable.GetObject<KWritableEvent>(handle);
+
+ if (writableEvent == null)
+ {
+ return null;
+ }
+
+ return new ExternalEvent(writableEvent);
+ }
+
+ public IVirtualMemoryManager GetMemoryManagerByProcessHandle(int handle)
+ {
+ return KernelStatic.GetCurrentProcess().HandleTable.GetKProcess(handle).CpuMemory;
+ }
+
+ public ulong GetTransferMemoryAddress(int handle)
+ {
+ KTransferMemory transferMemory = KernelStatic.GetCurrentProcess().HandleTable.GetObject<KTransferMemory>(handle);
+
+ if (transferMemory == null)
+ {
+ return 0;
+ }
+
+ return transferMemory.Address;
+ }
+
private static bool IsPointingInsideKernel(ulong address)
{
return (address + 0x1000000000) < 0xffffff000;