diff --git a/.editorconfig b/.editorconfig index 86d392608..e8525c28b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -236,28 +236,14 @@ dotnet_naming_style.IPascalCase.required_suffix = dotnet_naming_style.IPascalCase.word_separator = dotnet_naming_style.IPascalCase.capitalization = pascal_case -# TODO: -# .NET 8 migration (new warnings are caused by the NET 8 C# compiler and analyzer) -# The following info messages might need to be fixed in the source code instead of hiding the actual message -# Without the following lines, dotnet format would fail # Disable "Use collection initializers or expressions" dotnet_diagnostic.IDE0028.severity = none # Disable "Use collection expression for stackalloc" dotnet_diagnostic.IDE0302.severity = none # Disable "Use collection expression for fluent" dotnet_diagnostic.IDE0305.severity = none -# Disable "'new' expression can be simplified" -dotnet_diagnostic.IDE0090.severity = none # Disable "Use primary constructor" dotnet_diagnostic.IDE0290.severity = none -# Disable "Member '' does not access instance data and can be marked as static" -dotnet_diagnostic.CA1822.severity = none -# Disable "Change type of field '' from '' to '' for improved performance" -dotnet_diagnostic.CA1859.severity = none -# Disable "Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array" -dotnet_diagnostic.CA1861.severity = none -# Disable "Prefer using 'string.Equals(string, StringComparison)' to perform a case-insensitive comparison, but keep in mind that this might cause subtle changes in behavior, so make sure to conduct thorough testing after applying the suggestion, or if culturally sensitive comparison is not required, consider using 'StringComparison.OrdinalIgnoreCase'" -dotnet_diagnostic.CA1862.severity = none [src/Ryujinx/UI/ViewModels/**.cs] # Disable "mark members as static" rule for ViewModels diff --git a/src/ARMeilleure/CodeGen/RegisterAllocators/LinearScanAllocator.cs b/src/ARMeilleure/CodeGen/RegisterAllocators/LinearScanAllocator.cs index 78f1f75cb..0fcb7834f 100644 --- a/src/ARMeilleure/CodeGen/RegisterAllocators/LinearScanAllocator.cs +++ b/src/ARMeilleure/CodeGen/RegisterAllocators/LinearScanAllocator.cs @@ -839,7 +839,7 @@ namespace ARMeilleure.CodeGen.RegisterAllocators { dest.NumberLocal(_intervals.Count); - LiveInterval interval = new LiveInterval(dest); + LiveInterval interval = new(dest); _intervals.Add(interval); SetVisited(dest); diff --git a/src/ARMeilleure/Translation/IntervalTree.cs b/src/ARMeilleure/Translation/IntervalTree.cs index 2fa431a8b..92f18ccf6 100644 --- a/src/ARMeilleure/Translation/IntervalTree.cs +++ b/src/ARMeilleure/Translation/IntervalTree.cs @@ -124,7 +124,7 @@ namespace ARMeilleure.Translation /// /// The node to search for values within /// The list to add values to - private void AddToList(IntervalTreeNode node, List list) + private static void AddToList(IntervalTreeNode node, List list) { if (node == null) { @@ -175,7 +175,7 @@ namespace ARMeilleure.Translation /// End of the range /// Overlaps array to place results in /// Overlaps count to update - private void GetKeys(IntervalTreeNode node, TK start, TK end, ref TK[] overlaps, ref int overlapCount) + private static void GetKeys(IntervalTreeNode node, TK start, TK end, ref TK[] overlaps, ref int overlapCount) { if (node == null || start.CompareTo(node.Max) >= 0) { diff --git a/src/ARMeilleure/Translation/RegisterUsage.cs b/src/ARMeilleure/Translation/RegisterUsage.cs index 472b0f67b..03d4a96e7 100644 --- a/src/ARMeilleure/Translation/RegisterUsage.cs +++ b/src/ARMeilleure/Translation/RegisterUsage.cs @@ -95,7 +95,7 @@ namespace ARMeilleure.Translation // This is required because we have a implicit context load at the start of the function, // but if there is a jump to the start of the function, the context load would trash the modified values. // Here we insert a new entry block that will jump to the existing entry block. - BasicBlock newEntry = new BasicBlock(cfg.Blocks.Count); + BasicBlock newEntry = new(cfg.Blocks.Count); cfg.UpdateEntry(newEntry); } diff --git a/src/Ryujinx.Audio/Renderer/Server/AudioRenderSystem.cs b/src/Ryujinx.Audio/Renderer/Server/AudioRenderSystem.cs index 246889c48..1324f2313 100644 --- a/src/Ryujinx.Audio/Renderer/Server/AudioRenderSystem.cs +++ b/src/Ryujinx.Audio/Renderer/Server/AudioRenderSystem.cs @@ -436,7 +436,7 @@ namespace Ryujinx.Audio.Renderer.Server return result; } - PoolMapper poolMapper = new PoolMapper(_processHandle, _memoryPools, _behaviourContext.IsMemoryPoolForceMappingEnabled()); + PoolMapper poolMapper = new(_processHandle, _memoryPools, _behaviourContext.IsMemoryPoolForceMappingEnabled()); result = stateUpdater.UpdateVoices(_voiceContext, poolMapper); diff --git a/src/Ryujinx.Common/Collections/IntervalTree.cs b/src/Ryujinx.Common/Collections/IntervalTree.cs index 695487dda..e200fa6f3 100644 --- a/src/Ryujinx.Common/Collections/IntervalTree.cs +++ b/src/Ryujinx.Common/Collections/IntervalTree.cs @@ -122,7 +122,7 @@ namespace Ryujinx.Common.Collections /// /// The node to search for RangeNodes within /// The list to add RangeNodes to - private void AddToList(IntervalTreeNode node, List> list) + private static void AddToList(IntervalTreeNode node, List> list) { if (node == null) { @@ -173,7 +173,7 @@ namespace Ryujinx.Common.Collections /// End of the range /// Overlaps array to place results in /// Overlaps count to update - private void GetValues(IntervalTreeNode node, TKey start, TKey end, ref TValue[] overlaps, ref int overlapCount) + private static void GetValues(IntervalTreeNode node, TKey start, TKey end, ref TValue[] overlaps, ref int overlapCount) { if (node == null || start.CompareTo(node.Max) >= 0) { diff --git a/src/Ryujinx.Common/Collections/TreeDictionary.cs b/src/Ryujinx.Common/Collections/TreeDictionary.cs index 6d52fc9a7..f1421bf82 100644 --- a/src/Ryujinx.Common/Collections/TreeDictionary.cs +++ b/src/Ryujinx.Common/Collections/TreeDictionary.cs @@ -184,7 +184,7 @@ namespace Ryujinx.Common.Collections /// /// The node to search for nodes within /// The list to add node to - private void AddToList(Node node, List> list) + private static void AddToList(Node node, List> list) { if (node == null) { diff --git a/src/Ryujinx.Common/Extensions/SequenceReaderExtensions.cs b/src/Ryujinx.Common/Extensions/SequenceReaderExtensions.cs index 79b5d743b..98fe38060 100644 --- a/src/Ryujinx.Common/Extensions/SequenceReaderExtensions.cs +++ b/src/Ryujinx.Common/Extensions/SequenceReaderExtensions.cs @@ -163,7 +163,7 @@ namespace Ryujinx.Common.Extensions // Not enough data in the current segment, try to peek for the data we need. T buffer = default; - Span tempSpan = new Span(&buffer, sizeof(T)); + Span tempSpan = new(&buffer, sizeof(T)); if (!reader.TryCopyTo(tempSpan)) { diff --git a/src/Ryujinx.Cpu/LightningJit/CodeGen/Arm64/Assembler.cs b/src/Ryujinx.Cpu/LightningJit/CodeGen/Arm64/Assembler.cs index 53f15697d..abb6e7c34 100644 --- a/src/Ryujinx.Cpu/LightningJit/CodeGen/Arm64/Assembler.cs +++ b/src/Ryujinx.Cpu/LightningJit/CodeGen/Arm64/Assembler.cs @@ -857,7 +857,7 @@ namespace Ryujinx.Cpu.LightningJit.CodeGen.Arm64 public readonly void PrfmI(Operand rn, int imm, uint type, uint target, uint policy) { - Operand rt = new Operand((int)EncodeTypeTargetPolicy(type, target, policy), RegisterType.Integer, OperandType.I32); + Operand rt = new((int)EncodeTypeTargetPolicy(type, target, policy), RegisterType.Integer, OperandType.I32); WriteInstruction(0xf9800000u | (EncodeUImm12(imm, 3) << 10), rt, rn); } @@ -868,7 +868,7 @@ namespace Ryujinx.Cpu.LightningJit.CodeGen.Arm64 public readonly void Prfum(Operand rn, int imm, uint type, uint target, uint policy) { - Operand rt = new Operand((int)EncodeTypeTargetPolicy(type, target, policy), RegisterType.Integer, OperandType.I32); + Operand rt = new((int)EncodeTypeTargetPolicy(type, target, policy), RegisterType.Integer, OperandType.I32); WriteInstruction(0xf8800000u | (EncodeSImm9(imm) << 12), rt, rn); } diff --git a/src/Ryujinx.Graphics.Gpu/Image/TextureBindingsArrayCache.cs b/src/Ryujinx.Graphics.Gpu/Image/TextureBindingsArrayCache.cs index f1b2c4bb2..055896994 100644 --- a/src/Ryujinx.Graphics.Gpu/Image/TextureBindingsArrayCache.cs +++ b/src/Ryujinx.Graphics.Gpu/Image/TextureBindingsArrayCache.cs @@ -1013,7 +1013,7 @@ namespace Ryujinx.Graphics.Gpu.Image bool isImage, out bool isNew) { - CacheEntryFromPoolKey key = new CacheEntryFromPoolKey(isImage, bindingInfo, texturePool, samplerPool); + CacheEntryFromPoolKey key = new(isImage, bindingInfo, texturePool, samplerPool); isNew = !_cacheFromPool.TryGetValue(key, out CacheEntry entry); @@ -1056,7 +1056,7 @@ namespace Ryujinx.Graphics.Gpu.Image ref BufferBounds textureBufferBounds, out bool isNew) { - CacheEntryFromBufferKey key = new CacheEntryFromBufferKey( + CacheEntryFromBufferKey key = new( isImage, bindingInfo, texturePool, diff --git a/src/Ryujinx.Graphics.Gpu/Memory/BufferCache.cs b/src/Ryujinx.Graphics.Gpu/Memory/BufferCache.cs index 66b5b5293..834ce4ecd 100644 --- a/src/Ryujinx.Graphics.Gpu/Memory/BufferCache.cs +++ b/src/Ryujinx.Graphics.Gpu/Memory/BufferCache.cs @@ -663,7 +663,7 @@ namespace Ryujinx.Graphics.Gpu.Memory /// Total of overlaps private void CreateBufferAligned(ulong address, ulong size, BufferStage stage, bool sparseCompatible, Buffer[] overlaps, int overlapsCount) { - Buffer newBuffer = new Buffer(_context, _physicalMemory, address, size, stage, sparseCompatible, overlaps.Take(overlapsCount)); + Buffer newBuffer = new(_context, _physicalMemory, address, size, stage, sparseCompatible, overlaps.Take(overlapsCount)); lock (_buffers) { diff --git a/src/Ryujinx.Graphics.Gpu/Memory/BufferModifiedRangeList.cs b/src/Ryujinx.Graphics.Gpu/Memory/BufferModifiedRangeList.cs index a077eec6a..7b60e2e1d 100644 --- a/src/Ryujinx.Graphics.Gpu/Memory/BufferModifiedRangeList.cs +++ b/src/Ryujinx.Graphics.Gpu/Memory/BufferModifiedRangeList.cs @@ -430,7 +430,7 @@ namespace Ryujinx.Graphics.Gpu.Memory BufferMigration oldMigration = ranges._source; - BufferMigrationSpan span = new BufferMigrationSpan(ranges._parent, ranges._flushAction, oldMigration); + BufferMigrationSpan span = new(ranges._parent, ranges._flushAction, oldMigration); ranges._parent.IncrementReferenceCount(); if (_source == null) diff --git a/src/Ryujinx.Graphics.Vulkan/BarrierBatch.cs b/src/Ryujinx.Graphics.Vulkan/BarrierBatch.cs index 3f8ca3401..dff8edab5 100644 --- a/src/Ryujinx.Graphics.Vulkan/BarrierBatch.cs +++ b/src/Ryujinx.Graphics.Vulkan/BarrierBatch.cs @@ -154,7 +154,7 @@ namespace Ryujinx.Graphics.Vulkan stages |= PipelineStageFlags.DrawIndirectBit; } - MemoryBarrier barrier = new MemoryBarrier() + MemoryBarrier barrier = new() { SType = StructureType.MemoryBarrier, SrcAccessMask = access, diff --git a/src/Ryujinx.Graphics.Vulkan/BufferManager.cs b/src/Ryujinx.Graphics.Vulkan/BufferManager.cs index 1b6ac9988..e79ba4d05 100644 --- a/src/Ryujinx.Graphics.Vulkan/BufferManager.cs +++ b/src/Ryujinx.Graphics.Vulkan/BufferManager.cs @@ -207,14 +207,14 @@ namespace Ryujinx.Graphics.Vulkan fixed (SparseMemoryBind* pMemoryBinds = memoryBinds) { - SparseBufferMemoryBindInfo bufferBind = new SparseBufferMemoryBindInfo() + SparseBufferMemoryBindInfo bufferBind = new() { Buffer = buffer, BindCount = (uint)memoryBinds.Length, PBinds = pMemoryBinds }; - BindSparseInfo bindSparseInfo = new BindSparseInfo() + BindSparseInfo bindSparseInfo = new() { SType = StructureType.BindSparseInfo, BufferBindCount = 1, diff --git a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs index 1631d24d7..619ddec53 100644 --- a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs +++ b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs @@ -694,7 +694,7 @@ namespace Ryujinx.Graphics.Vulkan _vertexBufferUpdater.Commit(Cbs); } - public void SetAlphaTest(bool enable, float reference, CompareOp op) + public static void SetAlphaTest(bool enable, float reference, CompareOp op) { // 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, @@ -891,12 +891,12 @@ namespace Ryujinx.Graphics.Vulkan // TODO: Default levels (likely needs emulation on shaders?) } - public void SetPointParameters(float size, bool isProgramPointSize, bool enablePointSprite, Origin origin) + public static void SetPointParameters(float size, bool isProgramPointSize, bool enablePointSprite, Origin origin) { // TODO. } - public void SetPolygonMode(PolygonMode frontMode, PolygonMode backMode) + public static void SetPolygonMode(PolygonMode frontMode, PolygonMode backMode) { // TODO. } @@ -1142,7 +1142,7 @@ namespace Ryujinx.Graphics.Vulkan _descriptorSetUpdater.SetUniformBuffers(CommandBuffer, buffers); } - public void SetUserClipDistance(int index, bool enableClip) + public static void SetUserClipDistance(int index, bool enableClip) { // TODO. } diff --git a/src/Ryujinx.Graphics.Vulkan/ShaderCollection.cs b/src/Ryujinx.Graphics.Vulkan/ShaderCollection.cs index 54be5eadd..e9bf9efae 100644 --- a/src/Ryujinx.Graphics.Vulkan/ShaderCollection.cs +++ b/src/Ryujinx.Graphics.Vulkan/ShaderCollection.cs @@ -381,7 +381,7 @@ namespace Ryujinx.Graphics.Vulkan return templates; } - private PipelineStageFlags GetPipelineStages(ResourceStages stages) + private static PipelineStageFlags GetPipelineStages(ResourceStages stages) { PipelineStageFlags result = 0; @@ -418,7 +418,7 @@ namespace Ryujinx.Graphics.Vulkan return result; } - private (PipelineStageFlags Buffer, PipelineStageFlags Texture) BuildIncoherentStages(ReadOnlyCollection setUsages) + private static (PipelineStageFlags Buffer, PipelineStageFlags Texture) BuildIncoherentStages(ReadOnlyCollection setUsages) { PipelineStageFlags buffer = PipelineStageFlags.None; PipelineStageFlags texture = PipelineStageFlags.None; diff --git a/src/Ryujinx.Graphics.Vulkan/VulkanRenderer.cs b/src/Ryujinx.Graphics.Vulkan/VulkanRenderer.cs index 2a3fbe28f..1f26f3229 100644 --- a/src/Ryujinx.Graphics.Vulkan/VulkanRenderer.cs +++ b/src/Ryujinx.Graphics.Vulkan/VulkanRenderer.cs @@ -202,7 +202,7 @@ namespace Ryujinx.Graphics.Vulkan bool supportsPushDescriptors = _physicalDevice.IsDeviceExtensionPresent(KhrPushDescriptor.ExtensionName); - PhysicalDevicePushDescriptorPropertiesKHR propertiesPushDescriptor = new PhysicalDevicePushDescriptorPropertiesKHR() + PhysicalDevicePushDescriptorPropertiesKHR propertiesPushDescriptor = new() { SType = StructureType.PhysicalDevicePushDescriptorPropertiesKhr }; diff --git a/src/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs b/src/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs index 82d11fd91..5fd350ca9 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs @@ -509,7 +509,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process return result; } - private void GenerateRandomEntropy() + private static void GenerateRandomEntropy() { // TODO. } diff --git a/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs b/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs index e5a29d43d..42913bad5 100644 --- a/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs +++ b/src/Ryujinx.HLE/HOS/Kernel/SupervisorCall/Syscall.cs @@ -150,7 +150,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall return handleTable.GenerateHandle(process, out handle); } - public Result StartProcess(int handle, int priority, int cpuCore, ulong mainThreadStackSize) + public static Result StartProcess(int handle, int priority, int cpuCore, ulong mainThreadStackSize) { KProcess process = KernelStatic.GetCurrentProcess().HandleTable.GetObject(handle); @@ -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); @@ -1071,7 +1071,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall return result; } - public Result QueryMemory(out MemoryInfo info, out ulong pageInfo, ulong address) + public static Result QueryMemory(out MemoryInfo info, out ulong pageInfo, ulong address) { KProcess process = KernelStatic.GetCurrentProcess(); @@ -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(); @@ -2366,7 +2366,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; @@ -2388,7 +2388,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; @@ -2410,7 +2410,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; @@ -2442,7 +2442,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) { @@ -2537,7 +2537,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(9)] - public Result StartThread(int handle) + public static Result StartThread(int handle) { KProcess process = KernelStatic.GetCurrentProcess(); @@ -2565,7 +2565,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0xa)] - public void ExitThread() + public static void ExitThread() { KThread currentThread = KernelStatic.GetCurrentThread(); @@ -2597,7 +2597,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(); @@ -2618,7 +2618,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. @@ -2637,7 +2637,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(); @@ -2660,7 +2660,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(); @@ -2709,13 +2709,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(); @@ -2736,7 +2736,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(); @@ -2761,7 +2761,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(); @@ -2926,7 +2926,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)) { @@ -2944,7 +2944,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)) { @@ -2962,7 +2962,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } [Svc(0x1c)] - public Result WaitProcessWideKeyAtomic( + public static Result WaitProcessWideKeyAtomic( [PointerSized] ulong mutexAddress, [PointerSized] ulong condVarAddress, int handle, @@ -2993,7 +2993,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(); @@ -3003,7 +3003,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)) { @@ -3035,7 +3035,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)) { @@ -3062,7 +3062,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/AudioRenderer.cs b/src/Ryujinx.Horizon/Sdk/Audio/Detail/AudioRenderer.cs index 4d446bba7..168d58619 100644 --- a/src/Ryujinx.Horizon/Sdk/Audio/Detail/AudioRenderer.cs +++ b/src/Ryujinx.Horizon/Sdk/Audio/Detail/AudioRenderer.cs @@ -64,7 +64,7 @@ namespace Ryujinx.Horizon.Sdk.Audio.Detail using MemoryHandle outputHandle = output.Pin(); using MemoryHandle performanceOutputHandle = performanceOutput.Pin(); - Result result = new Result((int)_renderSystem.Update(output, performanceOutput, input)); + Result result = new((int)_renderSystem.Update(output, performanceOutput, input)); return result; } diff --git a/src/Ryujinx.Horizon/Sdk/Audio/Detail/AudioRendererManager.cs b/src/Ryujinx.Horizon/Sdk/Audio/Detail/AudioRendererManager.cs index 7138d27ce..2b44276c8 100644 --- a/src/Ryujinx.Horizon/Sdk/Audio/Detail/AudioRendererManager.cs +++ b/src/Ryujinx.Horizon/Sdk/Audio/Detail/AudioRendererManager.cs @@ -33,7 +33,7 @@ namespace Ryujinx.Horizon.Sdk.Audio.Detail var clientMemoryManager = HorizonStatic.Syscall.GetMemoryManagerByProcessHandle(processHandle); ulong workBufferAddress = HorizonStatic.Syscall.GetTransferMemoryAddress(workBufferHandle); - Result result = new Result((int)_impl.OpenAudioRenderer( + Result result = new((int)_impl.OpenAudioRenderer( out var renderSystem, clientMemoryManager, ref parameter.Configuration, @@ -98,7 +98,7 @@ namespace Ryujinx.Horizon.Sdk.Audio.Detail { var clientMemoryManager = HorizonStatic.Syscall.GetMemoryManagerByProcessHandle(processHandle); - Result result = new Result((int)_impl.OpenAudioRenderer( + Result result = new((int)_impl.OpenAudioRenderer( out var renderSystem, clientMemoryManager, ref parameter.Configuration, diff --git a/src/Ryujinx.Horizon/Sdk/Codec/Detail/HardwareOpusDecoderManager.cs b/src/Ryujinx.Horizon/Sdk/Codec/Detail/HardwareOpusDecoderManager.cs index acec66e82..ae79d0ecb 100644 --- a/src/Ryujinx.Horizon/Sdk/Codec/Detail/HardwareOpusDecoderManager.cs +++ b/src/Ryujinx.Horizon/Sdk/Codec/Detail/HardwareOpusDecoderManager.cs @@ -230,7 +230,7 @@ namespace Ryujinx.Horizon.Sdk.Codec.Detail return GetWorkBufferSizeForMultiStreamExImpl(out size, in parameter, fromDsp: true); } - private Result GetWorkBufferSizeExImpl(out int size, in HardwareOpusDecoderParameterInternalEx parameter, bool fromDsp) + private static Result GetWorkBufferSizeExImpl(out int size, in HardwareOpusDecoderParameterInternalEx parameter, bool fromDsp) { size = 0; @@ -254,7 +254,7 @@ namespace Ryujinx.Horizon.Sdk.Codec.Detail return Result.Success; } - private Result GetWorkBufferSizeForMultiStreamExImpl(out int size, in HardwareOpusMultiStreamDecoderParameterInternalEx parameter, bool fromDsp) + private static Result GetWorkBufferSizeForMultiStreamExImpl(out int size, in HardwareOpusMultiStreamDecoderParameterInternalEx parameter, bool fromDsp) { size = 0; diff --git a/src/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs b/src/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs index 9009c26e9..092b58fa0 100644 --- a/src/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs +++ b/src/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs @@ -9,7 +9,7 @@ namespace Ryujinx.Input.SDL2 { private readonly Dictionary _gamepadsInstanceIdsMapping; private readonly List _gamepadsIds; - private readonly object _lock = new object(); + private readonly object _lock = new(); public ReadOnlySpan GamepadsIds { diff --git a/src/Ryujinx.Memory/AddressSpaceManager.cs b/src/Ryujinx.Memory/AddressSpaceManager.cs index 916ac1ca6..a924a3a16 100644 --- a/src/Ryujinx.Memory/AddressSpaceManager.cs +++ b/src/Ryujinx.Memory/AddressSpaceManager.cs @@ -249,7 +249,7 @@ namespace Ryujinx.Memory => new NativeMemoryManager((byte*)pa, size).Memory; protected override unsafe Span GetPhysicalAddressSpan(nuint pa, int size) - => new Span((void*)pa, size); + => new((void*)pa, size); protected override nuint TranslateVirtualAddressChecked(ulong va) => GetHostAddress(va); diff --git a/src/Ryujinx.Memory/Tracking/RegionHandle.cs b/src/Ryujinx.Memory/Tracking/RegionHandle.cs index a94ffa43c..e4998a480 100644 --- a/src/Ryujinx.Memory/Tracking/RegionHandle.cs +++ b/src/Ryujinx.Memory/Tracking/RegionHandle.cs @@ -177,7 +177,7 @@ namespace Ryujinx.Memory.Tracking InitializeRegions(); } - private List GetGuestRegions(MemoryTracking tracking, ulong address, ulong size, RegionFlags flags) + private static List GetGuestRegions(MemoryTracking tracking, ulong address, ulong size, RegionFlags flags) { ulong guestAddress; ulong guestSize; diff --git a/src/Ryujinx.Tests.Memory/MockVirtualMemoryManager.cs b/src/Ryujinx.Tests.Memory/MockVirtualMemoryManager.cs index 095f0d9f1..998c76feb 100644 --- a/src/Ryujinx.Tests.Memory/MockVirtualMemoryManager.cs +++ b/src/Ryujinx.Tests.Memory/MockVirtualMemoryManager.cs @@ -85,7 +85,7 @@ namespace Ryujinx.Tests.Memory IEnumerable IVirtualMemoryManager.GetPhysicalRegions(ulong va, ulong size) { - return NoMappings ? [] : new MemoryRange[] { new MemoryRange(va, size) }; + return NoMappings ? [] : new MemoryRange[] { new(va, size) }; } public bool IsMapped(ulong va) diff --git a/src/Ryujinx/AppHost.cs b/src/Ryujinx/AppHost.cs index 0db8ef414..977d625b2 100644 --- a/src/Ryujinx/AppHost.cs +++ b/src/Ryujinx/AppHost.cs @@ -367,12 +367,12 @@ namespace Ryujinx.Ava } var colorType = e.IsBgra ? SKColorType.Bgra8888 : SKColorType.Rgba8888; - using SKBitmap bitmap = new SKBitmap(new SKImageInfo(e.Width, e.Height, colorType, SKAlphaType.Premul)); + using SKBitmap bitmap = new(new SKImageInfo(e.Width, e.Height, colorType, SKAlphaType.Premul)); Marshal.Copy(e.Data, 0, bitmap.GetPixels(), e.Data.Length); - using SKBitmap bitmapToSave = new SKBitmap(bitmap.Width, bitmap.Height); - using SKCanvas canvas = new SKCanvas(bitmapToSave); + using SKBitmap bitmapToSave = new(bitmap.Width, bitmap.Height); + using SKCanvas canvas = new(bitmapToSave); canvas.Clear(SKColors.Black); @@ -396,7 +396,7 @@ namespace Ryujinx.Ava } } - private void SaveBitmapAsPng(SKBitmap bitmap, string path) + private static void SaveBitmapAsPng(SKBitmap bitmap, string path) { using var data = bitmap.Encode(SKEncodedImageFormat.Png, 100); using var stream = File.OpenWrite(path);