From aedfadaaf710d8f363b730f82f8e82437a43e115 Mon Sep 17 00:00:00 2001 From: Shane Slattery Date: Sun, 4 Dec 2022 19:46:02 +0000 Subject: [PATCH] Add InfoType.MesosphereCurrentProcess (#3792) * Add InfoType.MesosphereCurrentProcess * Make outHandle inlined Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> --- .../HOS/Kernel/SupervisorCall/InfoType.cs | 3 ++- .../HOS/Kernel/SupervisorCall/Syscall.cs | 27 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/Ryujinx.HLE/HOS/Kernel/SupervisorCall/InfoType.cs b/Ryujinx.HLE/HOS/Kernel/SupervisorCall/InfoType.cs index 5d6b1c7d..3cf7ba74 100644 --- a/Ryujinx.HLE/HOS/Kernel/SupervisorCall/InfoType.cs +++ b/Ryujinx.HLE/HOS/Kernel/SupervisorCall/InfoType.cs @@ -28,6 +28,7 @@ UsedNonSystemMemorySize, IsApplication, FreeThreadCount, - ThreadTickCount + ThreadTickCount, + MesosphereCurrentProcess = 65001 } } diff --git a/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs b/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs index 189e4a3e..c3fb8b8a 100644 --- a/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs +++ b/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs @@ -2107,6 +2107,33 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall break; } + case InfoType.MesosphereCurrentProcess: + { + if (handle != 0) + { + return KernelResult.InvalidHandle; + } + + if ((ulong)subId != 0) + { + return KernelResult.InvalidCombination; + } + + KProcess currentProcess = KernelStatic.GetCurrentProcess(); + KHandleTable handleTable = currentProcess.HandleTable; + + KernelResult result = handleTable.GenerateHandle(currentProcess, out int outHandle); + + if (result != KernelResult.Success) + { + return result; + } + + value = (ulong)outHandle; + + break; + } + default: return KernelResult.InvalidEnumValue; }