diff --git a/.editorconfig b/.editorconfig index 1059bcdeb..d07171d67 100644 --- a/.editorconfig +++ b/.editorconfig @@ -262,6 +262,7 @@ dotnet_diagnostic.IDE0301.severity = none dotnet_diagnostic.IDE0302.severity = none dotnet_diagnostic.IDE0305.severity = none dotnet_diagnostic.CS9113.severity = none # CS9113: Parameter 'value' is unread +dotnet_diagnostic.IDE0079.severity = none # IDE0079: Remove unnecessary suppression dotnet_diagnostic.IDE0130.severity = none # IDE0130: Namespace does not match folder structure [src/Ryujinx/UI/ViewModels/**.cs] diff --git a/src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceDriver.cs b/src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceDriver.cs index d5381209e..7149dfaa7 100644 --- a/src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceDriver.cs +++ b/src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceDriver.cs @@ -25,7 +25,9 @@ namespace Ryujinx.Audio.Backends.SDL2 // TODO: Add this to SDL2-CS // NOTE: We use a DllImport here because of marshaling issue for spec. [DllImport("SDL2")] +#pragma warning disable SYSLIB1054 // Use 'LibraryImportAttribute' instead of 'DllImportAttribute' to generate P/Invoke marshalling code at compile time private static extern int SDL_GetDefaultAudioInfo(nint name, out SDL_AudioSpec spec, int isCapture); +#pragma warning restore SYSLIB1054 // Use 'LibraryImportAttribute' instead of 'DllImportAttribute' to generate P/Invoke marshalling code at compile time public SDL2HardwareDeviceDriver() { diff --git a/src/Ryujinx.Common/Configuration/AspectRatioExtensions.cs b/src/Ryujinx.Common/Configuration/AspectRatioExtensions.cs index f3a9e1646..bae6e35de 100644 --- a/src/Ryujinx.Common/Configuration/AspectRatioExtensions.cs +++ b/src/Ryujinx.Common/Configuration/AspectRatioExtensions.cs @@ -36,8 +36,6 @@ namespace Ryujinx.Common.Configuration }; } - - public static float ToFloatY(this AspectRatio aspectRatio) { return aspectRatio switch diff --git a/src/Ryujinx.Common/Configuration/DirtyHack.cs b/src/Ryujinx.Common/Configuration/DirtyHack.cs index ae3416a27..d0565c88a 100644 --- a/src/Ryujinx.Common/Configuration/DirtyHack.cs +++ b/src/Ryujinx.Common/Configuration/DirtyHack.cs @@ -18,8 +18,6 @@ namespace Ryujinx.Common.Configuration public DirtyHack Hack => hack; public int Value => value; - - public ulong Pack() => Raw.PackBitFields(PackedFormat); public static EnabledDirtyHack Unpack(ulong packedHack) diff --git a/src/Ryujinx.Common/ReleaseInformation.cs b/src/Ryujinx.Common/ReleaseInformation.cs index a5beb1009..a0c494c67 100644 --- a/src/Ryujinx.Common/ReleaseInformation.cs +++ b/src/Ryujinx.Common/ReleaseInformation.cs @@ -37,6 +37,4 @@ namespace Ryujinx.Common ? $"https://git.ryujinx.app/ryubing/ryujinx/-/compare/Canary-{currentVersion}...Canary-{newVersion}" : $"https://git.ryujinx.app/ryubing/ryujinx/-/releases/{newVersion}"; } - - } diff --git a/src/Ryujinx.Common/Utilities/Rainbow.cs b/src/Ryujinx.Common/Utilities/Rainbow.cs index 93129bf10..57177c76d 100644 --- a/src/Ryujinx.Common/Utilities/Rainbow.cs +++ b/src/Ryujinx.Common/Utilities/Rainbow.cs @@ -32,7 +32,6 @@ namespace Ryujinx.Common.Utilities CyclingEnabled = false; } - public static float Speed { get; set; } = 1; private static readonly Lock _lock = new(); diff --git a/src/Ryujinx.Cpu/TickSource.cs b/src/Ryujinx.Cpu/TickSource.cs index 3aa616a8d..c50fedf61 100644 --- a/src/Ryujinx.Cpu/TickSource.cs +++ b/src/Ryujinx.Cpu/TickSource.cs @@ -15,7 +15,6 @@ namespace Ryujinx.Cpu /// public ulong Counter => (ulong)(ElapsedSeconds * Frequency); - public long TickScalar { get; set; } private static long _acumElapsedTicks; diff --git a/src/Ryujinx.Graphics.Gpu/GpuContext.cs b/src/Ryujinx.Graphics.Gpu/GpuContext.cs index d0b8277da..979ae226a 100644 --- a/src/Ryujinx.Graphics.Gpu/GpuContext.cs +++ b/src/Ryujinx.Graphics.Gpu/GpuContext.cs @@ -98,7 +98,6 @@ namespace Ryujinx.Graphics.Gpu /// internal DirtyHacks DirtyHacks { get; } - /// /// Host hardware capabilities. /// diff --git a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs index fb244d307..7f2ddfca5 100644 --- a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs +++ b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs @@ -701,7 +701,9 @@ namespace Ryujinx.Graphics.Vulkan _vertexBufferUpdater.Commit(Cbs); } +#pragma warning disable CA1822 // Mark members as static public void SetAlphaTest(bool enable, float reference, CompareOp op) +#pragma warning restore CA1822 // Mark members as static { // This is currently handled using shader specialization, as Vulkan does not support alpha test. // In the future, we may want to use this to write the reference value into the support buffer, @@ -902,12 +904,16 @@ namespace Ryujinx.Graphics.Vulkan // TODO: Default levels (likely needs emulation on shaders?) } +#pragma warning disable CA1822 // Mark members as static public void SetPointParameters(float size, bool isProgramPointSize, bool enablePointSprite, Origin origin) +#pragma warning restore CA1822 // Mark members as static { // TODO. } +#pragma warning disable CA1822 // Mark members as static public void SetPolygonMode(PolygonMode frontMode, PolygonMode backMode) +#pragma warning restore CA1822 // Mark members as static { // TODO. } @@ -1157,7 +1163,9 @@ namespace Ryujinx.Graphics.Vulkan _descriptorSetUpdater.SetUniformBuffers(CommandBuffer, buffers); } +#pragma warning disable CA1822 // Mark members as static public void SetUserClipDistance(int index, bool enableClip) +#pragma warning restore CA1822 // Mark members as static { // TODO. } 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 c3ed92ed0..667c36040 100644 --- a/src/Ryujinx.HLE/HOS/Services/Fatal/IService.cs +++ b/src/Ryujinx.HLE/HOS/Services/Fatal/IService.cs @@ -147,7 +147,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.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboBinReader.cs b/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboBinReader.cs index 0e11493d5..06e283f6b 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboBinReader.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nfc/AmiiboDecryption/AmiiboBinReader.cs @@ -339,7 +339,6 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.AmiiboDecryption public static bool HasAmiiboKeyFile => File.Exists(GetKeyRetailBinPath()); - public static DateTime DateTimeFromTag(ushort dateTimeTag) { try diff --git a/src/Ryujinx.HLE/StructHelpers.cs b/src/Ryujinx.HLE/StructHelpers.cs index dc9c6d727..ee299896d 100644 --- a/src/Ryujinx.HLE/StructHelpers.cs +++ b/src/Ryujinx.HLE/StructHelpers.cs @@ -17,7 +17,6 @@ namespace Ryujinx.HLE const int SizeOfApplicationTitle = 0x300; const int OffsetOfApplicationPublisherStrings = 0x200; - BlitStruct nacpData = new(1); // name and publisher buffer diff --git a/src/Ryujinx.HLE/UI/IHostUIHandler.cs b/src/Ryujinx.HLE/UI/IHostUIHandler.cs index b5c5cb168..68140dd54 100644 --- a/src/Ryujinx.HLE/UI/IHostUIHandler.cs +++ b/src/Ryujinx.HLE/UI/IHostUIHandler.cs @@ -63,7 +63,6 @@ namespace Ryujinx.HLE.UI /// IHostUITheme HostUITheme { get; } - /// /// Displays the player select dialog and returns the selected profile. /// diff --git a/src/Ryujinx.Horizon.Kernel.Generators/SyscallGenerator.cs b/src/Ryujinx.Horizon.Kernel.Generators/SyscallGenerator.cs index 2a09001db..c2cfec255 100644 --- a/src/Ryujinx.Horizon.Kernel.Generators/SyscallGenerator.cs +++ b/src/Ryujinx.Horizon.Kernel.Generators/SyscallGenerator.cs @@ -146,11 +146,15 @@ namespace Ryujinx.Horizon.Kernel.Generators generator.AppendLine(); List syscalls = []; + Dictionary isStaticMethod = new(); foreach (MethodDeclarationSyntax method in syntaxReceiver.SvcImplementations) { - GenerateMethod32(generator, context.Compilation, method); - GenerateMethod64(generator, context.Compilation, method); + bool isStatic = method.Modifiers.Any(SyntaxKind.StaticKeyword); + isStaticMethod[method.Identifier.Text] = isStatic; + + GenerateMethod32(generator, context.Compilation, method, isStatic); + GenerateMethod64(generator, context.Compilation, method, isStatic); foreach (AttributeSyntax attribute in method.AttributeLists.SelectMany(attributeList => attributeList.Attributes.Where(attribute => @@ -166,9 +170,9 @@ namespace Ryujinx.Horizon.Kernel.Generators syscalls.Sort(); - GenerateDispatch(generator, syscalls, A32Suffix); + GenerateDispatch(generator, syscalls, A32Suffix, isStaticMethod); generator.AppendLine(); - GenerateDispatch(generator, syscalls, A64Suffix); + GenerateDispatch(generator, syscalls, A64Suffix, isStaticMethod); generator.LeaveScope(); generator.LeaveScope(); @@ -193,9 +197,13 @@ namespace Ryujinx.Horizon.Kernel.Generators generator.LeaveScope(); } - private static void GenerateMethod32(CodeGenerator generator, Compilation compilation, MethodDeclarationSyntax method) + private static void GenerateMethod32(CodeGenerator generator, Compilation compilation, MethodDeclarationSyntax method, bool isStatic) { - generator.EnterScope($"private static void {method.Identifier.Text}{A32Suffix}(Syscall syscall, {TypeExecutionContext} context)"); + string methodParams = isStatic + ? $"{TypeExecutionContext} context" + : $"Syscall syscall, {TypeExecutionContext} context"; + + generator.EnterScope($"private static void {method.Identifier.Text}{A32Suffix}({methodParams})"); string[] args = new string[method.ParameterList.Parameters.Count]; int index = 0; @@ -266,9 +274,12 @@ namespace Ryujinx.Horizon.Kernel.Generators string result = null; string canonicalReturnTypeName = null; + string callPrefix = isStatic + ? $"{(method.Parent is ClassDeclarationSyntax cls ? cls.Identifier.Text + "." : "")}{method.Identifier.Text}" + : $"syscall.{method.Identifier.Text}"; if (method.ReturnType.ToString() != "void") { - generator.AppendLine($"var {ResultVariableName} = syscall.{method.Identifier.Text}({argsList});"); + generator.AppendLine($"var {ResultVariableName} = {callPrefix}({argsList});"); canonicalReturnTypeName = GetCanonicalTypeName(compilation, method.ReturnType); if (canonicalReturnTypeName == TypeResult) @@ -289,7 +300,7 @@ namespace Ryujinx.Horizon.Kernel.Generators } else { - generator.AppendLine($"syscall.{method.Identifier.Text}({argsList});"); + generator.AppendLine($"{callPrefix}({argsList});"); } foreach (OutParameter outParameter in outParameters) @@ -313,9 +324,12 @@ namespace Ryujinx.Horizon.Kernel.Generators generator.AppendLine(); } - private static void GenerateMethod64(CodeGenerator generator, Compilation compilation, MethodDeclarationSyntax method) + private static void GenerateMethod64(CodeGenerator generator, Compilation compilation, MethodDeclarationSyntax method, bool isStatic) { - generator.EnterScope($"private static void {method.Identifier.Text}{A64Suffix}(Syscall syscall, {TypeExecutionContext} context)"); + string methodParams = isStatic + ? $"{TypeExecutionContext} context" + : $"Syscall syscall, {TypeExecutionContext} context"; + generator.EnterScope($"private static void {method.Identifier.Text}{A64Suffix}({methodParams})"); string[] args = new string[method.ParameterList.Parameters.Count]; int registerIndex = 0; @@ -356,9 +370,12 @@ namespace Ryujinx.Horizon.Kernel.Generators string result = null; string canonicalReturnTypeName = null; + string callPrefix = isStatic + ? $"{(method.Parent is ClassDeclarationSyntax cls ? cls.Identifier.Text + "." : "")}{method.Identifier.Text}" + : $"syscall.{method.Identifier.Text}"; if (method.ReturnType.ToString() != "void") { - generator.AppendLine($"var {ResultVariableName} = syscall.{method.Identifier.Text}({argsList});"); + generator.AppendLine($"var {ResultVariableName} = {callPrefix}({argsList});"); canonicalReturnTypeName = GetCanonicalTypeName(compilation, method.ReturnType); if (canonicalReturnTypeName == TypeResult) @@ -374,7 +391,7 @@ namespace Ryujinx.Horizon.Kernel.Generators } else { - generator.AppendLine($"syscall.{method.Identifier.Text}({argsList});"); + generator.AppendLine($"{callPrefix}({argsList});"); } foreach (OutParameter outParameter in outParameters) @@ -463,7 +480,7 @@ namespace Ryujinx.Horizon.Kernel.Generators generator.AppendLine($"Logger.{logLevel}?.PrintMsg(LogClass.{logClass}, $\"{log}\");"); } - private static void GenerateDispatch(CodeGenerator generator, List syscalls, string suffix) + private static void GenerateDispatch(CodeGenerator generator, List syscalls, string suffix, Dictionary isStaticMethod) { generator.EnterScope($"public static void Dispatch{suffix}(Syscall syscall, {TypeExecutionContext} context, int id)"); generator.EnterScope("switch (id)"); @@ -473,7 +490,15 @@ namespace Ryujinx.Horizon.Kernel.Generators generator.AppendLine($"case {syscall.Id}:"); generator.IncreaseIndentation(); - generator.AppendLine($"{syscall.Name}{suffix}(syscall, context);"); + if (isStaticMethod.TryGetValue(syscall.Name, out bool isStatic) && isStatic) + { + generator.AppendLine($"{syscall.Name}{suffix}(context);"); + } + else + { + generator.AppendLine($"{syscall.Name}{suffix}(syscall, context);"); + } + generator.AppendLine("break;"); generator.DecreaseIndentation(); 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; diff --git a/src/Ryujinx/Program.cs b/src/Ryujinx/Program.cs index db9ae21eb..a75bcbca3 100644 --- a/src/Ryujinx/Program.cs +++ b/src/Ryujinx/Program.cs @@ -119,7 +119,6 @@ namespace Ryujinx.Ava => ProcessUnhandledException(sender, e.Exception, false); AppDomain.CurrentDomain.ProcessExit += (_, _) => Exit(); - // Setup base data directory. AppDataManager.Initialize(CommandLineState.BaseDirPathArg); @@ -160,7 +159,6 @@ namespace Ryujinx.Ava } } - public static string GetDirGameUserConfig(string gameId, bool changeFolderForGame = false) { if (string.IsNullOrEmpty(gameId)) @@ -221,10 +219,7 @@ namespace Ryujinx.Ava } // When you first load the program, copy to remember the path for the global configuration - if (GlobalConfigurationPath == null) - { - GlobalConfigurationPath = ConfigurationPath; - } + GlobalConfigurationPath ??= ConfigurationPath; UseHardwareAcceleration = ConfigurationState.Instance.EnableHardwareAcceleration; @@ -349,7 +344,6 @@ namespace Ryujinx.Ava log.PrintMsg(LogClass.Application, message); } - if (isTerminating) Exit(); } diff --git a/src/Ryujinx/Systems/AppLibrary/ApplicationData.cs b/src/Ryujinx/Systems/AppLibrary/ApplicationData.cs index 5656d6e73..0b4909783 100644 --- a/src/Ryujinx/Systems/AppLibrary/ApplicationData.cs +++ b/src/Ryujinx/Systems/AppLibrary/ApplicationData.cs @@ -98,7 +98,6 @@ namespace Ryujinx.Ava.Systems.AppLibrary }] ).OrElse(string.Empty); - [JsonIgnore] public string IdString => Id.ToString("x16"); [JsonIgnore] public ulong IdBase => Id & ~0x1FFFUL; diff --git a/src/Ryujinx/Systems/AppLibrary/LdnGameDataReceivedEventArgs.cs b/src/Ryujinx/Systems/AppLibrary/LdnGameDataReceivedEventArgs.cs index 8b207c6bd..38d42b5d4 100644 --- a/src/Ryujinx/Systems/AppLibrary/LdnGameDataReceivedEventArgs.cs +++ b/src/Ryujinx/Systems/AppLibrary/LdnGameDataReceivedEventArgs.cs @@ -11,7 +11,6 @@ namespace Ryujinx.Ava.Systems.AppLibrary LdnData = ldnData ?? []; } - public LdnGameData[] LdnData { get; set; } } } diff --git a/src/Ryujinx/Systems/Configuration/ConfigurationState.Migration.cs b/src/Ryujinx/Systems/Configuration/ConfigurationState.Migration.cs index 57619aa70..98b377ecd 100644 --- a/src/Ryujinx/Systems/Configuration/ConfigurationState.Migration.cs +++ b/src/Ryujinx/Systems/Configuration/ConfigurationState.Migration.cs @@ -44,7 +44,6 @@ namespace Ryujinx.Ava.Systems.Configuration configurationFileUpdated = true; } - EnableDiscordIntegration.Value = cff.EnableDiscordIntegration; UpdateCheckerType.Value = shouldLoadFromFile ? cff.UpdateCheckerType : UpdateCheckerType.Value; // Get from global config only FocusLostActionType.Value = cff.FocusLostActionType; diff --git a/src/Ryujinx/Systems/Configuration/ConfigurationState.Model.cs b/src/Ryujinx/Systems/Configuration/ConfigurationState.Model.cs index bc8fdb40a..44680c200 100644 --- a/src/Ryujinx/Systems/Configuration/ConfigurationState.Model.cs +++ b/src/Ryujinx/Systems/Configuration/ConfigurationState.Model.cs @@ -326,7 +326,6 @@ namespace Ryujinx.Ava.Systems.Configuration /// public ReactiveObject MatchSystemTime { get; private set; } - /// /// Enable or disable use global input config (Independent from controllers binding) /// diff --git a/src/Ryujinx/Systems/Updater/Updater.GitLab.cs b/src/Ryujinx/Systems/Updater/Updater.GitLab.cs index 3411daa5d..787c3c4b3 100644 --- a/src/Ryujinx/Systems/Updater/Updater.GitLab.cs +++ b/src/Ryujinx/Systems/Updater/Updater.GitLab.cs @@ -1,4 +1,4 @@ -using Gommon; +using Gommon; using Ryujinx.Ava.Common.Locale; using Ryujinx.Ava.UI.Helpers; using Ryujinx.Common; @@ -86,7 +86,6 @@ namespace Ryujinx.Ava.Systems return default; } - if (!Version.TryParse(_versionResponse.Version, out Version newVersion)) { Logger.Error?.Print(LogClass.Application, diff --git a/src/Ryujinx/UI/Applet/AvaloniaHostUITheme.cs b/src/Ryujinx/UI/Applet/AvaloniaHostUITheme.cs index 3ab2fdc70..a926cf72e 100644 --- a/src/Ryujinx/UI/Applet/AvaloniaHostUITheme.cs +++ b/src/Ryujinx/UI/Applet/AvaloniaHostUITheme.cs @@ -55,7 +55,7 @@ namespace Ryujinx.Ava.UI.Applet return culture.TwoLetterISOLanguageName switch { - "zh" => langCode == "zh-CN" || langCode == "zh-Hans" || langCode == "zh-SG" + "zh" => langCode is "zh-CN" or "zh-Hans" or "zh-SG" ? "Microsoft YaHei UI" // Simplified Chinese : "Microsoft JhengHei UI", // Traditional Chinese @@ -100,6 +100,7 @@ namespace Ryujinx.Ava.UI.Applet (float)solidColor.Color.B / 255 ); } + return new ThemeColor(); } } diff --git a/src/Ryujinx/UI/Renderer/RendererHost.cs b/src/Ryujinx/UI/Renderer/RendererHost.cs index 9d24fbbad..7df02629e 100644 --- a/src/Ryujinx/UI/Renderer/RendererHost.cs +++ b/src/Ryujinx/UI/Renderer/RendererHost.cs @@ -37,7 +37,6 @@ namespace Ryujinx.Ava.UI.Renderer _ => throw new NotImplementedException() }; - private void Initialize() { EmbeddedWindow.WindowCreated += CurrentWindow_WindowCreated; diff --git a/src/Ryujinx/UI/ViewModels/CompatibilityViewModel.cs b/src/Ryujinx/UI/ViewModels/CompatibilityViewModel.cs index 8a5ae441b..c711bd1c6 100644 --- a/src/Ryujinx/UI/ViewModels/CompatibilityViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/CompatibilityViewModel.cs @@ -30,12 +30,11 @@ namespace Ryujinx.Ava.UI.ViewModels public string BootsInfoText { get; set; } public string NothingInfoText { get; set; } - private IEnumerable _currentEntries = CompatibilityDatabase.Entries; private string[] _ownedGameTitleIds = []; - private Func _sortKeySelector = x => x.GameName; // Default sort by GameName + private readonly Func _sortKeySelector = x => x.GameName; // Default sort by GameName public IEnumerable CurrentEntries => OnlyShowOwnedGames ? _currentEntries.Where(x => @@ -87,7 +86,6 @@ namespace Ryujinx.Ava.UI.ViewModels } } - public void NameSorting(int nameSort = 0) { _sorting.Name = nameSort; @@ -162,6 +160,5 @@ namespace Ryujinx.Ava.UI.ViewModels }; } } - } } diff --git a/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs b/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs index 81aae6b74..66a2e1349 100644 --- a/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs @@ -327,8 +327,6 @@ namespace Ryujinx.Ava.UI.ViewModels.Input PlayerIndexes.Add(new(PlayerIndex.Handheld, LocaleManager.Instance[LocaleKeys.ControllerSettingsHandheld])); } - - private void LoadConfiguration(InputConfig inputConfig = null) { if (UseGlobalConfig && Program.UseExtraConfig) diff --git a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs index 54fd951fb..c5f72ea86 100644 --- a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs @@ -90,7 +90,6 @@ namespace Ryujinx.Ava.UI.ViewModels public bool IsGameTitleNotNull => !string.IsNullOrEmpty(GameTitle); public double PanelOpacity => IsGameTitleNotNull ? 0.5 : 1; - public int ResolutionScale { get => _resolutionScale; @@ -230,7 +229,6 @@ namespace Ryujinx.Ava.UI.ViewModels public bool EnablePptc { get; set; } public bool EnableLowPowerPptc { get; set; } - public long TurboMultiplier { get => _turboModeMultiplier; diff --git a/src/Ryujinx/UI/Windows/CompatibilityListWindow.axaml.cs b/src/Ryujinx/UI/Windows/CompatibilityListWindow.axaml.cs index 283efd083..3241b0eec 100644 --- a/src/Ryujinx/UI/Windows/CompatibilityListWindow.axaml.cs +++ b/src/Ryujinx/UI/Windows/CompatibilityListWindow.axaml.cs @@ -65,6 +65,5 @@ namespace Ryujinx.Ava.UI.Windows cvm.StatusSorting(int.Parse(sortStrategy)); } } - } }