From f87ae39a8b2a25a3a9453b881b45393db4576d48 Mon Sep 17 00:00:00 2001 From: MrKev312 <34964788+MrKev312@users.noreply.github.com> Date: Fri, 1 Aug 2025 22:49:19 +0200 Subject: [PATCH] Make methods that can be static, static --- .../HOS/Kernel/SupervisorCall/Syscall.cs | 88 +++++++++---------- .../HOS/Services/Fatal/IService.cs | 2 +- .../Sdk/Audio/Detail/AudioDevice.cs | 12 +-- 3 files changed, 51 insertions(+), 51 deletions(-) diff --git a/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs b/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs index c67220617..76a8ed78c 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs @@ -184,7 +184,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x5f)] - public Result FlushProcessDataCache(int processHandle, ulong address, ulong size) + public static Result FlushProcessDataCache(int processHandle, ulong address, ulong size) { // FIXME: This needs to be implemented as ARMv7 doesn't have any way to do cache maintenance operations on EL0. // As we don't support (and don't actually need) to flush the cache, this is stubbed. @@ -263,7 +263,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x22)] - public Result SendSyncRequestWithUserBuffer( + public static Result SendSyncRequestWithUserBuffer( [PointerSized] ulong messagePtr, [PointerSized] ulong messageSize, int handle) @@ -901,7 +901,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(2)] - public Result SetMemoryPermission([PointerSized] ulong address, [PointerSized] ulong size, KMemoryPermission permission) + public static Result SetMemoryPermission([PointerSized] ulong address, [PointerSized] ulong size, KMemoryPermission permission) { if (!PageAligned(address)) { @@ -934,7 +934,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(3)] - public Result SetMemoryAttribute( + public static Result SetMemoryAttribute( [PointerSized] ulong address, [PointerSized] ulong size, MemoryAttribute attributeMask, @@ -983,7 +983,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(4)] - public Result MapMemory([PointerSized] ulong dst, [PointerSized] ulong src, [PointerSized] ulong size) + public static Result MapMemory([PointerSized] ulong dst, [PointerSized] ulong src, [PointerSized] ulong size) { if (!PageAligned(src | dst)) { @@ -1020,7 +1020,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(5)] - public Result UnmapMemory([PointerSized] ulong dst, [PointerSized] ulong src, [PointerSized] ulong size) + public static Result UnmapMemory([PointerSized] ulong dst, [PointerSized] ulong src, [PointerSized] ulong size) { if (!PageAligned(src | dst)) { @@ -1057,7 +1057,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(6)] - public Result QueryMemory([PointerSized] ulong infoPtr, [PointerSized] out ulong pageInfo, [PointerSized] ulong address) + public static Result QueryMemory([PointerSized] ulong infoPtr, [PointerSized] out ulong pageInfo, [PointerSized] ulong address) { Result result = QueryMemory(out MemoryInfo info, out pageInfo, address); @@ -1092,7 +1092,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x13)] - public Result MapSharedMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size, KMemoryPermission permission) + public static Result MapSharedMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size, KMemoryPermission permission) { if (!PageAligned(address)) { @@ -1139,7 +1139,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x14)] - public Result UnmapSharedMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size) + public static Result UnmapSharedMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size) { if (!PageAligned(address)) { @@ -1244,7 +1244,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x51)] - public Result MapTransferMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size, KMemoryPermission permission) + public static Result MapTransferMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size, KMemoryPermission permission) { if (!PageAligned(address)) { @@ -1291,7 +1291,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x52)] - public Result UnmapTransferMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size) + public static Result UnmapTransferMemory(int handle, [PointerSized] ulong address, [PointerSized] ulong size) { if (!PageAligned(address)) { @@ -1332,7 +1332,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x2c)] - public Result MapPhysicalMemory([PointerSized] ulong address, [PointerSized] ulong size) + public static Result MapPhysicalMemory([PointerSized] ulong address, [PointerSized] ulong size) { if (!PageAligned(address)) { @@ -1368,7 +1368,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x2d)] - public Result UnmapPhysicalMemory([PointerSized] ulong address, [PointerSized] ulong size) + public static Result UnmapPhysicalMemory([PointerSized] ulong address, [PointerSized] ulong size) { if (!PageAligned(address)) { @@ -1445,7 +1445,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x4c)] - public Result ControlCodeMemory( + public static Result ControlCodeMemory( int handle, CodeMemoryOperation op, ulong address, @@ -1524,7 +1524,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x73)] - public Result SetProcessMemoryPermission( + public static Result SetProcessMemoryPermission( int handle, ulong src, ulong size, @@ -1566,7 +1566,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x74)] - public Result MapProcessMemory( + public static Result MapProcessMemory( [PointerSized] ulong dst, int handle, ulong src, @@ -1623,7 +1623,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x75)] - public Result UnmapProcessMemory( + public static Result UnmapProcessMemory( [PointerSized] ulong dst, int handle, ulong src, @@ -1669,7 +1669,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x77)] - public Result MapProcessCodeMemory(int handle, ulong dst, ulong src, ulong size) + public static Result MapProcessCodeMemory(int handle, ulong dst, ulong src, ulong size) { if (!PageAligned(dst) || !PageAligned(src)) { @@ -1707,7 +1707,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x78)] - public Result UnmapProcessCodeMemory(int handle, ulong dst, ulong src, ulong size) + public static Result UnmapProcessCodeMemory(int handle, ulong dst, ulong src, ulong size) { if (!PageAligned(dst) || !PageAligned(src)) { @@ -1752,7 +1752,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall // System [Svc(0x7b)] - public Result TerminateProcess(int handle) + public static Result TerminateProcess(int handle) { KProcess process = KernelStatic.GetCurrentProcess(); @@ -1782,7 +1782,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(7)] - public void ExitProcess() + public static void ExitProcess() { KernelStatic.GetCurrentProcess().TerminateCurrentProcess(); } @@ -1878,7 +1878,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x26)] - public void Break(ulong reason) + public static void Break(ulong reason) { KThread currentThread = KernelStatic.GetCurrentThread(); @@ -1905,7 +1905,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x27)] - public void OutputDebugString([PointerSized] ulong strPtr, [PointerSized] ulong size) + public static void OutputDebugString([PointerSized] ulong strPtr, [PointerSized] ulong size) { KProcess process = KernelStatic.GetCurrentProcess(); @@ -2371,7 +2371,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x30)] - public Result GetResourceLimitLimitValue(out long limitValue, int handle, LimitableResource resource) + public static Result GetResourceLimitLimitValue(out long limitValue, int handle, LimitableResource resource) { limitValue = 0; @@ -2393,7 +2393,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x31)] - public Result GetResourceLimitCurrentValue(out long limitValue, int handle, LimitableResource resource) + public static Result GetResourceLimitCurrentValue(out long limitValue, int handle, LimitableResource resource) { limitValue = 0; @@ -2415,7 +2415,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x37)] - public Result GetResourceLimitPeakValue(out long peak, int handle, LimitableResource resource) + public static Result GetResourceLimitPeakValue(out long peak, int handle, LimitableResource resource) { peak = 0; @@ -2447,7 +2447,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x7e)] - public Result SetResourceLimitLimitValue(int handle, LimitableResource resource, long limitValue) + public static Result SetResourceLimitLimitValue(int handle, LimitableResource resource, long limitValue) { if (resource >= LimitableResource.Count) { @@ -2542,7 +2542,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(9)] - public Result StartThread(int handle) + public static Result StartThread(int handle) { KProcess process = KernelStatic.GetCurrentProcess(); @@ -2570,7 +2570,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0xa)] - public void ExitThread() + public static void ExitThread() { KThread currentThread = KernelStatic.GetCurrentThread(); @@ -2602,7 +2602,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0xc)] - public Result GetThreadPriority(out int priority, int handle) + public static Result GetThreadPriority(out int priority, int handle) { KProcess process = KernelStatic.GetCurrentProcess(); @@ -2623,7 +2623,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0xd)] - public Result SetThreadPriority(int handle, int priority) + public static Result SetThreadPriority(int handle, int priority) { // TODO: NPDM check. @@ -2642,7 +2642,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0xe)] - public Result GetThreadCoreMask(out int preferredCore, out ulong affinityMask, int handle) + public static Result GetThreadCoreMask(out int preferredCore, out ulong affinityMask, int handle) { KProcess process = KernelStatic.GetCurrentProcess(); @@ -2665,7 +2665,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0xf)] - public Result SetThreadCoreMask(int handle, int preferredCore, ulong affinityMask) + public static Result SetThreadCoreMask(int handle, int preferredCore, ulong affinityMask) { KProcess currentProcess = KernelStatic.GetCurrentProcess(); @@ -2714,13 +2714,13 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x10)] - public int GetCurrentProcessorNumber() + public static int GetCurrentProcessorNumber() { return KernelStatic.GetCurrentThread().CurrentCore; } [Svc(0x25)] - public Result GetThreadId(out ulong threadUid, int handle) + public static Result GetThreadId(out ulong threadUid, int handle) { KProcess process = KernelStatic.GetCurrentProcess(); @@ -2741,7 +2741,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x32)] - public Result SetThreadActivity(int handle, bool pause) + public static Result SetThreadActivity(int handle, bool pause) { KProcess process = KernelStatic.GetCurrentProcess(); @@ -2766,7 +2766,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x33)] - public Result GetThreadContext3([PointerSized] ulong address, int handle) + public static Result GetThreadContext3([PointerSized] ulong address, int handle) { KProcess currentProcess = KernelStatic.GetCurrentProcess(); KThread currentThread = KernelStatic.GetCurrentThread(); @@ -2931,7 +2931,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x1a)] - public Result ArbitrateLock(int ownerHandle, [PointerSized] ulong mutexAddress, int requesterHandle) + public static Result ArbitrateLock(int ownerHandle, [PointerSized] ulong mutexAddress, int requesterHandle) { if (IsPointingInsideKernel(mutexAddress)) { @@ -2949,7 +2949,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x1b)] - public Result ArbitrateUnlock([PointerSized] ulong mutexAddress) + public static Result ArbitrateUnlock([PointerSized] ulong mutexAddress) { if (IsPointingInsideKernel(mutexAddress)) { @@ -2967,7 +2967,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x1c)] - public Result WaitProcessWideKeyAtomic( + public static Result WaitProcessWideKeyAtomic( [PointerSized] ulong mutexAddress, [PointerSized] ulong condVarAddress, int handle, @@ -2998,7 +2998,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x1d)] - public Result SignalProcessWideKey([PointerSized] ulong address, int count) + public static Result SignalProcessWideKey([PointerSized] ulong address, int count) { KProcess currentProcess = KernelStatic.GetCurrentProcess(); @@ -3008,7 +3008,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x34)] - public Result WaitForAddress([PointerSized] ulong address, ArbitrationType type, int value, long timeout) + public static Result WaitForAddress([PointerSized] ulong address, ArbitrationType type, int value, long timeout) { if (IsPointingInsideKernel(address)) { @@ -3040,7 +3040,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x35)] - public Result SignalToAddress([PointerSized] ulong address, SignalType type, int value, int count) + public static Result SignalToAddress([PointerSized] ulong address, SignalType type, int value, int count) { if (IsPointingInsideKernel(address)) { @@ -3067,7 +3067,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x36)] - public Result SynchronizePreemptionState() + public static Result SynchronizePreemptionState() { KernelStatic.GetCurrentThread().SynchronizePreemptionState(); diff --git a/src/Ryujinx.HLE/HOS/Services/Fatal/IService.cs b/src/Ryujinx.HLE/HOS/Services/Fatal/IService.cs index 155077745..4ea7c8294 100644 --- a/src/Ryujinx.HLE/HOS/Services/Fatal/IService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Fatal/IService.cs @@ -139,7 +139,7 @@ namespace Ryujinx.HLE.HOS.Services.Fatal Logger.Info?.Print(LogClass.ServiceFatal, errorReport.ToString()); - context.Device.System.KernelContext.Syscall.Break((ulong)resultCode); + Kernel.SupervisorCall.Syscall.Break((ulong)resultCode); return ResultCode.Success; } diff --git a/src/Ryujinx.Horizon/Sdk/Audio/Detail/AudioDevice.cs b/src/Ryujinx.Horizon/Sdk/Audio/Detail/AudioDevice.cs index 583a04de3..ebe781566 100644 --- a/src/Ryujinx.Horizon/Sdk/Audio/Detail/AudioDevice.cs +++ b/src/Ryujinx.Horizon/Sdk/Audio/Detail/AudioDevice.cs @@ -234,7 +234,7 @@ namespace Ryujinx.Horizon.Sdk.Audio.Detail } [CmifCommand(15)] // 17.0.0+ - public Result AcquireAudioOutputDeviceNotification([CopyHandle] out int eventHandle, ulong deviceId) + public static Result AcquireAudioOutputDeviceNotification([CopyHandle] out int eventHandle, ulong deviceId) { eventHandle = 0; @@ -242,13 +242,13 @@ namespace Ryujinx.Horizon.Sdk.Audio.Detail } [CmifCommand(16)] // 17.0.0+ - public Result ReleaseAudioOutputDeviceNotification(ulong deviceId) + public static Result ReleaseAudioOutputDeviceNotification(ulong deviceId) { return AudioResult.NotImplemented; } [CmifCommand(17)] // 17.0.0+ - public Result AcquireAudioInputDeviceNotification([CopyHandle] out int eventHandle, ulong deviceId) + public static Result AcquireAudioInputDeviceNotification([CopyHandle] out int eventHandle, ulong deviceId) { eventHandle = 0; @@ -256,19 +256,19 @@ namespace Ryujinx.Horizon.Sdk.Audio.Detail } [CmifCommand(18)] // 17.0.0+ - public Result ReleaseAudioInputDeviceNotification(ulong deviceId) + public static Result ReleaseAudioInputDeviceNotification(ulong deviceId) { return AudioResult.NotImplemented; } [CmifCommand(19)] // 18.0.0+ - public Result SetAudioDeviceOutputVolumeAutoTuneEnabled(bool enabled) + public static Result SetAudioDeviceOutputVolumeAutoTuneEnabled(bool enabled) { return AudioResult.NotImplemented; } [CmifCommand(20)] // 18.0.0+ - public Result IsAudioDeviceOutputVolumeAutoTuneEnabled(out bool enabled) + public static Result IsAudioDeviceOutputVolumeAutoTuneEnabled(out bool enabled) { enabled = false;