Explorar el Código

Migrate to .NET 9 (#198)

Marco Carvalho hace 1 año
padre
commit
ff6628149d
Se han modificado 100 ficheros con 178 adiciones y 163 borrados
  1. 1 1
      COMPILING.md
  2. 6 0
      Directory.Build.props
  3. 2 2
      Directory.Packages.props
  4. 2 2
      README.md
  5. 1 1
      global.json
  6. 0 1
      src/ARMeilleure/ARMeilleure.csproj
  7. 2 1
      src/ARMeilleure/Decoders/DecoderHelper.cs
  8. 1 1
      src/ARMeilleure/Instructions/SoftFallback.cs
  9. 1 1
      src/ARMeilleure/IntermediateRepresentation/Operation.cs
  10. 2 1
      src/ARMeilleure/Translation/Cache/JitCache.cs
  11. 5 5
      src/ARMeilleure/Translation/EmitterContext.cs
  12. 1 3
      src/ARMeilleure/Translation/PTC/Ptc.cs
  13. 1 3
      src/ARMeilleure/Translation/PTC/PtcProfiler.cs
  14. 2 1
      src/Ryujinx.Audio.Backends.OpenAL/OpenALHardwareDeviceSession.cs
  15. 0 1
      src/Ryujinx.Audio.Backends.OpenAL/Ryujinx.Audio.Backends.OpenAL.csproj
  16. 0 1
      src/Ryujinx.Audio.Backends.SDL2/Ryujinx.Audio.Backends.SDL2.csproj
  17. 0 1
      src/Ryujinx.Audio.Backends.SoundIo/Ryujinx.Audio.Backends.SoundIo.csproj
  18. 1 1
      src/Ryujinx.Audio/AudioManager.cs
  19. 2 1
      src/Ryujinx.Audio/Backends/Common/DynamicRingBuffer.cs
  20. 2 2
      src/Ryujinx.Audio/Input/AudioInputManager.cs
  21. 2 2
      src/Ryujinx.Audio/Input/AudioInputSystem.cs
  22. 2 2
      src/Ryujinx.Audio/Output/AudioOutputManager.cs
  23. 2 2
      src/Ryujinx.Audio/Output/AudioOutputSystem.cs
  24. 1 1
      src/Ryujinx.Audio/Renderer/Server/AudioRenderSystem.cs
  25. 2 2
      src/Ryujinx.Audio/Renderer/Server/AudioRendererManager.cs
  26. 2 1
      src/Ryujinx.Audio/Renderer/Server/Upsampler/UpsamplerManager.cs
  27. 0 1
      src/Ryujinx.Audio/Ryujinx.Audio.csproj
  28. 1 1
      src/Ryujinx.Common/PreciseSleep/NanosleepPool.cs
  29. 1 1
      src/Ryujinx.Common/PreciseSleep/WindowsGranularTimer.cs
  30. 0 1
      src/Ryujinx.Common/Ryujinx.Common.csproj
  31. 2 1
      src/Ryujinx.Cpu/AppleHv/HvVm.cs
  32. 1 1
      src/Ryujinx.Cpu/LightningJit/Arm32/Target/Arm64/InstEmitSystem.cs
  33. 2 2
      src/Ryujinx.Cpu/LightningJit/Arm64/Target/Arm64/InstEmitSystem.cs
  34. 2 1
      src/Ryujinx.Cpu/LightningJit/Cache/JitCache.cs
  35. 2 2
      src/Ryujinx.Cpu/LightningJit/Cache/NoWxCache.cs
  36. 0 1
      src/Ryujinx.Cpu/Ryujinx.Cpu.csproj
  37. 2 1
      src/Ryujinx.Cpu/Signal/NativeSignalHandler.cs
  38. 0 1
      src/Ryujinx.Graphics.Device/Ryujinx.Graphics.Device.csproj
  39. 1 1
      src/Ryujinx.Graphics.GAL/Multithreading/ThreadedRenderer.cs
  40. 0 1
      src/Ryujinx.Graphics.GAL/Ryujinx.Graphics.GAL.csproj
  41. 2 1
      src/Ryujinx.Graphics.Gpu/Image/TextureCache.cs
  42. 3 1
      src/Ryujinx.Graphics.Gpu/Image/TextureGroup.cs
  43. 1 1
      src/Ryujinx.Graphics.Gpu/Image/TexturePool.cs
  44. 3 2
      src/Ryujinx.Graphics.Gpu/Memory/BufferModifiedRangeList.cs
  45. 0 1
      src/Ryujinx.Graphics.Gpu/Ryujinx.Graphics.Gpu.csproj
  46. 0 1
      src/Ryujinx.Graphics.Host1x/Ryujinx.Graphics.Host1x.csproj
  47. 0 1
      src/Ryujinx.Graphics.Nvdec.FFmpeg/Ryujinx.Graphics.Nvdec.FFmpeg.csproj
  48. 0 1
      src/Ryujinx.Graphics.Nvdec.Vp9/Ryujinx.Graphics.Nvdec.Vp9.csproj
  49. 0 1
      src/Ryujinx.Graphics.Nvdec/Ryujinx.Graphics.Nvdec.csproj
  50. 1 1
      src/Ryujinx.Graphics.OpenGL/Queries/CounterQueue.cs
  51. 1 1
      src/Ryujinx.Graphics.OpenGL/Queries/CounterQueueEvent.cs
  52. 2 1
      src/Ryujinx.Graphics.OpenGL/ResourcePool.cs
  53. 0 1
      src/Ryujinx.Graphics.OpenGL/Ryujinx.Graphics.OpenGL.csproj
  54. 2 2
      src/Ryujinx.Graphics.Shader/CodeGen/Spirv/SpirvGenerator.cs
  55. 0 1
      src/Ryujinx.Graphics.Shader/Ryujinx.Graphics.Shader.csproj
  56. 0 1
      src/Ryujinx.Graphics.Texture/Ryujinx.Graphics.Texture.csproj
  57. 0 1
      src/Ryujinx.Graphics.Vic/Ryujinx.Graphics.Vic.csproj
  58. 0 1
      src/Ryujinx.Graphics.Video/Ryujinx.Graphics.Video.csproj
  59. 1 1
      src/Ryujinx.Graphics.Vulkan/BackgroundResources.cs
  60. 2 2
      src/Ryujinx.Graphics.Vulkan/CommandBufferPool.cs
  61. 2 2
      src/Ryujinx.Graphics.Vulkan/FormatCapabilities.cs
  62. 2 1
      src/Ryujinx.Graphics.Vulkan/HostMemoryAllocator.cs
  63. 1 1
      src/Ryujinx.Graphics.Vulkan/Queries/CounterQueue.cs
  64. 1 1
      src/Ryujinx.Graphics.Vulkan/Queries/CounterQueueEvent.cs
  65. 0 1
      src/Ryujinx.Graphics.Vulkan/Ryujinx.Graphics.Vulkan.csproj
  66. 2 1
      src/Ryujinx.Graphics.Vulkan/Shader.cs
  67. 6 5
      src/Ryujinx.Graphics.Vulkan/VulkanRenderer.cs
  68. 11 10
      src/Ryujinx.HLE/FileSystem/ContentManager.cs
  69. 1 1
      src/Ryujinx.HLE/FileSystem/ContentMetaData.cs
  70. 2 1
      src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardApplet.cs
  71. 2 1
      src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardRendererBase.cs
  72. 1 1
      src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/TimedAction.cs
  73. 2 3
      src/Ryujinx.HLE/HOS/Kernel/Common/KResourceLimit.cs
  74. 2 2
      src/Ryujinx.HLE/HOS/Kernel/Memory/KCodeMemory.cs
  75. 2 2
      src/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs
  76. 1 1
      src/Ryujinx.HLE/HOS/Kernel/Threading/KAddressArbiter.cs
  77. 1 2
      src/Ryujinx.HLE/HOS/Kernel/Threading/KCriticalSection.cs
  78. 1 1
      src/Ryujinx.HLE/HOS/Kernel/Threading/KThread.cs
  79. 19 13
      src/Ryujinx.HLE/HOS/ModLoader.cs
  80. 2 1
      src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs
  81. 1 1
      src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs
  82. 1 1
      src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/TouchDevice.cs
  83. 2 1
      src/Ryujinx.HLE/HOS/Services/Ldn/Types/NodeLatestUpdate.cs
  84. 1 1
      src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/LanDiscovery.cs
  85. 1 1
      src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/Proxy/LdnProxyUdpServer.cs
  86. 1 1
      src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnRyu/NetworkTimeout.cs
  87. 2 1
      src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnRyu/Proxy/EphemeralPortPool.cs
  88. 4 3
      src/Ryujinx.HLE/HOS/Services/Nfc/Nfp/VirtualAmiibo.cs
  89. 1 1
      src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/NvHostEvent.cs
  90. 1 1
      src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/NvHostSyncPt.cs
  91. 2 1
      src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/BsdContext.cs
  92. 2 1
      src/Ryujinx.HLE/HOS/Services/Ssl/BuiltInCertificateManager.cs
  93. 2 1
      src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/ConsumerBase.cs
  94. 2 1
      src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/HOSBinderDriverServer.cs
  95. 1 1
      src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/SurfaceFlinger.cs
  96. 2 1
      src/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZoneManager.cs
  97. 11 6
      src/Ryujinx.HLE/Loaders/Processes/ProcessLoaderHelper.cs
  98. 5 7
      src/Ryujinx.HLE/PerformanceStatistics.cs
  99. 0 1
      src/Ryujinx.HLE/Ryujinx.HLE.csproj
  100. 0 1
      src/Ryujinx.Headless.SDL2/Ryujinx.Headless.SDL2.csproj

+ 1 - 1
COMPILING.md

@@ -5,7 +5,7 @@ If you wish to build the emulator yourself, follow these steps:
 
 ### Step 1
 
-Install the [.NET 8.0 (or higher) SDK](https://dotnet.microsoft.com/download/dotnet/8.0).
+Install the [.NET 9.0 (or higher) SDK](https://dotnet.microsoft.com/download/dotnet/9.0).
 Make sure your SDK version is higher or equal to the required version specified in [global.json](global.json).
 
 ### Step 2

+ 6 - 0
Directory.Build.props

@@ -0,0 +1,6 @@
+<Project>
+  <PropertyGroup>
+    <TargetFramework>net9.0</TargetFramework>
+    <LangVersion>latest</LangVersion>
+  </PropertyGroup>
+</Project>

+ 2 - 2
Directory.Packages.props

@@ -48,8 +48,8 @@
     <PackageVersion Include="SkiaSharp" Version="2.88.7" />
     <PackageVersion Include="SkiaSharp.NativeAssets.Linux" Version="2.88.7" />
     <PackageVersion Include="SPB" Version="0.0.4-build32" />
-    <PackageVersion Include="System.IO.Hashing" Version="8.0.0" />
-    <PackageVersion Include="System.Management" Version="8.0.0" />
+    <PackageVersion Include="System.IO.Hashing" Version="9.0.0" />
+    <PackageVersion Include="System.Management" Version="9.0.0" />
     <PackageVersion Include="UnicornEngine.Unicorn" Version="2.0.2-rc1-fb78016" />
   </ItemGroup>
 </Project>

+ 2 - 2
README.md

@@ -54,7 +54,7 @@ failing to meet this requirement may result in a poor gameplay experience or une
 
 ## Latest build
 
-Stable builds are made every so often onto a separate "release" branch that then gets put into the releases you know and love. 
+Stable builds are made every so often onto a separate "release" branch that then gets put into the releases you know and love.
 These stable builds exist so that the end user can get a more **enjoyable and stable experience**.
 
 You can find the latest stable release [here](https://github.com/GreemDev/Ryujinx/releases/latest).
@@ -82,7 +82,7 @@ If you are planning to contribute or just want to learn more about this project
   It translates the ARM code to a custom IR, performs a few optimizations, and turns that into x86 code.
   There are three memory manager options available depending on the user's preference, leveraging both software-based (slower) and host-mapped modes (much faster).
   The fastest option (host, unchecked) is set by default.
-  Ryujinx also features an optional Profiled Persistent Translation Cache, which essentially caches translated functions so that they do not need to be translated every time the game loads. 
+  Ryujinx also features an optional Profiled Persistent Translation Cache, which essentially caches translated functions so that they do not need to be translated every time the game loads.
   The net result is a significant reduction in load times (the amount of time between launching a game and arriving at the title screen) for nearly every game.
   NOTE: This feature is enabled by default in the Options menu > System tab.
   You must launch the game at least twice to the title screen or beyond before performance improvements are unlocked on the third launch!

+ 1 - 1
global.json

@@ -1,6 +1,6 @@
 {
   "sdk": {
-    "version": "8.0.100",
+    "version": "9.0.100",
     "rollForward": "latestFeature"
   }
 }

+ 0 - 1
src/ARMeilleure/ARMeilleure.csproj

@@ -1,7 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>net8.0</TargetFramework>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <DefaultItemExcludes>$(DefaultItemExcludes);._*</DefaultItemExcludes>
   </PropertyGroup>

+ 2 - 1
src/ARMeilleure/Decoders/DecoderHelper.cs

@@ -1,4 +1,5 @@
 using ARMeilleure.Common;
+using System;
 
 namespace ARMeilleure.Decoders
 {
@@ -149,7 +150,7 @@ namespace ARMeilleure.Decoders
             return (((long)opCode << 45) >> 48) & ~3;
         }
 
-        public static bool VectorArgumentsInvalid(bool q, params int[] args)
+        public static bool VectorArgumentsInvalid(bool q, params ReadOnlySpan<int> args)
         {
             if (q)
             {

+ 1 - 1
src/ARMeilleure/Instructions/SoftFallback.cs

@@ -264,7 +264,7 @@ namespace ARMeilleure.Instructions
             return TblOrTbx(dest, vector, bytes, tb0, tb1, tb2, tb3);
         }
 
-        private static V128 TblOrTbx(V128 dest, V128 vector, int bytes, params V128[] tb)
+        private static V128 TblOrTbx(V128 dest, V128 vector, int bytes, params ReadOnlySpan<V128> tb)
         {
             byte[] res = new byte[16];
 

+ 1 - 1
src/ARMeilleure/IntermediateRepresentation/Operation.cs

@@ -337,7 +337,7 @@ namespace ARMeilleure.IntermediateRepresentation
                 return result;
             }
 
-            public static Operation Operation(Intrinsic intrin, Operand dest, params Operand[] srcs)
+            public static Operation Operation(Intrinsic intrin, Operand dest, params ReadOnlySpan<Operand> srcs)
             {
                 Operation result = Make(Instruction.Extended, 0, srcs.Length);
 

+ 2 - 1
src/ARMeilleure/Translation/Cache/JitCache.cs

@@ -8,6 +8,7 @@ using System.Collections.Generic;
 using System.Diagnostics;
 using System.Runtime.InteropServices;
 using System.Runtime.Versioning;
+using System.Threading;
 
 namespace ARMeilleure.Translation.Cache
 {
@@ -26,7 +27,7 @@ namespace ARMeilleure.Translation.Cache
 
         private static readonly List<CacheEntry> _cacheEntries = new();
 
-        private static readonly object _lock = new();
+        private static readonly Lock _lock = new();
         private static bool _initialized;
 
         [SupportedOSPlatform("windows")]

+ 5 - 5
src/ARMeilleure/Translation/EmitterContext.cs

@@ -559,27 +559,27 @@ namespace ARMeilleure.Translation
             return dest;
         }
 
-        public Operand AddIntrinsic(Intrinsic intrin, params Operand[] args)
+        public Operand AddIntrinsic(Intrinsic intrin, params ReadOnlySpan<Operand> args)
         {
             return Add(intrin, Local(OperandType.V128), args);
         }
 
-        public Operand AddIntrinsicInt(Intrinsic intrin, params Operand[] args)
+        public Operand AddIntrinsicInt(Intrinsic intrin, params ReadOnlySpan<Operand> args)
         {
             return Add(intrin, Local(OperandType.I32), args);
         }
 
-        public Operand AddIntrinsicLong(Intrinsic intrin, params Operand[] args)
+        public Operand AddIntrinsicLong(Intrinsic intrin, params ReadOnlySpan<Operand> args)
         {
             return Add(intrin, Local(OperandType.I64), args);
         }
 
-        public void AddIntrinsicNoRet(Intrinsic intrin, params Operand[] args)
+        public void AddIntrinsicNoRet(Intrinsic intrin, params ReadOnlySpan<Operand> args)
         {
             Add(intrin, default, args);
         }
 
-        private Operand Add(Intrinsic intrin, Operand dest, params Operand[] sources)
+        private Operand Add(Intrinsic intrin, Operand dest, params ReadOnlySpan<Operand> sources)
         {
             NewNextBlockIfNeeded();
 

+ 1 - 3
src/ARMeilleure/Translation/PTC/Ptc.cs

@@ -59,7 +59,7 @@ namespace ARMeilleure.Translation.PTC
 
         private readonly ManualResetEvent _waitEvent;
 
-        private readonly object _lock;
+        private readonly Lock _lock = new();
 
         private bool _disposed;
 
@@ -89,8 +89,6 @@ namespace ARMeilleure.Translation.PTC
 
             _waitEvent = new ManualResetEvent(true);
 
-            _lock = new object();
-
             _disposed = false;
 
             TitleIdText = TitleIdTextDefault;

+ 1 - 3
src/ARMeilleure/Translation/PTC/PtcProfiler.cs

@@ -41,7 +41,7 @@ namespace ARMeilleure.Translation.PTC
 
         private readonly ManualResetEvent _waitEvent;
 
-        private readonly object _lock;
+        private readonly Lock _lock = new();
 
         private bool _disposed;
 
@@ -65,8 +65,6 @@ namespace ARMeilleure.Translation.PTC
 
             _waitEvent = new ManualResetEvent(true);
 
-            _lock = new object();
-
             _disposed = false;
 
             ProfiledFuncs = new Dictionary<ulong, FuncProfile>();

+ 2 - 1
src/Ryujinx.Audio.Backends.OpenAL/OpenALHardwareDeviceSession.cs

@@ -5,6 +5,7 @@ using Ryujinx.Memory;
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;
+using System.Threading;
 
 namespace Ryujinx.Audio.Backends.OpenAL
 {
@@ -18,7 +19,7 @@ namespace Ryujinx.Audio.Backends.OpenAL
         private ulong _playedSampleCount;
         private float _volume;
 
-        private readonly object _lock = new();
+        private readonly Lock _lock = new();
 
         public OpenALHardwareDeviceSession(OpenALHardwareDeviceDriver driver, IVirtualMemoryManager memoryManager, SampleFormat requestedSampleFormat, uint requestedSampleRate, uint requestedChannelCount) : base(memoryManager, requestedSampleFormat, requestedSampleRate, requestedChannelCount)
         {

+ 0 - 1
src/Ryujinx.Audio.Backends.OpenAL/Ryujinx.Audio.Backends.OpenAL.csproj

@@ -1,7 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>net8.0</TargetFramework>
     <DefaultItemExcludes>$(DefaultItemExcludes);._*</DefaultItemExcludes>
   </PropertyGroup>
 

+ 0 - 1
src/Ryujinx.Audio.Backends.SDL2/Ryujinx.Audio.Backends.SDL2.csproj

@@ -1,7 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>net8.0</TargetFramework>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <DefaultItemExcludes>$(DefaultItemExcludes);._*</DefaultItemExcludes>
   </PropertyGroup>

+ 0 - 1
src/Ryujinx.Audio.Backends.SoundIo/Ryujinx.Audio.Backends.SoundIo.csproj

@@ -1,7 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>net8.0</TargetFramework>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <RuntimeIdentifiers>win-x64;osx-x64;linux-x64</RuntimeIdentifiers>
     <DefaultItemExcludes>$(DefaultItemExcludes);._*</DefaultItemExcludes>

+ 1 - 1
src/Ryujinx.Audio/AudioManager.cs

@@ -11,7 +11,7 @@ namespace Ryujinx.Audio
         /// <summary>
         /// Lock used to control the waiters registration.
         /// </summary>
-        private readonly object _lock = new();
+        private readonly Lock _lock = new();
 
         /// <summary>
         /// Events signaled when the driver played audio buffers.

+ 2 - 1
src/Ryujinx.Audio/Backends/Common/DynamicRingBuffer.cs

@@ -2,6 +2,7 @@ using Ryujinx.Common;
 using Ryujinx.Common.Memory;
 using System;
 using System.Buffers;
+using System.Threading;
 
 namespace Ryujinx.Audio.Backends.Common
 {
@@ -12,7 +13,7 @@ namespace Ryujinx.Audio.Backends.Common
     {
         private const int RingBufferAlignment = 2048;
 
-        private readonly object _lock = new();
+        private readonly Lock _lock = new();
 
         private MemoryOwner<byte> _bufferOwner;
         private Memory<byte> _buffer;

+ 2 - 2
src/Ryujinx.Audio/Input/AudioInputManager.cs

@@ -14,12 +14,12 @@ namespace Ryujinx.Audio.Input
     /// </summary>
     public class AudioInputManager : IDisposable
     {
-        private readonly object _lock = new();
+        private readonly Lock _lock = new();
 
         /// <summary>
         /// Lock used for session allocation.
         /// </summary>
-        private readonly object _sessionLock = new();
+        private readonly Lock _sessionLock = new();
 
         /// <summary>
         /// The session ids allocation table.

+ 2 - 2
src/Ryujinx.Audio/Input/AudioInputSystem.cs

@@ -48,7 +48,7 @@ namespace Ryujinx.Audio.Input
         /// <summary>
         /// The lock of the parent.
         /// </summary>
-        private readonly object _parentLock;
+        private readonly Lock _parentLock;
 
         /// <summary>
         /// The dispose state.
@@ -62,7 +62,7 @@ namespace Ryujinx.Audio.Input
         /// <param name="parentLock">The lock of the manager</param>
         /// <param name="deviceSession">The hardware device session</param>
         /// <param name="bufferEvent">The buffer release event of the audio input</param>
-        public AudioInputSystem(AudioInputManager manager, object parentLock, IHardwareDeviceSession deviceSession, IWritableEvent bufferEvent)
+        public AudioInputSystem(AudioInputManager manager, Lock parentLock, IHardwareDeviceSession deviceSession, IWritableEvent bufferEvent)
         {
             _manager = manager;
             _parentLock = parentLock;

+ 2 - 2
src/Ryujinx.Audio/Output/AudioOutputManager.cs

@@ -14,12 +14,12 @@ namespace Ryujinx.Audio.Output
     /// </summary>
     public class AudioOutputManager : IDisposable
     {
-        private readonly object _lock = new();
+        private readonly Lock _lock = new();
 
         /// <summary>
         /// Lock used for session allocation.
         /// </summary>
-        private readonly object _sessionLock = new();
+        private readonly Lock _sessionLock = new();
 
         /// <summary>
         /// The session ids allocation table.

+ 2 - 2
src/Ryujinx.Audio/Output/AudioOutputSystem.cs

@@ -48,7 +48,7 @@ namespace Ryujinx.Audio.Output
         /// <summary>
         /// THe lock of the parent.
         /// </summary>
-        private readonly object _parentLock;
+        private readonly Lock _parentLock;
 
         /// <summary>
         /// The dispose state.
@@ -62,7 +62,7 @@ namespace Ryujinx.Audio.Output
         /// <param name="parentLock">The lock of the manager</param>
         /// <param name="deviceSession">The hardware device session</param>
         /// <param name="bufferEvent">The buffer release event of the audio output</param>
-        public AudioOutputSystem(AudioOutputManager manager, object parentLock, IHardwareDeviceSession deviceSession, IWritableEvent bufferEvent)
+        public AudioOutputSystem(AudioOutputManager manager, Lock parentLock, IHardwareDeviceSession deviceSession, IWritableEvent bufferEvent)
         {
             _manager = manager;
             _parentLock = parentLock;

+ 1 - 1
src/Ryujinx.Audio/Renderer/Server/AudioRenderSystem.cs

@@ -26,7 +26,7 @@ namespace Ryujinx.Audio.Renderer.Server
 {
     public class AudioRenderSystem : IDisposable
     {
-        private readonly object _lock = new();
+        private readonly Lock _lock = new();
 
         private AudioRendererRenderingDevice _renderingDevice;
         private AudioRendererExecutionMode _executionMode;

+ 2 - 2
src/Ryujinx.Audio/Renderer/Server/AudioRendererManager.cs

@@ -19,12 +19,12 @@ namespace Ryujinx.Audio.Renderer.Server
         /// <summary>
         /// Lock used for session allocation.
         /// </summary>
-        private readonly object _sessionLock = new();
+        private readonly Lock _sessionLock = new();
 
         /// <summary>
         /// Lock used to control the <see cref="AudioProcessor"/> running state.
         /// </summary>
-        private readonly object _audioProcessorLock = new();
+        private readonly Lock _audioProcessorLock = new();
 
         /// <summary>
         /// The session ids allocation table.

+ 2 - 1
src/Ryujinx.Audio/Renderer/Server/Upsampler/UpsamplerManager.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Diagnostics;
+using System.Threading;
 
 namespace Ryujinx.Audio.Renderer.Server.Upsampler
 {
@@ -16,7 +17,7 @@ namespace Ryujinx.Audio.Renderer.Server.Upsampler
         /// <summary>
         /// Global lock of the object.
         /// </summary>
-        private readonly object _lock = new();
+        private readonly Lock _lock = new();
 
         /// <summary>
         /// The upsamplers instances.

+ 0 - 1
src/Ryujinx.Audio/Ryujinx.Audio.csproj

@@ -1,7 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>net8.0</TargetFramework>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <DefaultItemExcludes>$(DefaultItemExcludes);._*</DefaultItemExcludes>
   </PropertyGroup>

+ 1 - 1
src/Ryujinx.Common/PreciseSleep/NanosleepPool.cs

@@ -124,7 +124,7 @@ namespace Ryujinx.Common.PreciseSleep
             }
         }
 
-        private readonly object _lock = new();
+        private readonly Lock _lock = new();
         private readonly List<NanosleepThread> _threads = new();
         private readonly List<NanosleepThread> _active = new();
         private readonly Stack<NanosleepThread> _free = new();

+ 1 - 1
src/Ryujinx.Common/PreciseSleep/WindowsGranularTimer.cs

@@ -50,7 +50,7 @@ namespace Ryujinx.Common.SystemInterop
         private long _lastTicks = PerformanceCounter.ElapsedTicks;
         private long _lastId;
 
-        private readonly object _lock = new();
+        private readonly Lock _lock = new();
         private readonly List<WaitingObject> _waitingObjects = new();
 
         private WindowsGranularTimer()

+ 0 - 1
src/Ryujinx.Common/Ryujinx.Common.csproj

@@ -1,7 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>net8.0</TargetFramework>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <DefineConstants Condition=" '$(ExtraDefineConstants)' != '' ">$(DefineConstants);$(ExtraDefineConstants)</DefineConstants>
     <DefaultItemExcludes>$(DefaultItemExcludes);._*</DefaultItemExcludes>

+ 2 - 1
src/Ryujinx.Cpu/AppleHv/HvVm.cs

@@ -1,6 +1,7 @@
 using Ryujinx.Memory;
 using System;
 using System.Runtime.Versioning;
+using System.Threading;
 
 namespace Ryujinx.Cpu.AppleHv
 {
@@ -12,7 +13,7 @@ namespace Ryujinx.Cpu.AppleHv
 
         private static int _addressSpaces;
         private static HvIpaAllocator _ipaAllocator;
-        private static readonly object _lock = new();
+        private static readonly Lock _lock = new();
 
         public static (ulong, HvIpaAllocator) CreateAddressSpace(MemoryBlock block)
         {

+ 1 - 1
src/Ryujinx.Cpu/LightningJit/Arm32/Target/Arm64/InstEmitSystem.cs

@@ -478,7 +478,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm32.Target.Arm64
             bool skipContext,
             int spillBaseOffset,
             int? resultRegister,
-            params ulong[] callArgs)
+            params ReadOnlySpan<ulong> callArgs)
         {
             uint resultMask = 0u;
 

+ 2 - 2
src/Ryujinx.Cpu/LightningJit/Arm64/Target/Arm64/InstEmitSystem.cs

@@ -307,7 +307,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm64.Target.Arm64
             int tempRegister;
             int tempGuestAddress = -1;
 
-            bool inlineLookup = guestAddress.Kind != OperandKind.Constant && 
+            bool inlineLookup = guestAddress.Kind != OperandKind.Constant &&
                                 funcTable is { Sparse: true };
 
             if (guestAddress.Kind == OperandKind.Constant)
@@ -417,7 +417,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm64.Target.Arm64
             nint funcPtr,
             int spillBaseOffset,
             int? resultRegister,
-            params ulong[] callArgs)
+            params ReadOnlySpan<ulong> callArgs)
         {
             uint resultMask = 0u;
 

+ 2 - 1
src/Ryujinx.Cpu/LightningJit/Cache/JitCache.cs

@@ -5,6 +5,7 @@ using System.Collections.Generic;
 using System.Diagnostics;
 using System.Runtime.InteropServices;
 using System.Runtime.Versioning;
+using System.Threading;
 
 namespace Ryujinx.Cpu.LightningJit.Cache
 {
@@ -23,7 +24,7 @@ namespace Ryujinx.Cpu.LightningJit.Cache
 
         private static readonly List<CacheEntry> _cacheEntries = new();
 
-        private static readonly object _lock = new();
+        private static readonly Lock _lock = new();
         private static bool _initialized;
 
         [SupportedOSPlatform("windows")]

+ 2 - 2
src/Ryujinx.Cpu/LightningJit/Cache/NoWxCache.cs

@@ -4,6 +4,7 @@ using Ryujinx.Memory;
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;
+using System.Threading;
 
 namespace Ryujinx.Cpu.LightningJit.Cache
 {
@@ -104,7 +105,7 @@ namespace Ryujinx.Cpu.LightningJit.Cache
         private readonly MemoryCache _sharedCache;
         private readonly MemoryCache _localCache;
         private readonly PageAlignedRangeList _pendingMap;
-        private readonly object _lock;
+        private readonly Lock _lock = new();
 
         class ThreadLocalCacheEntry
         {
@@ -137,7 +138,6 @@ namespace Ryujinx.Cpu.LightningJit.Cache
             _sharedCache = new(allocator, SharedCacheSize);
             _localCache = new(allocator, LocalCacheSize);
             _pendingMap = new(_sharedCache.ReprotectAsRx, RegisterFunction);
-            _lock = new();
         }
 
         public unsafe nint Map(nint framePointer, ReadOnlySpan<byte> code, ulong guestAddress, ulong guestSize)

+ 0 - 1
src/Ryujinx.Cpu/Ryujinx.Cpu.csproj

@@ -1,7 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>net8.0</TargetFramework>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <DefaultItemExcludes>$(DefaultItemExcludes);._*</DefaultItemExcludes>
   </PropertyGroup>

+ 2 - 1
src/Ryujinx.Cpu/Signal/NativeSignalHandler.cs

@@ -5,6 +5,7 @@ using System;
 using System.Diagnostics;
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
+using System.Threading;
 
 namespace Ryujinx.Cpu.Signal
 {
@@ -59,7 +60,7 @@ namespace Ryujinx.Cpu.Signal
 
         private static MemoryBlock _codeBlock;
 
-        private static readonly object _lock = new();
+        private static readonly Lock _lock = new();
         private static bool _initialized;
 
         static NativeSignalHandler()

+ 0 - 1
src/Ryujinx.Graphics.Device/Ryujinx.Graphics.Device.csproj

@@ -1,7 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>net8.0</TargetFramework>
     <DefaultItemExcludes>$(DefaultItemExcludes);._*</DefaultItemExcludes>
   </PropertyGroup>
 

+ 1 - 1
src/Ryujinx.Graphics.GAL/Multithreading/ThreadedRenderer.cs

@@ -58,7 +58,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading
         public uint ProgramCount { get; set; } = 0;
 
         private Action _interruptAction;
-        private readonly object _interruptLock = new();
+        private readonly Lock _interruptLock = new();
 
         public event EventHandler<ScreenCaptureImageInfo> ScreenCaptured;
 

+ 0 - 1
src/Ryujinx.Graphics.GAL/Ryujinx.Graphics.GAL.csproj

@@ -1,7 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>net8.0</TargetFramework>
     <DefaultItemExcludes>$(DefaultItemExcludes);._*</DefaultItemExcludes>
   </PropertyGroup>
 

+ 2 - 1
src/Ryujinx.Graphics.Gpu/Image/TextureCache.cs

@@ -8,6 +8,7 @@ using Ryujinx.Graphics.Texture;
 using Ryujinx.Memory.Range;
 using System;
 using System.Collections.Generic;
+using System.Linq;
 using System.Threading;
 
 namespace Ryujinx.Graphics.Gpu.Image
@@ -998,7 +999,7 @@ namespace Ryujinx.Graphics.Gpu.Image
                     {
                         bool dataOverlaps = texture.DataOverlaps(overlap, compatibility);
 
-                        if (!overlap.IsView && dataOverlaps && !incompatibleOverlaps.Exists(incompatible => incompatible.Group == overlap.Group))
+                        if (!overlap.IsView && dataOverlaps && !incompatibleOverlaps.Any(incompatible => incompatible.Group == overlap.Group))
                         {
                             incompatibleOverlaps.Add(new TextureIncompatibleOverlap(overlap.Group, compatibility));
                         }

+ 3 - 1
src/Ryujinx.Graphics.Gpu/Image/TextureGroup.cs

@@ -7,6 +7,7 @@ using Ryujinx.Memory.Range;
 using Ryujinx.Memory.Tracking;
 using System;
 using System.Collections.Generic;
+using System.Linq;
 using System.Runtime.CompilerServices;
 
 namespace Ryujinx.Graphics.Gpu.Image
@@ -1555,7 +1556,7 @@ namespace Ryujinx.Graphics.Gpu.Image
         /// <param name="copy">True if the overlap should register copy dependencies</param>
         public void RegisterIncompatibleOverlap(TextureIncompatibleOverlap other, bool copy)
         {
-            if (!_incompatibleOverlaps.Exists(overlap => overlap.Group == other.Group))
+            if (!_incompatibleOverlaps.Any(overlap => overlap.Group == other.Group))
             {
                 if (copy && other.Compatibility == TextureViewCompatibility.LayoutIncompatible)
                 {
@@ -1701,3 +1702,4 @@ namespace Ryujinx.Graphics.Gpu.Image
         }
     }
 }
+

+ 1 - 1
src/Ryujinx.Graphics.Gpu/Image/TexturePool.cs

@@ -721,7 +721,7 @@ namespace Ryujinx.Graphics.Gpu.Image
         /// <param name="format">The format of the texture</param>
         /// <param name="components">The texture swizzle components</param>
         /// <returns>The depth-stencil mode</returns>
-        private static DepthStencilMode GetDepthStencilMode(Format format, params SwizzleComponent[] components)
+        private static DepthStencilMode GetDepthStencilMode(Format format, params ReadOnlySpan<SwizzleComponent> components)
         {
             // R = Depth, G = Stencil.
             // On 24-bits depth formats, this is inverted (Stencil is R etc).

+ 3 - 2
src/Ryujinx.Graphics.Gpu/Memory/BufferModifiedRangeList.cs

@@ -2,6 +2,7 @@ using Ryujinx.Common.Pools;
 using Ryujinx.Memory.Range;
 using System;
 using System.Linq;
+using System.Threading;
 
 namespace Ryujinx.Graphics.Gpu.Memory
 {
@@ -76,7 +77,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
         private BufferMigration _source;
         private BufferModifiedRangeList _migrationTarget;
 
-        private readonly object _lock = new();
+        private readonly Lock _lock = new();
 
         /// <summary>
         /// Whether the modified range list has any entries or not.
@@ -435,7 +436,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
 
                     if (_source == null)
                     {
-                        // Create a new migration. 
+                        // Create a new migration.
                         _source = new BufferMigration(new BufferMigrationSpan[] { span }, this, _context.SyncNumber);
 
                         _context.RegisterBufferMigration(_source);

+ 0 - 1
src/Ryujinx.Graphics.Gpu/Ryujinx.Graphics.Gpu.csproj

@@ -1,7 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>net8.0</TargetFramework>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <DefaultItemExcludes>$(DefaultItemExcludes);._*</DefaultItemExcludes>
   </PropertyGroup>

+ 0 - 1
src/Ryujinx.Graphics.Host1x/Ryujinx.Graphics.Host1x.csproj

@@ -1,7 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>net8.0</TargetFramework>
     <DefaultItemExcludes>$(DefaultItemExcludes);._*</DefaultItemExcludes>
   </PropertyGroup>
 

+ 0 - 1
src/Ryujinx.Graphics.Nvdec.FFmpeg/Ryujinx.Graphics.Nvdec.FFmpeg.csproj

@@ -1,7 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>net8.0</TargetFramework>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <DefaultItemExcludes>$(DefaultItemExcludes);._*</DefaultItemExcludes>
   </PropertyGroup>

+ 0 - 1
src/Ryujinx.Graphics.Nvdec.Vp9/Ryujinx.Graphics.Nvdec.Vp9.csproj

@@ -1,7 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>net8.0</TargetFramework>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <DefaultItemExcludes>$(DefaultItemExcludes);._*</DefaultItemExcludes>
   </PropertyGroup>

+ 0 - 1
src/Ryujinx.Graphics.Nvdec/Ryujinx.Graphics.Nvdec.csproj

@@ -1,7 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>net8.0</TargetFramework>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <DefaultItemExcludes>$(DefaultItemExcludes);._*</DefaultItemExcludes>
   </PropertyGroup>

+ 1 - 1
src/Ryujinx.Graphics.OpenGL/Queries/CounterQueue.cs

@@ -19,7 +19,7 @@ namespace Ryujinx.Graphics.OpenGL.Queries
         private ulong _accumulatedCounter;
         private int _waiterCount;
 
-        private readonly object _lock = new();
+        private readonly Lock _lock = new();
 
         private readonly Queue<BufferedQuery> _queryPool;
         private readonly AutoResetEvent _queuedEvent = new(false);

+ 1 - 1
src/Ryujinx.Graphics.OpenGL/Queries/CounterQueueEvent.cs

@@ -24,7 +24,7 @@ namespace Ryujinx.Graphics.OpenGL.Queries
         private bool _hostAccessReserved = false;
         private int _refCount = 1; // Starts with a reference from the counter queue.
 
-        private readonly object _lock = new();
+        private readonly Lock _lock = new();
         private ulong _result = ulong.MaxValue;
         private double _divisor = 1f;
 

+ 2 - 1
src/Ryujinx.Graphics.OpenGL/ResourcePool.cs

@@ -2,6 +2,7 @@ using Ryujinx.Graphics.GAL;
 using Ryujinx.Graphics.OpenGL.Image;
 using System;
 using System.Collections.Generic;
+using System.Threading;
 
 namespace Ryujinx.Graphics.OpenGL
 {
@@ -19,7 +20,7 @@ namespace Ryujinx.Graphics.OpenGL
     {
         private const int DisposedLiveFrames = 2;
 
-        private readonly object _lock = new();
+        private readonly Lock _lock = new();
         private readonly Dictionary<TextureCreateInfo, List<DisposedTexture>> _textures = new();
 
         /// <summary>

+ 0 - 1
src/Ryujinx.Graphics.OpenGL/Ryujinx.Graphics.OpenGL.csproj

@@ -1,7 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>net8.0</TargetFramework>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <DefaultItemExcludes>$(DefaultItemExcludes);._*</DefaultItemExcludes>
   </PropertyGroup>

+ 2 - 2
src/Ryujinx.Graphics.Shader/CodeGen/Spirv/SpirvGenerator.cs

@@ -4,6 +4,7 @@ using Ryujinx.Graphics.Shader.StructuredIr;
 using Ryujinx.Graphics.Shader.Translation;
 using System;
 using System.Collections.Generic;
+using System.Threading;
 using static Spv.Specification;
 
 namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
@@ -19,13 +20,12 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
         private const int GeneratorPoolCount = 1;
         private static readonly ObjectPool<SpvInstructionPool> _instructionPool;
         private static readonly ObjectPool<SpvLiteralIntegerPool> _integerPool;
-        private static readonly object _poolLock;
+        private static readonly Lock _poolLock = new();
 
         static SpirvGenerator()
         {
             _instructionPool = new(() => new SpvInstructionPool(), GeneratorPoolCount);
             _integerPool = new(() => new SpvLiteralIntegerPool(), GeneratorPoolCount);
-            _poolLock = new object();
         }
 
         private const HelperFunctionsMask NeedsInvocationIdMask = HelperFunctionsMask.SwizzleAdd;

+ 0 - 1
src/Ryujinx.Graphics.Shader/Ryujinx.Graphics.Shader.csproj

@@ -1,7 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>net8.0</TargetFramework>
     <DefaultItemExcludes>$(DefaultItemExcludes);._*</DefaultItemExcludes>
   </PropertyGroup>
 

+ 0 - 1
src/Ryujinx.Graphics.Texture/Ryujinx.Graphics.Texture.csproj

@@ -1,6 +1,5 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
-    <TargetFramework>net8.0</TargetFramework>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <DefaultItemExcludes>$(DefaultItemExcludes);._*</DefaultItemExcludes>
   </PropertyGroup>

+ 0 - 1
src/Ryujinx.Graphics.Vic/Ryujinx.Graphics.Vic.csproj

@@ -1,7 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>net8.0</TargetFramework>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <DefaultItemExcludes>$(DefaultItemExcludes);._*</DefaultItemExcludes>
   </PropertyGroup>

+ 0 - 1
src/Ryujinx.Graphics.Video/Ryujinx.Graphics.Video.csproj

@@ -1,7 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>net8.0</TargetFramework>
     <DefaultItemExcludes>$(DefaultItemExcludes);._*</DefaultItemExcludes>
   </PropertyGroup>
 

+ 1 - 1
src/Ryujinx.Graphics.Vulkan/BackgroundResources.cs

@@ -25,7 +25,7 @@ namespace Ryujinx.Graphics.Vulkan
             {
                 bool useBackground = _gd.BackgroundQueue.Handle != 0 && _gd.Vendor != Vendor.Amd;
                 Queue queue = useBackground ? _gd.BackgroundQueue : _gd.Queue;
-                object queueLock = useBackground ? _gd.BackgroundQueueLock : _gd.QueueLock;
+                Lock queueLock = useBackground ? _gd.BackgroundQueueLock : _gd.QueueLock;
 
                 lock (queueLock)
                 {

+ 2 - 2
src/Ryujinx.Graphics.Vulkan/CommandBufferPool.cs

@@ -17,7 +17,7 @@ namespace Ryujinx.Graphics.Vulkan
         private readonly Vk _api;
         private readonly Device _device;
         private readonly Queue _queue;
-        private readonly object _queueLock;
+        private readonly Lock _queueLock;
         private readonly bool _concurrentFenceWaitUnsupported;
         private readonly CommandPool _pool;
         private readonly Thread _owner;
@@ -63,7 +63,7 @@ namespace Ryujinx.Graphics.Vulkan
             Vk api,
             Device device,
             Queue queue,
-            object queueLock,
+            Lock queueLock,
             uint queueFamilyIndex,
             bool concurrentFenceWaitUnsupported,
             bool isLight = false)

+ 2 - 2
src/Ryujinx.Graphics.Vulkan/FormatCapabilities.cs

@@ -68,7 +68,7 @@ namespace Ryujinx.Graphics.Vulkan
             _optimalTable = new FormatFeatureFlags[totalFormats];
         }
 
-        public bool BufferFormatsSupport(FormatFeatureFlags flags, params Format[] formats)
+        public bool BufferFormatsSupport(FormatFeatureFlags flags, params ReadOnlySpan<Format> formats)
         {
             foreach (Format format in formats)
             {
@@ -81,7 +81,7 @@ namespace Ryujinx.Graphics.Vulkan
             return true;
         }
 
-        public bool OptimalFormatsSupport(FormatFeatureFlags flags, params Format[] formats)
+        public bool OptimalFormatsSupport(FormatFeatureFlags flags, params ReadOnlySpan<Format> formats)
         {
             foreach (Format format in formats)
             {

+ 2 - 1
src/Ryujinx.Graphics.Vulkan/HostMemoryAllocator.cs

@@ -5,6 +5,7 @@ using Silk.NET.Vulkan;
 using Silk.NET.Vulkan.Extensions.EXT;
 using System;
 using System.Collections.Generic;
+using System.Threading;
 
 namespace Ryujinx.Graphics.Vulkan
 {
@@ -31,7 +32,7 @@ namespace Ryujinx.Graphics.Vulkan
         private readonly Vk _api;
         private readonly ExtExternalMemoryHost _hostMemoryApi;
         private readonly Device _device;
-        private readonly object _lock = new();
+        private readonly Lock _lock = new();
 
         private readonly List<HostMemoryAllocation> _allocations;
         private readonly IntervalTree<ulong, HostMemoryAllocation> _allocationTree;

+ 1 - 1
src/Ryujinx.Graphics.Vulkan/Queries/CounterQueue.cs

@@ -24,7 +24,7 @@ namespace Ryujinx.Graphics.Vulkan.Queries
         private ulong _accumulatedCounter;
         private int _waiterCount;
 
-        private readonly object _lock = new();
+        private readonly Lock _lock = new();
 
         private readonly Queue<BufferedQuery> _queryPool;
         private readonly AutoResetEvent _queuedEvent = new(false);

+ 1 - 1
src/Ryujinx.Graphics.Vulkan/Queries/CounterQueueEvent.cs

@@ -22,7 +22,7 @@ namespace Ryujinx.Graphics.Vulkan.Queries
         private bool _hostAccessReserved;
         private int _refCount = 1; // Starts with a reference from the counter queue.
 
-        private readonly object _lock = new();
+        private readonly Lock _lock = new();
         private ulong _result = ulong.MaxValue;
         private double _divisor = 1f;
 

+ 0 - 1
src/Ryujinx.Graphics.Vulkan/Ryujinx.Graphics.Vulkan.csproj

@@ -1,7 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>net8.0</TargetFramework>
     <DefaultItemExcludes>$(DefaultItemExcludes);._*</DefaultItemExcludes>
   </PropertyGroup>
 

+ 2 - 1
src/Ryujinx.Graphics.Vulkan/Shader.cs

@@ -5,6 +5,7 @@ using shaderc;
 using Silk.NET.Vulkan;
 using System;
 using System.Runtime.InteropServices;
+using System.Threading;
 using System.Threading.Tasks;
 
 namespace Ryujinx.Graphics.Vulkan
@@ -13,7 +14,7 @@ namespace Ryujinx.Graphics.Vulkan
     {
         // The shaderc.net dependency's Options constructor and dispose are not thread safe.
         // Take this lock when using them.
-        private static readonly object _shaderOptionsLock = new();
+        private static readonly Lock _shaderOptionsLock = new();
 
         private static readonly nint _ptrMainEntryPointName = Marshal.StringToHGlobalAnsi("main");
 

+ 6 - 5
src/Ryujinx.Graphics.Vulkan/VulkanRenderer.cs

@@ -11,6 +11,7 @@ using Silk.NET.Vulkan.Extensions.KHR;
 using System;
 using System.Collections.Generic;
 using System.Runtime.InteropServices;
+using System.Threading;
 using Format = Ryujinx.Graphics.GAL.Format;
 using PrimitiveTopology = Ryujinx.Graphics.GAL.PrimitiveTopology;
 using SamplerCreateInfo = Ryujinx.Graphics.GAL.SamplerCreateInfo;
@@ -45,8 +46,8 @@ namespace Ryujinx.Graphics.Vulkan
         internal uint QueueFamilyIndex { get; private set; }
         internal Queue Queue { get; private set; }
         internal Queue BackgroundQueue { get; private set; }
-        internal object BackgroundQueueLock { get; private set; }
-        internal object QueueLock { get; private set; }
+        internal Lock BackgroundQueueLock { get; private set; }
+        internal Lock QueueLock { get; private set; }
 
         internal MemoryAllocator MemoryAllocator { get; private set; }
         internal HostMemoryAllocator HostMemoryAllocator { get; private set; }
@@ -120,7 +121,7 @@ namespace Ryujinx.Graphics.Vulkan
         }
 
         public static VulkanRenderer Create(
-            string preferredGpuId, 
+            string preferredGpuId,
             Func<Instance, Vk, SurfaceKHR> getSurface,
             Func<string[]> getRequiredExtensions
         ) => new(Vk.GetApi(), getSurface, getRequiredExtensions, preferredGpuId);
@@ -163,7 +164,7 @@ namespace Ryujinx.Graphics.Vulkan
             {
                 Api.GetDeviceQueue(_device, queueFamilyIndex, 1, out var backgroundQueue);
                 BackgroundQueue = backgroundQueue;
-                BackgroundQueueLock = new object();
+                BackgroundQueueLock = new();
             }
 
             PhysicalDeviceProperties2 properties2 = new()
@@ -496,7 +497,7 @@ namespace Ryujinx.Graphics.Vulkan
 
             Api.GetDeviceQueue(_device, queueFamilyIndex, 0, out var queue);
             Queue = queue;
-            QueueLock = new object();
+            QueueLock = new();
 
             LoadFeatures(maxQueueCount, queueFamilyIndex);
 

+ 11 - 10
src/Ryujinx.HLE/FileSystem/ContentManager.cs

@@ -22,6 +22,7 @@ using System.IO.Compression;
 using System.Linq;
 using System.Text;
 using System.Text.RegularExpressions;
+using System.Threading;
 using Path = System.IO.Path;
 
 namespace Ryujinx.HLE.FileSystem
@@ -55,7 +56,7 @@ namespace Ryujinx.HLE.FileSystem
 
         private readonly VirtualFileSystem _virtualFileSystem;
 
-        private readonly object _lock = new();
+        private readonly Lock _lock = new();
 
         public ContentManager(VirtualFileSystem virtualFileSystem)
         {
@@ -396,7 +397,7 @@ namespace Ryujinx.HLE.FileSystem
             if (locationList != null)
             {
                 LocationEntry entry =
-                    locationList.ToList().Find(x => x.TitleId == titleId && x.ContentType == contentType);
+                    locationList.ToList().FirstOrDefault(x => x.TitleId == titleId && x.ContentType == contentType);
 
                 if (entry.ContentPath != null)
                 {
@@ -424,7 +425,7 @@ namespace Ryujinx.HLE.FileSystem
         {
             LinkedList<LocationEntry> locationList = _locationEntries[storageId];
 
-            return locationList.ToList().Find(x => x.TitleId == titleId && x.ContentType == contentType);
+            return locationList.ToList().FirstOrDefault(x => x.TitleId == titleId && x.ContentType == contentType);
         }
 
         public void InstallFirmware(string firmwareSource)
@@ -719,7 +720,7 @@ namespace Ryujinx.HLE.FileSystem
 
                 if (updateNcas.TryGetValue(SystemUpdateTitleId, out var ncaEntry))
                 {
-                    string metaPath = ncaEntry.Find(x => x.type == NcaContentType.Meta).path;
+                    string metaPath = ncaEntry.FirstOrDefault(x => x.type == NcaContentType.Meta).path;
 
                     CnmtContentMetaEntry[] metaEntries = null;
 
@@ -755,7 +756,7 @@ namespace Ryujinx.HLE.FileSystem
 
                     if (updateNcas.TryGetValue(SystemVersionTitleId, out var updateNcasItem))
                     {
-                        string versionEntry = updateNcasItem.Find(x => x.type != NcaContentType.Meta).path;
+                        string versionEntry = updateNcasItem.FirstOrDefault(x => x.type != NcaContentType.Meta).path;
 
                         using Stream ncaStream = GetZipStream(archive.GetEntry(versionEntry));
                         Nca nca = new(_virtualFileSystem.KeySet, ncaStream.AsStorage());
@@ -774,9 +775,9 @@ namespace Ryujinx.HLE.FileSystem
                     {
                         if (updateNcas.TryGetValue(metaEntry.TitleId, out ncaEntry))
                         {
-                            metaPath = ncaEntry.Find(x => x.type == NcaContentType.Meta).path;
+                            metaPath = ncaEntry.FirstOrDefault(x => x.type == NcaContentType.Meta).path;
 
-                            string contentPath = ncaEntry.Find(x => x.type != NcaContentType.Meta).path;
+                            string contentPath = ncaEntry.FirstOrDefault(x => x.type != NcaContentType.Meta).path;
 
                             // Nintendo in 9.0.0, removed PPC and only kept the meta nca of it.
                             // This is a perfect valid case, so we should just ignore the missing content nca and continue.
@@ -915,8 +916,8 @@ namespace Ryujinx.HLE.FileSystem
                 {
                     if (updateNcas.TryGetValue(metaEntry.TitleId, out var ncaEntry))
                     {
-                        string metaNcaPath = ncaEntry.Find(x => x.type == NcaContentType.Meta).path;
-                        string contentPath = ncaEntry.Find(x => x.type != NcaContentType.Meta).path;
+                        string metaNcaPath = ncaEntry.FirstOrDefault(x => x.type == NcaContentType.Meta).path;
+                        string contentPath = ncaEntry.FirstOrDefault(x => x.type != NcaContentType.Meta).path;
 
                         // Nintendo in 9.0.0, removed PPC and only kept the meta nca of it.
                         // This is a perfect valid case, so we should just ignore the missing content nca and continue.
@@ -1076,7 +1077,7 @@ namespace Ryujinx.HLE.FileSystem
             {
                 if (File.Exists(Path.Combine(pathToCheck, file)))
                 {
-                    return true;                    
+                    return true;
                 }
             }
             return false;

+ 1 - 1
src/Ryujinx.HLE/FileSystem/ContentMetaData.cs

@@ -46,7 +46,7 @@ namespace Ryujinx.HLE.FileSystem
                     continue;
                 }
 
-                string ncaId = BitConverter.ToString(entry.NcaId).Replace("-", null).ToLower();
+                string ncaId = Convert.ToHexStringLower(entry.NcaId).Replace("-", null);
                 Nca nca = _pfs.GetNca(keySet, $"/{ncaId}.nca");
 
                 if (nca.GetProgramIndex() == programIndex)

+ 2 - 1
src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardApplet.cs

@@ -14,6 +14,7 @@ using System.IO;
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 using System.Text;
+using System.Threading;
 
 namespace Ryujinx.HLE.HOS.Applets
 {
@@ -62,7 +63,7 @@ namespace Ryujinx.HLE.HOS.Applets
         private bool _canAcceptController = false;
         private KeyboardInputMode _inputMode = KeyboardInputMode.ControllerAndKeyboard;
 
-        private readonly object _lock = new();
+        private readonly Lock _lock = new();
 
         public event EventHandler AppletStateChanged;
 

+ 2 - 1
src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardRendererBase.cs

@@ -6,6 +6,7 @@ using System.Diagnostics;
 using System.IO;
 using System.Reflection;
 using System.Runtime.InteropServices;
+using System.Threading;
 
 namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
 {
@@ -21,7 +22,7 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
         const string CancelText = "Cancel";
         const string ControllerToggleText = "Toggle input";
 
-        private readonly object _bufferLock = new();
+        private readonly Lock _bufferLock = new();
 
         private RenderingSurfaceInfo _surfaceInfo = null;
         private SKImageInfo _imageInfo;

+ 1 - 1
src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/TimedAction.cs

@@ -27,7 +27,7 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
 
         private TRef<bool> _cancelled = null;
         private Thread _thread = null;
-        private readonly object _lock = new();
+        private readonly Lock _lock = new();
 
         public bool IsRunning
         {

+ 2 - 3
src/Ryujinx.HLE/HOS/Kernel/Common/KResourceLimit.cs

@@ -2,6 +2,7 @@ using Ryujinx.Common;
 using Ryujinx.HLE.HOS.Kernel.Threading;
 using Ryujinx.Horizon.Common;
 using System.Collections.Generic;
+using System.Threading;
 
 namespace Ryujinx.HLE.HOS.Kernel.Common
 {
@@ -14,7 +15,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Common
         private readonly long[] _current2;
         private readonly long[] _peak;
 
-        private readonly object _lock;
+        private readonly object _lock = new();
 
         private readonly LinkedList<KThread> _waitingThreads;
 
@@ -27,8 +28,6 @@ namespace Ryujinx.HLE.HOS.Kernel.Common
             _current2 = new long[(int)LimitableResource.Count];
             _peak = new long[(int)LimitableResource.Count];
 
-            _lock = new object();
-
             _waitingThreads = new LinkedList<KThread>();
         }
 

+ 2 - 2
src/Ryujinx.HLE/HOS/Kernel/Memory/KCodeMemory.cs

@@ -4,6 +4,7 @@ using Ryujinx.HLE.HOS.Kernel.Process;
 using Ryujinx.Horizon.Common;
 using System;
 using System.Diagnostics;
+using System.Threading;
 
 namespace Ryujinx.HLE.HOS.Kernel.Memory
 {
@@ -11,7 +12,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
     {
         public KProcess Owner { get; private set; }
         private readonly KPageList _pageList;
-        private readonly object _lock;
+        private readonly Lock _lock = new();
         private ulong _address;
         private bool _isOwnerMapped;
         private bool _isMapped;
@@ -19,7 +20,6 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
         public KCodeMemory(KernelContext context) : base(context)
         {
             _pageList = new KPageList();
-            _lock = new object();
         }
 
         public Result Initialize(ulong address, ulong size)

+ 2 - 2
src/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs

@@ -40,8 +40,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
 
         public ProcessState State { get; private set; }
 
-        private readonly object _processLock = new();
-        private readonly object _threadingLock = new();
+        private readonly Lock _processLock = new();
+        private readonly Lock _threadingLock = new();
 
         public KAddressArbiter AddressArbiter { get; private set; }
 

+ 1 - 1
src/Ryujinx.HLE/HOS/Kernel/Threading/KAddressArbiter.cs

@@ -200,7 +200,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
 
             WakeThreads(_condVarThreads, count, TryAcquireMutex, x => x.CondVarAddress == address);
 
-            if (!_condVarThreads.Exists(x => x.CondVarAddress == address))
+            if (!_condVarThreads.Any(x => x.CondVarAddress == address))
             {
                 KernelTransfer.KernelToUser(address, 0);
             }

+ 1 - 2
src/Ryujinx.HLE/HOS/Kernel/Threading/KCriticalSection.cs

@@ -5,7 +5,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
     class KCriticalSection
     {
         private readonly KernelContext _context;
-        private readonly object _lock;
+        private readonly object _lock = new();
         private int _recursionCount;
 
         public object Lock => _lock;
@@ -13,7 +13,6 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
         public KCriticalSection(KernelContext context)
         {
             _context = context;
-            _lock = new object();
         }
 
         public void Enter()

+ 1 - 1
src/Ryujinx.HLE/HOS/Kernel/Threading/KThread.cs

@@ -112,7 +112,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
 
         public bool WaitingInArbitration { get; set; }
 
-        private readonly object _activityOperationLock = new();
+        private readonly Lock _activityOperationLock = new();
 
         public KThread(KernelContext context) : base(context)
         {

+ 19 - 13
src/Ryujinx.HLE/HOS/ModLoader.cs

@@ -168,7 +168,7 @@ namespace Ryujinx.HLE.HOS
 
                 if (StrEquals(RomfsDir, modDir.Name))
                 {
-                    var modData = modMetadata.Mods.Find(x => modDir.FullName.Contains(x.Path));
+                    var modData = modMetadata.Mods.FirstOrDefault(x => modDir.FullName.Contains(x.Path));
                     var enabled = modData?.Enabled ?? true;
 
                     mods.RomfsDirs.Add(mod = new Mod<DirectoryInfo>(dir.Name, modDir, enabled));
@@ -176,7 +176,7 @@ namespace Ryujinx.HLE.HOS
                 }
                 else if (StrEquals(ExefsDir, modDir.Name))
                 {
-                    var modData = modMetadata.Mods.Find(x => modDir.FullName.Contains(x.Path));
+                    var modData = modMetadata.Mods.FirstOrDefault(x => modDir.FullName.Contains(x.Path));
                     var enabled = modData?.Enabled ?? true;
 
                     mods.ExefsDirs.Add(mod = new Mod<DirectoryInfo>(dir.Name, modDir, enabled));
@@ -275,7 +275,7 @@ namespace Ryujinx.HLE.HOS
             var fsFile = new FileInfo(Path.Combine(applicationDir.FullName, RomfsContainer));
             if (fsFile.Exists)
             {
-                var modData = modMetadata.Mods.Find(x => fsFile.FullName.Contains(x.Path));
+                var modData = modMetadata.Mods.FirstOrDefault(x => fsFile.FullName.Contains(x.Path));
                 var enabled = modData == null || modData.Enabled;
 
                 mods.RomfsContainers.Add(new Mod<FileInfo>($"<{applicationDir.Name} RomFs>", fsFile, enabled));
@@ -284,7 +284,7 @@ namespace Ryujinx.HLE.HOS
             fsFile = new FileInfo(Path.Combine(applicationDir.FullName, ExefsContainer));
             if (fsFile.Exists)
             {
-                var modData = modMetadata.Mods.Find(x => fsFile.FullName.Contains(x.Path));
+                var modData = modMetadata.Mods.FirstOrDefault(x => fsFile.FullName.Contains(x.Path));
                 var enabled = modData == null || modData.Enabled;
 
                 mods.ExefsContainers.Add(new Mod<FileInfo>($"<{applicationDir.Name} ExeFs>", fsFile, enabled));
@@ -403,7 +403,7 @@ namespace Ryujinx.HLE.HOS
         }
 
         // Assumes searchDirPaths don't overlap
-        private static void CollectMods(Dictionary<ulong, ModCache> modCaches, PatchCache patches, params string[] searchDirPaths)
+        private static void CollectMods(Dictionary<ulong, ModCache> modCaches, PatchCache patches, params ReadOnlySpan<string> searchDirPaths)
         {
             static bool IsPatchesDir(string name) => StrEquals(AmsNsoPatchDir, name) ||
                                                      StrEquals(AmsNroPatchDir, name) ||
@@ -453,7 +453,7 @@ namespace Ryujinx.HLE.HOS
             patches.Initialized = true;
         }
 
-        public void CollectMods(IEnumerable<ulong> applications, params string[] searchDirPaths)
+        public void CollectMods(IEnumerable<ulong> applications, params ReadOnlySpan<string> searchDirPaths)
         {
             Clear();
 
@@ -680,7 +680,7 @@ namespace Ryujinx.HLE.HOS
             ApplyProgramPatches(nroPatches, 0, nro);
         }
 
-        internal bool ApplyNsoPatches(ulong applicationId, params IExecutable[] programs)
+        internal bool ApplyNsoPatches(ulong applicationId, params ReadOnlySpan<IExecutable> programs)
         {
             IEnumerable<Mod<DirectoryInfo>> nsoMods = _patches.NsoPatches;
 
@@ -744,7 +744,7 @@ namespace Ryujinx.HLE.HOS
             }
         }
 
-        private static bool ApplyProgramPatches(IEnumerable<Mod<DirectoryInfo>> mods, int protectedOffset, params IExecutable[] programs)
+        private static bool ApplyProgramPatches(IEnumerable<Mod<DirectoryInfo>> mods, int protectedOffset, params ReadOnlySpan<IExecutable> programs)
         {
             int count = 0;
 
@@ -755,12 +755,18 @@ namespace Ryujinx.HLE.HOS
                 patches[i] = new MemPatch();
             }
 
-            var buildIds = programs.Select(p => p switch
+            var buildIds = new List<string>(programs.Length);
+
+            foreach (IExecutable p in programs)
             {
-                NsoExecutable nso => Convert.ToHexString(nso.BuildId.ItemsRo.ToArray()).TrimEnd('0'),
-                NroExecutable nro => Convert.ToHexString(nro.Header.BuildId).TrimEnd('0'),
-                _ => string.Empty,
-            }).ToList();
+                var buildId = p switch
+                {
+                    NsoExecutable nso => Convert.ToHexString(nso.BuildId.ItemsRo.ToArray()).TrimEnd('0'),
+                    NroExecutable nro => Convert.ToHexString(nro.Header.BuildId).TrimEnd('0'),
+                    _ => string.Empty,
+                };
+                buildIds.Add(buildId);
+            }
 
             int GetIndex(string buildId) => buildIds.FindIndex(id => id == buildId); // O(n) but list is small
 

+ 2 - 1
src/Ryujinx.HLE/HOS/Services/Am/AppletAE/AllSystemAppletProxiesService/SystemAppletProxy/ISelfController.cs

@@ -4,6 +4,7 @@ using Ryujinx.HLE.HOS.Kernel.Threading;
 using Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy.Types;
 using Ryujinx.Horizon.Common;
 using System;
+using System.Threading;
 
 namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy
 {
@@ -17,7 +18,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.Sys
         private KEvent _accumulatedSuspendedTickChangedEvent;
         private int _accumulatedSuspendedTickChangedEventHandle;
 
-        private readonly object _fatalSectionLock = new();
+        private readonly Lock _fatalSectionLock = new();
         private int _fatalSectionCount;
 
         // TODO: Set this when the game goes in suspension (go back to home menu ect), we currently don't support that so we can keep it set to 0.

+ 1 - 1
src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/NpadDevices.cs

@@ -123,7 +123,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
             return true;
         }
 
-        public void Configure(params ControllerConfig[] configs)
+        public void Configure(params ReadOnlySpan<ControllerConfig> configs)
         {
             _configuredTypes = new ControllerType[MaxControllers];
 

+ 1 - 1
src/Ryujinx.HLE/HOS/Services/Hid/HidDevices/TouchDevice.cs

@@ -8,7 +8,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
     {
         public TouchDevice(Switch device, bool active) : base(device, active) { }
 
-        public void Update(params TouchPoint[] points)
+        public void Update(params ReadOnlySpan<TouchPoint> points)
         {
             ref RingLifo<TouchScreenState> lifo = ref _device.Hid.SharedMemory.TouchScreen;
 

+ 2 - 1
src/Ryujinx.HLE/HOS/Services/Ldn/Types/NodeLatestUpdate.cs

@@ -1,5 +1,6 @@
 using Ryujinx.Common.Memory;
 using System.Runtime.InteropServices;
+using System.Threading;
 
 namespace Ryujinx.HLE.HOS.Services.Ldn.Types
 {
@@ -12,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.Types
 
     static class NodeLatestUpdateHelper
     {
-        private static readonly object _lock = new();
+        private static readonly Lock _lock = new();
 
         public static void CalculateLatestUpdate(this Array8<NodeLatestUpdate> array, Array8<NodeInfo> beforeNodes, Array8<NodeInfo> afterNodes)
         {

+ 1 - 1
src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/LanDiscovery.cs

@@ -29,7 +29,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm
         private ILdnTcpSocket _tcp;
         private LdnProxyUdpServer _udp, _udp2;
         private readonly List<LdnProxyTcpSession> _stations = new();
-        private readonly object _lock = new();
+        private readonly Lock _lock = new();
 
         private readonly AutoResetEvent _apConnected = new(false);
 

+ 1 - 1
src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnMitm/Proxy/LdnProxyUdpServer.cs

@@ -18,7 +18,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnMitm.Proxy
         private byte[] _buffer;
         private int _bufferEnd;
 
-        private readonly object _scanLock = new();
+        private readonly Lock _scanLock = new();
 
         private Dictionary<ulong, NetworkInfo> _scanResultsLast = new();
         private Dictionary<ulong, NetworkInfo> _scanResults = new();

+ 1 - 1
src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnRyu/NetworkTimeout.cs

@@ -10,7 +10,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu
         private readonly Action _timeoutCallback;
         private CancellationTokenSource _cancel;
 
-        private readonly object _lock = new object();
+        private readonly Lock _lock = new();
 
         public NetworkTimeout(int idleTimeout, Action timeoutCallback)
         {

+ 2 - 1
src/Ryujinx.HLE/HOS/Services/Ldn/UserServiceCreator/LdnRyu/Proxy/EphemeralPortPool.cs

@@ -1,4 +1,5 @@
 using System.Collections.Generic;
+using System.Threading;
 
 namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu.Proxy
 {
@@ -8,7 +9,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldn.UserServiceCreator.LdnRyu.Proxy
 
         private readonly List<ushort> _ephemeralPorts = new List<ushort>();
 
-        private readonly object _lock = new object();
+        private readonly Lock _lock = new();
 
         public ushort Get()
         {

+ 4 - 3
src/Ryujinx.HLE/HOS/Services/Nfc/Nfp/VirtualAmiibo.cs

@@ -8,6 +8,7 @@ using Ryujinx.HLE.HOS.Services.Nfc.Nfp.NfpManager;
 using System;
 using System.Collections.Generic;
 using System.IO;
+using System.Linq;
 
 namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
 {
@@ -104,7 +105,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
         {
             VirtualAmiiboFile virtualAmiiboFile = LoadAmiiboFile(amiiboId);
 
-            if (virtualAmiiboFile.ApplicationAreas.Exists(item => item.ApplicationAreaId == applicationAreaId))
+            if (virtualAmiiboFile.ApplicationAreas.Any(item => item.ApplicationAreaId == applicationAreaId))
             {
                 _openedApplicationAreaId = applicationAreaId;
 
@@ -133,7 +134,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
         {
             VirtualAmiiboFile virtualAmiiboFile = LoadAmiiboFile(amiiboId);
 
-            if (virtualAmiiboFile.ApplicationAreas.Exists(item => item.ApplicationAreaId == applicationAreaId))
+            if (virtualAmiiboFile.ApplicationAreas.Any(item => item.ApplicationAreaId == applicationAreaId))
             {
                 return false;
             }
@@ -153,7 +154,7 @@ namespace Ryujinx.HLE.HOS.Services.Nfc.Nfp
         {
             VirtualAmiiboFile virtualAmiiboFile = LoadAmiiboFile(amiiboId);
 
-            if (virtualAmiiboFile.ApplicationAreas.Exists(item => item.ApplicationAreaId == _openedApplicationAreaId))
+            if (virtualAmiiboFile.ApplicationAreas.Any(item => item.ApplicationAreaId == _openedApplicationAreaId))
             {
                 for (int i = 0; i < virtualAmiiboFile.ApplicationAreas.Count; i++)
                 {

+ 1 - 1
src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/NvHostEvent.cs

@@ -26,7 +26,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl
         private NvFence _previousFailingFence;
         private uint _failingCount;
 
-        public readonly object Lock = new();
+        public readonly Lock Lock = new();
 
         /// <summary>
         /// Max failing count until waiting on CPU.

+ 1 - 1
src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/NvHostSyncPt.cs

@@ -17,7 +17,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl
 
         private readonly Switch _device;
 
-        private readonly object _syncpointAllocatorLock = new();
+        private readonly Lock _syncpointAllocatorLock = new();
 
         public NvHostSyncpt(Switch device)
         {

+ 2 - 1
src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/BsdContext.cs

@@ -3,6 +3,7 @@ using System;
 using System.Collections.Concurrent;
 using System.Collections.Generic;
 using System.Numerics;
+using System.Threading;
 
 namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
 {
@@ -10,7 +11,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
     {
         private static readonly ConcurrentDictionary<ulong, BsdContext> _registry = new();
 
-        private readonly object _lock = new();
+        private readonly Lock _lock = new();
 
         private readonly List<IFileDescriptor> _fds;
 

+ 2 - 1
src/Ryujinx.HLE/HOS/Services/Ssl/BuiltInCertificateManager.cs

@@ -16,6 +16,7 @@ using System.Collections.Generic;
 using System.IO;
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
+using System.Threading;
 
 namespace Ryujinx.HLE.HOS.Services.Ssl
 {
@@ -43,7 +44,7 @@ namespace Ryujinx.HLE.HOS.Services.Ssl
         private bool _initialized;
         private Dictionary<CaCertificateId, CertStoreEntry> _certificates;
 
-        private readonly object _lock = new();
+        private readonly Lock _lock = new();
 
         private struct CertStoreFileHeader
         {

+ 2 - 1
src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/ConsumerBase.cs

@@ -1,5 +1,6 @@
 using Ryujinx.HLE.HOS.Services.SurfaceFlinger.Types;
 using System;
+using System.Threading;
 
 namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
 {
@@ -23,7 +24,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
 
         protected BufferQueueConsumer Consumer;
 
-        protected readonly object Lock = new();
+        protected readonly Lock Lock = new();
 
         private readonly IConsumerListener _listener;
 

+ 2 - 1
src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/HOSBinderDriverServer.cs

@@ -2,6 +2,7 @@ using Ryujinx.Common.Logging;
 using Ryujinx.HLE.HOS.Kernel.Threading;
 using System;
 using System.Collections.Generic;
+using System.Threading;
 
 namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
 {
@@ -11,7 +12,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
 
         private static int _lastBinderId = 0;
 
-        private static readonly object _lock = new();
+        private static readonly Lock _lock = new();
 
         public static int RegisterBinderObject(IBinder binder)
         {

+ 1 - 1
src/Ryujinx.HLE/HOS/Services/SurfaceFlinger/SurfaceFlinger.cs

@@ -37,7 +37,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
         private int _swapInterval;
         private int _swapIntervalDelay;
 
-        private readonly object _lock = new();
+        private readonly Lock _lock = new();
 
         public long RenderLayerId { get; private set; }
 

+ 2 - 1
src/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZoneManager.cs

@@ -2,6 +2,7 @@ using Ryujinx.Common.Memory;
 using Ryujinx.HLE.HOS.Services.Time.Clock;
 using System;
 using System.IO;
+using System.Threading;
 
 namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
 {
@@ -13,7 +14,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
         private UInt128 _timeZoneRuleVersion;
         private uint _totalLocationNameCount;
         private SteadyClockTimePoint _timeZoneUpdateTimePoint;
-        private readonly object _lock = new();
+        private readonly Lock _lock = new();
 
         public TimeZoneManager()
         {

+ 11 - 6
src/Ryujinx.HLE/Loaders/Processes/ProcessLoaderHelper.cs

@@ -231,7 +231,7 @@ namespace Ryujinx.HLE.Loaders.Processes
             ulong programId,
             byte programIndex,
             byte[] arguments = null,
-            params IExecutable[] executables)
+            params ReadOnlySpan<IExecutable> executables)
         {
             context.Device.System.ServiceTable.WaitServicesReady();
 
@@ -251,12 +251,17 @@ namespace Ryujinx.HLE.Loaders.Processes
             ulong codeStart = ((meta.Flags & 1) != 0 ? 0x8000000UL : 0x200000UL) + CodeStartOffset;
             uint codeSize = 0;
 
-            var buildIds = executables.Select(e => (e switch
+            var buildIds = new string[executables.Length];
+
+            for (int i = 0; i < executables.Length; i++)
             {
-                NsoExecutable nso => Convert.ToHexString(nso.BuildId.ItemsRo.ToArray()),
-                NroExecutable nro => Convert.ToHexString(nro.Header.BuildId),
-                _ => string.Empty
-            }).ToUpper());
+                buildIds[i] = (executables[i] switch
+                {
+                    NsoExecutable nso => Convert.ToHexString(nso.BuildId.ItemsRo.ToArray()),
+                    NroExecutable nro => Convert.ToHexString(nro.Header.BuildId),
+                    _ => string.Empty
+                }).ToUpper();
+            }
 
             ulong[] nsoBase = new ulong[executables.Length];
 

+ 5 - 7
src/Ryujinx.HLE/PerformanceStatistics.cs

@@ -1,4 +1,5 @@
 using Ryujinx.Common;
+using System.Threading;
 using System.Timers;
 
 namespace Ryujinx.HLE
@@ -20,12 +21,12 @@ namespace Ryujinx.HLE
         private readonly long[] _framesRendered;
         private readonly double[] _percentTime;
 
-        private readonly object[] _frameLock;
-        private readonly object[] _percentLock;
+        private readonly Lock[] _frameLock = [new()];
+        private readonly Lock[] _percentLock = [new()];
 
         private readonly double _ticksToSeconds;
 
-        private readonly Timer _resetTimer;
+        private readonly System.Timers.Timer _resetTimer;
 
         public PerformanceStatistics()
         {
@@ -41,10 +42,7 @@ namespace Ryujinx.HLE
             _framesRendered = new long[1];
             _percentTime = new double[1];
 
-            _frameLock = new[] { new object() };
-            _percentLock = new[] { new object() };
-
-            _resetTimer = new Timer(750);
+            _resetTimer = new(750);
 
             _resetTimer.Elapsed += ResetTimerElapsed;
             _resetTimer.AutoReset = true;

+ 0 - 1
src/Ryujinx.HLE/Ryujinx.HLE.csproj

@@ -1,7 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>net8.0</TargetFramework>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <DefaultItemExcludes>$(DefaultItemExcludes);._*</DefaultItemExcludes>
   </PropertyGroup>

+ 0 - 1
src/Ryujinx.Headless.SDL2/Ryujinx.Headless.SDL2.csproj

@@ -1,7 +1,6 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>net8.0</TargetFramework>
     <RuntimeIdentifiers>win-x64;osx-x64;linux-x64</RuntimeIdentifiers>
     <OutputType>Exe</OutputType>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio