From 29e192f241136ce910071ff4fdedda5bd1d9b838 Mon Sep 17 00:00:00 2001 From: Zoltan Csizmadia Date: Wed, 15 Nov 2023 10:41:31 -0600 Subject: [PATCH] Migrate to .NET 8 (#5887) * Change TargetFramework to net8.0 * Disable info messages * Fix warings * Disable additional analyzer messages * Fix typo * Add whitespace * Fix ref vs in warnings * Use explicit [In] on array parameters * No need to guard Remove with Contains * Use 'ArgumentOutOfRangeException.ThrowIf...' instead of explicitly throwing a new exception instance * Bump .NET SDK version * Enable JsonSerializerIsReflectionEnabledByDefault * Use 8.0.100 GA release * Bump System package versions --------- Co-authored-by: Zoltan Csizmadia --- .editorconfig | 23 +++++++++++++++++ .github/workflows/build.yml | 4 +-- .github/workflows/release.yml | 2 +- Directory.Packages.props | 10 ++++---- README.md | 2 +- global.json | 4 +-- src/ARMeilleure/ARMeilleure.csproj | 2 +- .../Ryujinx.Audio.Backends.OpenAL.csproj | 2 +- .../Ryujinx.Audio.Backends.SDL2.csproj | 2 +- .../Ryujinx.Audio.Backends.SoundIo.csproj | 8 +++--- .../Renderer/Utils/SpanIOHelper.cs | 4 +-- src/Ryujinx.Audio/Ryujinx.Audio.csproj | 2 +- src/Ryujinx.Ava/Ryujinx.Ava.csproj | 16 +++++++++--- .../UI/Helpers/Win32NativeInterop.cs | 2 +- src/Ryujinx.Common/Ryujinx.Common.csproj | 2 +- src/Ryujinx.Cpu/Ryujinx.Cpu.csproj | 2 +- .../Ryujinx.Graphics.Device.csproj | 2 +- .../Ryujinx.Graphics.GAL.csproj | 2 +- .../Ryujinx.Graphics.Gpu.csproj | 2 +- .../Synchronization/SynchronizationManager.cs | 25 ++++--------------- .../Ryujinx.Graphics.Host1x.csproj | 2 +- .../Ryujinx.Graphics.Nvdec.FFmpeg.csproj | 2 +- .../Ryujinx.Graphics.Nvdec.Vp9.csproj | 2 +- .../Ryujinx.Graphics.Nvdec.csproj | 2 +- .../Ryujinx.Graphics.OpenGL.csproj | 2 +- .../IntermediateRepresentation/PhiNode.cs | 5 +--- .../Ryujinx.Graphics.Shader.csproj | 2 +- .../Ryujinx.Graphics.Texture.csproj | 2 +- .../Utils/RgbaColor32.cs | 9 ++++--- .../Ryujinx.Graphics.Vic.csproj | 2 +- .../Ryujinx.Graphics.Video.csproj | 2 +- src/Ryujinx.Graphics.Vulkan/PipelineBase.cs | 2 +- .../Ryujinx.Graphics.Vulkan.csproj | 2 +- .../VulkanException.cs | 4 --- .../ServiceNotImplementedException.cs | 2 -- src/Ryujinx.HLE/FileSystem/ContentManager.cs | 5 +--- .../NvHostCtrl/Types/NvHostSyncPt.cs | 5 +--- .../Services/Sockets/Bsd/Types/BsdMsgHdr.cs | 12 ++++----- .../Services/Sockets/Sfdnsres/IResolver.cs | 2 +- .../Sfdnsres/Types/AddrInfoSerialized.cs | 6 ++--- .../SslService/SslManagedSocketConnection.cs | 4 +-- src/Ryujinx.HLE/Ryujinx.HLE.csproj | 2 +- .../Ryujinx.Headless.SDL2.csproj | 8 +++--- .../Ryujinx.Horizon.Common.csproj | 2 +- src/Ryujinx.Horizon/Ryujinx.Horizon.csproj | 2 +- .../Ryujinx.Input.SDL2.csproj | 2 +- src/Ryujinx.Input/Ryujinx.Input.csproj | 2 +- src/Ryujinx.Memory/Range/MultiRange.cs | 10 ++------ src/Ryujinx.Memory/Ryujinx.Memory.csproj | 2 +- .../Ryujinx.SDL2.Common.csproj | 2 +- .../Ryujinx.ShaderTools.csproj | 2 +- .../Ryujinx.Tests.Memory.csproj | 2 +- .../Ryujinx.Tests.Unicorn.csproj | 2 +- src/Ryujinx.Tests/Ryujinx.Tests.csproj | 2 +- .../Ryujinx.Ui.Common.csproj | 2 +- src/Ryujinx/Ryujinx.csproj | 6 ++--- src/Spv.Generator/Spv.Generator.csproj | 2 +- 57 files changed, 121 insertions(+), 123 deletions(-) diff --git a/.editorconfig b/.editorconfig index 9d695c7f..db08c67e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -233,6 +233,29 @@ 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 "Collection initialization can be simplified" +dotnet_diagnostic.IDE0028.severity = none +dotnet_diagnostic.IDE0300.severity = none +dotnet_diagnostic.IDE0301.severity = none +dotnet_diagnostic.IDE0302.severity = none +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.HLE/HOS/Services/**.cs] # Disable "mark members as static" rule for services dotnet_diagnostic.CA1822.severity = none diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 16058d9f..7d46adc2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,7 +30,7 @@ jobs: - os: windows-latest OS_NAME: Windows x64 - DOTNET_RUNTIME_IDENTIFIER: win10-x64 + DOTNET_RUNTIME_IDENTIFIER: win-x64 RELEASE_ZIP_OS_NAME: win_x64 fail-fast: false @@ -155,4 +155,4 @@ jobs: with: name: sdl2-ryujinx-headless-${{ matrix.configuration }}-${{ env.RYUJINX_BASE_VERSION }}+${{ steps.git_short_hash.outputs.result }}-macos_universal path: "publish_headless/*.tar.gz" - if: github.event_name == 'pull_request' \ No newline at end of file + if: github.event_name == 'pull_request' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 008561f9..4dc1d091 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -59,7 +59,7 @@ jobs: - os: windows-latest OS_NAME: Windows x64 - DOTNET_RUNTIME_IDENTIFIER: win10-x64 + DOTNET_RUNTIME_IDENTIFIER: win-x64 RELEASE_ZIP_OS_NAME: win_x64 steps: - uses: actions/checkout@v4 diff --git a/Directory.Packages.props b/Directory.Packages.props index 009430f9..3d8aac1a 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -21,7 +21,7 @@ - + @@ -45,10 +45,10 @@ - - - - + + + + diff --git a/README.md b/README.md index b2a6646f..b2f95cc1 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ The latest automatic build for Windows, macOS, and Linux can be found on the [Of If you wish to build the emulator yourself, follow these steps: ### Step 1 -Install the X64 version of [.NET 7.0 (or higher) SDK](https://dotnet.microsoft.com/download/dotnet/7.0). +Install the X64 version of [.NET 8.0 (or higher) SDK](https://dotnet.microsoft.com/download/dotnet/8.0). ### Step 2 Either use `git clone https://github.com/Ryujinx/Ryujinx` on the command line to clone the repository or use Code --> Download zip button to get the files. diff --git a/global.json b/global.json index 39ccef0d..391ba3c2 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.200", + "version": "8.0.100", "rollForward": "latestFeature" } -} \ No newline at end of file +} diff --git a/src/ARMeilleure/ARMeilleure.csproj b/src/ARMeilleure/ARMeilleure.csproj index fa555115..550e50c2 100644 --- a/src/ARMeilleure/ARMeilleure.csproj +++ b/src/ARMeilleure/ARMeilleure.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 true diff --git a/src/Ryujinx.Audio.Backends.OpenAL/Ryujinx.Audio.Backends.OpenAL.csproj b/src/Ryujinx.Audio.Backends.OpenAL/Ryujinx.Audio.Backends.OpenAL.csproj index 115a3760..3863e443 100644 --- a/src/Ryujinx.Audio.Backends.OpenAL/Ryujinx.Audio.Backends.OpenAL.csproj +++ b/src/Ryujinx.Audio.Backends.OpenAL/Ryujinx.Audio.Backends.OpenAL.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 diff --git a/src/Ryujinx.Audio.Backends.SDL2/Ryujinx.Audio.Backends.SDL2.csproj b/src/Ryujinx.Audio.Backends.SDL2/Ryujinx.Audio.Backends.SDL2.csproj index 525f1f5b..dd18e70a 100644 --- a/src/Ryujinx.Audio.Backends.SDL2/Ryujinx.Audio.Backends.SDL2.csproj +++ b/src/Ryujinx.Audio.Backends.SDL2/Ryujinx.Audio.Backends.SDL2.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 true diff --git a/src/Ryujinx.Audio.Backends.SoundIo/Ryujinx.Audio.Backends.SoundIo.csproj b/src/Ryujinx.Audio.Backends.SoundIo/Ryujinx.Audio.Backends.SoundIo.csproj index 9f242dbe..1d92d9d2 100644 --- a/src/Ryujinx.Audio.Backends.SoundIo/Ryujinx.Audio.Backends.SoundIo.csproj +++ b/src/Ryujinx.Audio.Backends.SoundIo/Ryujinx.Audio.Backends.SoundIo.csproj @@ -1,9 +1,9 @@ - net7.0 + net8.0 true - win10-x64;linux-x64;osx-x64 + win-x64;osx-x64;linux-x64 @@ -15,11 +15,11 @@ PreserveNewest libsoundio.dll - + PreserveNewest libsoundio.dylib - + PreserveNewest libsoundio.so diff --git a/src/Ryujinx.Audio/Renderer/Utils/SpanIOHelper.cs b/src/Ryujinx.Audio/Renderer/Utils/SpanIOHelper.cs index 4771ae4d..abbb6ea6 100644 --- a/src/Ryujinx.Audio/Renderer/Utils/SpanIOHelper.cs +++ b/src/Ryujinx.Audio/Renderer/Utils/SpanIOHelper.cs @@ -25,7 +25,7 @@ namespace Ryujinx.Audio.Renderer.Utils throw new ArgumentOutOfRangeException(nameof(backingMemory), backingMemory.Length, null); } - MemoryMarshal.Write(backingMemory.Span[..size], ref data); + MemoryMarshal.Write(backingMemory.Span[..size], in data); backingMemory = backingMemory[size..]; } @@ -45,7 +45,7 @@ namespace Ryujinx.Audio.Renderer.Utils throw new ArgumentOutOfRangeException(nameof(backingMemory), backingMemory.Length, null); } - MemoryMarshal.Write(backingMemory[..size], ref data); + MemoryMarshal.Write(backingMemory[..size], in data); backingMemory = backingMemory[size..]; } diff --git a/src/Ryujinx.Audio/Ryujinx.Audio.csproj b/src/Ryujinx.Audio/Ryujinx.Audio.csproj index 4a159eb5..fc20f4ec 100644 --- a/src/Ryujinx.Audio/Ryujinx.Audio.csproj +++ b/src/Ryujinx.Audio/Ryujinx.Audio.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 true diff --git a/src/Ryujinx.Ava/Ryujinx.Ava.csproj b/src/Ryujinx.Ava/Ryujinx.Ava.csproj index f0e99f42..6812e57c 100644 --- a/src/Ryujinx.Ava/Ryujinx.Ava.csproj +++ b/src/Ryujinx.Ava/Ryujinx.Ava.csproj @@ -1,7 +1,7 @@  - net7.0 - win10-x64;osx-x64;linux-x64 + net8.0 + win-x64;osx-x64;linux-x64 Exe true 1.0.0-dirty @@ -25,6 +25,16 @@ partial + + + true + + @@ -40,7 +50,7 @@ - + diff --git a/src/Ryujinx.Ava/UI/Helpers/Win32NativeInterop.cs b/src/Ryujinx.Ava/UI/Helpers/Win32NativeInterop.cs index ca55d039..35d16b9e 100644 --- a/src/Ryujinx.Ava/UI/Helpers/Win32NativeInterop.cs +++ b/src/Ryujinx.Ava/UI/Helpers/Win32NativeInterop.cs @@ -86,7 +86,7 @@ namespace Ryujinx.Ava.UI.Helpers public static partial IntPtr SetCursor(IntPtr handle); [LibraryImport("user32.dll")] - public static partial IntPtr CreateCursor(IntPtr hInst, int xHotSpot, int yHotSpot, int nWidth, int nHeight, byte[] pvAndPlane, byte[] pvXorPlane); + public static partial IntPtr CreateCursor(IntPtr hInst, int xHotSpot, int yHotSpot, int nWidth, int nHeight, [In] byte[] pvAndPlane, [In] byte[] pvXorPlane); [LibraryImport("user32.dll", SetLastError = true, EntryPoint = "RegisterClassExW")] public static partial ushort RegisterClassEx(ref WndClassEx param); diff --git a/src/Ryujinx.Common/Ryujinx.Common.csproj b/src/Ryujinx.Common/Ryujinx.Common.csproj index c02b11e0..da2f13a2 100644 --- a/src/Ryujinx.Common/Ryujinx.Common.csproj +++ b/src/Ryujinx.Common/Ryujinx.Common.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 true $(DefineConstants);$(ExtraDefineConstants) diff --git a/src/Ryujinx.Cpu/Ryujinx.Cpu.csproj b/src/Ryujinx.Cpu/Ryujinx.Cpu.csproj index 7da8da25..5a6bf5c3 100644 --- a/src/Ryujinx.Cpu/Ryujinx.Cpu.csproj +++ b/src/Ryujinx.Cpu/Ryujinx.Cpu.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 true diff --git a/src/Ryujinx.Graphics.Device/Ryujinx.Graphics.Device.csproj b/src/Ryujinx.Graphics.Device/Ryujinx.Graphics.Device.csproj index 082dac9c..ae2821ed 100644 --- a/src/Ryujinx.Graphics.Device/Ryujinx.Graphics.Device.csproj +++ b/src/Ryujinx.Graphics.Device/Ryujinx.Graphics.Device.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/src/Ryujinx.Graphics.GAL/Ryujinx.Graphics.GAL.csproj b/src/Ryujinx.Graphics.GAL/Ryujinx.Graphics.GAL.csproj index 189108a3..d88b641a 100644 --- a/src/Ryujinx.Graphics.GAL/Ryujinx.Graphics.GAL.csproj +++ b/src/Ryujinx.Graphics.GAL/Ryujinx.Graphics.GAL.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/src/Ryujinx.Graphics.Gpu/Ryujinx.Graphics.Gpu.csproj b/src/Ryujinx.Graphics.Gpu/Ryujinx.Graphics.Gpu.csproj index 5255a6e0..6f1cce6a 100644 --- a/src/Ryujinx.Graphics.Gpu/Ryujinx.Graphics.Gpu.csproj +++ b/src/Ryujinx.Graphics.Gpu/Ryujinx.Graphics.Gpu.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 true diff --git a/src/Ryujinx.Graphics.Gpu/Synchronization/SynchronizationManager.cs b/src/Ryujinx.Graphics.Gpu/Synchronization/SynchronizationManager.cs index ccec763e..2d5eede5 100644 --- a/src/Ryujinx.Graphics.Gpu/Synchronization/SynchronizationManager.cs +++ b/src/Ryujinx.Graphics.Gpu/Synchronization/SynchronizationManager.cs @@ -37,10 +37,7 @@ namespace Ryujinx.Graphics.Gpu.Synchronization /// The incremented value of the syncpoint public uint IncrementSyncpoint(uint id) { - if (id >= MaxHardwareSyncpoints) - { - throw new ArgumentOutOfRangeException(nameof(id)); - } + ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(id, (uint)MaxHardwareSyncpoints); return _syncpoints[id].Increment(); } @@ -53,10 +50,7 @@ namespace Ryujinx.Graphics.Gpu.Synchronization /// The value of the syncpoint public uint GetSyncpointValue(uint id) { - if (id >= MaxHardwareSyncpoints) - { - throw new ArgumentOutOfRangeException(nameof(id)); - } + ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(id, (uint)MaxHardwareSyncpoints); return _syncpoints[id].Value; } @@ -72,10 +66,7 @@ namespace Ryujinx.Graphics.Gpu.Synchronization /// The created SyncpointWaiterHandle object or null if already past threshold public SyncpointWaiterHandle RegisterCallbackOnSyncpoint(uint id, uint threshold, Action callback) { - if (id >= MaxHardwareSyncpoints) - { - throw new ArgumentOutOfRangeException(nameof(id)); - } + ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(id, (uint)MaxHardwareSyncpoints); return _syncpoints[id].RegisterCallback(threshold, callback); } @@ -88,10 +79,7 @@ namespace Ryujinx.Graphics.Gpu.Synchronization /// Thrown when id >= MaxHardwareSyncpoints public void UnregisterCallback(uint id, SyncpointWaiterHandle waiterInformation) { - if (id >= MaxHardwareSyncpoints) - { - throw new ArgumentOutOfRangeException(nameof(id)); - } + ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(id, (uint)MaxHardwareSyncpoints); _syncpoints[id].UnregisterCallback(waiterInformation); } @@ -107,10 +95,7 @@ namespace Ryujinx.Graphics.Gpu.Synchronization /// True if timed out public bool WaitOnSyncpoint(uint id, uint threshold, TimeSpan timeout) { - if (id >= MaxHardwareSyncpoints) - { - throw new ArgumentOutOfRangeException(nameof(id)); - } + ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(id, (uint)MaxHardwareSyncpoints); // TODO: Remove this when GPU channel scheduling will be implemented. if (timeout == Timeout.InfiniteTimeSpan) diff --git a/src/Ryujinx.Graphics.Host1x/Ryujinx.Graphics.Host1x.csproj b/src/Ryujinx.Graphics.Host1x/Ryujinx.Graphics.Host1x.csproj index 3cff4061..22959fad 100644 --- a/src/Ryujinx.Graphics.Host1x/Ryujinx.Graphics.Host1x.csproj +++ b/src/Ryujinx.Graphics.Host1x/Ryujinx.Graphics.Host1x.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 diff --git a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Ryujinx.Graphics.Nvdec.FFmpeg.csproj b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Ryujinx.Graphics.Nvdec.FFmpeg.csproj index bff1e803..d1a6358c 100644 --- a/src/Ryujinx.Graphics.Nvdec.FFmpeg/Ryujinx.Graphics.Nvdec.FFmpeg.csproj +++ b/src/Ryujinx.Graphics.Nvdec.FFmpeg/Ryujinx.Graphics.Nvdec.FFmpeg.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 true diff --git a/src/Ryujinx.Graphics.Nvdec.Vp9/Ryujinx.Graphics.Nvdec.Vp9.csproj b/src/Ryujinx.Graphics.Nvdec.Vp9/Ryujinx.Graphics.Nvdec.Vp9.csproj index bff1e803..d1a6358c 100644 --- a/src/Ryujinx.Graphics.Nvdec.Vp9/Ryujinx.Graphics.Nvdec.Vp9.csproj +++ b/src/Ryujinx.Graphics.Nvdec.Vp9/Ryujinx.Graphics.Nvdec.Vp9.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 true diff --git a/src/Ryujinx.Graphics.Nvdec/Ryujinx.Graphics.Nvdec.csproj b/src/Ryujinx.Graphics.Nvdec/Ryujinx.Graphics.Nvdec.csproj index bfba98a7..fd49a7c8 100644 --- a/src/Ryujinx.Graphics.Nvdec/Ryujinx.Graphics.Nvdec.csproj +++ b/src/Ryujinx.Graphics.Nvdec/Ryujinx.Graphics.Nvdec.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 true diff --git a/src/Ryujinx.Graphics.OpenGL/Ryujinx.Graphics.OpenGL.csproj b/src/Ryujinx.Graphics.OpenGL/Ryujinx.Graphics.OpenGL.csproj index 2313cc68..3d64da99 100644 --- a/src/Ryujinx.Graphics.OpenGL/Ryujinx.Graphics.OpenGL.csproj +++ b/src/Ryujinx.Graphics.OpenGL/Ryujinx.Graphics.OpenGL.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 true diff --git a/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/PhiNode.cs b/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/PhiNode.cs index 6c95c7bd..f4c4fef4 100644 --- a/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/PhiNode.cs +++ b/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/PhiNode.cs @@ -69,10 +69,7 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation public Operand GetDest(int index) { - if (index != 0) - { - throw new ArgumentOutOfRangeException(nameof(index)); - } + ArgumentOutOfRangeException.ThrowIfNotEqual(index, 0); return _dest; } diff --git a/src/Ryujinx.Graphics.Shader/Ryujinx.Graphics.Shader.csproj b/src/Ryujinx.Graphics.Shader/Ryujinx.Graphics.Shader.csproj index ea9a7821..8ccf5348 100644 --- a/src/Ryujinx.Graphics.Shader/Ryujinx.Graphics.Shader.csproj +++ b/src/Ryujinx.Graphics.Shader/Ryujinx.Graphics.Shader.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 diff --git a/src/Ryujinx.Graphics.Texture/Ryujinx.Graphics.Texture.csproj b/src/Ryujinx.Graphics.Texture/Ryujinx.Graphics.Texture.csproj index 70e3453c..51721490 100644 --- a/src/Ryujinx.Graphics.Texture/Ryujinx.Graphics.Texture.csproj +++ b/src/Ryujinx.Graphics.Texture/Ryujinx.Graphics.Texture.csproj @@ -1,6 +1,6 @@ - net7.0 + net8.0 true diff --git a/src/Ryujinx.Graphics.Texture/Utils/RgbaColor32.cs b/src/Ryujinx.Graphics.Texture/Utils/RgbaColor32.cs index de7c9262..8ca3f89b 100644 --- a/src/Ryujinx.Graphics.Texture/Utils/RgbaColor32.cs +++ b/src/Ryujinx.Graphics.Texture/Utils/RgbaColor32.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.X86; @@ -102,11 +103,11 @@ namespace Ryujinx.Graphics.Texture.Utils } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static RgbaColor32 operator <<(RgbaColor32 x, int shift) + public static RgbaColor32 operator <<(RgbaColor32 x, [ConstantExpected] byte shift) { if (Sse2.IsSupported) { - return new RgbaColor32(Sse2.ShiftLeftLogical(x._color, (byte)shift)); + return new RgbaColor32(Sse2.ShiftLeftLogical(x._color, shift)); } else { @@ -115,11 +116,11 @@ namespace Ryujinx.Graphics.Texture.Utils } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static RgbaColor32 operator >>(RgbaColor32 x, int shift) + public static RgbaColor32 operator >>(RgbaColor32 x, [ConstantExpected] byte shift) { if (Sse2.IsSupported) { - return new RgbaColor32(Sse2.ShiftRightLogical(x._color, (byte)shift)); + return new RgbaColor32(Sse2.ShiftRightLogical(x._color, shift)); } else { diff --git a/src/Ryujinx.Graphics.Vic/Ryujinx.Graphics.Vic.csproj b/src/Ryujinx.Graphics.Vic/Ryujinx.Graphics.Vic.csproj index 2a7cdd98..cfebcfa2 100644 --- a/src/Ryujinx.Graphics.Vic/Ryujinx.Graphics.Vic.csproj +++ b/src/Ryujinx.Graphics.Vic/Ryujinx.Graphics.Vic.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 true diff --git a/src/Ryujinx.Graphics.Video/Ryujinx.Graphics.Video.csproj b/src/Ryujinx.Graphics.Video/Ryujinx.Graphics.Video.csproj index 9cf37670..abff58a5 100644 --- a/src/Ryujinx.Graphics.Video/Ryujinx.Graphics.Video.csproj +++ b/src/Ryujinx.Graphics.Video/Ryujinx.Graphics.Video.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 diff --git a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs index 156b3db1..7346d789 100644 --- a/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs +++ b/src/Ryujinx.Graphics.Vulkan/PipelineBase.cs @@ -189,7 +189,7 @@ namespace Ryujinx.Graphics.Vulkan PipelineStageFlags.AllCommandsBit, 0, 1, - new ReadOnlySpan(memoryBarrier), + new ReadOnlySpan(in memoryBarrier), 0, ReadOnlySpan.Empty, 0, diff --git a/src/Ryujinx.Graphics.Vulkan/Ryujinx.Graphics.Vulkan.csproj b/src/Ryujinx.Graphics.Vulkan/Ryujinx.Graphics.Vulkan.csproj index 8d30457e..f6a7be91 100644 --- a/src/Ryujinx.Graphics.Vulkan/Ryujinx.Graphics.Vulkan.csproj +++ b/src/Ryujinx.Graphics.Vulkan/Ryujinx.Graphics.Vulkan.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 diff --git a/src/Ryujinx.Graphics.Vulkan/VulkanException.cs b/src/Ryujinx.Graphics.Vulkan/VulkanException.cs index 983f03d4..2d9dbc34 100644 --- a/src/Ryujinx.Graphics.Vulkan/VulkanException.cs +++ b/src/Ryujinx.Graphics.Vulkan/VulkanException.cs @@ -33,9 +33,5 @@ namespace Ryujinx.Graphics.Vulkan public VulkanException(string message, Exception innerException) : base(message, innerException) { } - - protected VulkanException(SerializationInfo info, StreamingContext context) : base(info, context) - { - } } } diff --git a/src/Ryujinx.HLE/Exceptions/ServiceNotImplementedException.cs b/src/Ryujinx.HLE/Exceptions/ServiceNotImplementedException.cs index e43c838a..9cb1cf2c 100644 --- a/src/Ryujinx.HLE/Exceptions/ServiceNotImplementedException.cs +++ b/src/Ryujinx.HLE/Exceptions/ServiceNotImplementedException.cs @@ -35,8 +35,6 @@ namespace Ryujinx.HLE.Exceptions Request = context.Request; } - protected ServiceNotImplementedException(SerializationInfo info, StreamingContext context) : base(info, context) { } - public override string Message { get diff --git a/src/Ryujinx.HLE/FileSystem/ContentManager.cs b/src/Ryujinx.HLE/FileSystem/ContentManager.cs index 724cb675..b27eb5ea 100644 --- a/src/Ryujinx.HLE/FileSystem/ContentManager.cs +++ b/src/Ryujinx.HLE/FileSystem/ContentManager.cs @@ -420,10 +420,7 @@ namespace Ryujinx.HLE.FileSystem if (locationList != null) { - if (locationList.Contains(entry)) - { - locationList.Remove(entry); - } + locationList.Remove(entry); locationList.AddLast(entry); } diff --git a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/NvHostSyncPt.cs b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/NvHostSyncPt.cs index 9c6d025e..b83c642e 100644 --- a/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/NvHostSyncPt.cs +++ b/src/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostCtrl/Types/NvHostSyncPt.cs @@ -85,10 +85,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostCtrl public void SetSyncpointMinEqualSyncpointMax(uint id) { - if (id >= SynchronizationManager.MaxHardwareSyncpoints) - { - throw new ArgumentOutOfRangeException(nameof(id)); - } + ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(id, (uint)SynchronizationManager.MaxHardwareSyncpoints); int value = (int)ReadSyncpointValue(id); diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/BsdMsgHdr.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/BsdMsgHdr.cs index 07c97182..62a7ccb5 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/BsdMsgHdr.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/BsdMsgHdr.cs @@ -27,7 +27,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types int controlLength = message.Control == null ? 0 : message.Control.Length; BsdSocketFlags flags = message.Flags; - if (!MemoryMarshal.TryWrite(rawData, ref msgNameLength)) + if (!MemoryMarshal.TryWrite(rawData, in msgNameLength)) { return LinuxError.EFAULT; } @@ -45,7 +45,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types rawData = rawData[msgNameLength..]; } - if (!MemoryMarshal.TryWrite(rawData, ref iovCount)) + if (!MemoryMarshal.TryWrite(rawData, in iovCount)) { return LinuxError.EFAULT; } @@ -58,7 +58,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types { ulong iovLength = (ulong)message.Iov[index].Length; - if (!MemoryMarshal.TryWrite(rawData, ref iovLength)) + if (!MemoryMarshal.TryWrite(rawData, in iovLength)) { return LinuxError.EFAULT; } @@ -78,7 +78,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types } } - if (!MemoryMarshal.TryWrite(rawData, ref controlLength)) + if (!MemoryMarshal.TryWrite(rawData, in controlLength)) { return LinuxError.EFAULT; } @@ -96,14 +96,14 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types rawData = rawData[controlLength..]; } - if (!MemoryMarshal.TryWrite(rawData, ref flags)) + if (!MemoryMarshal.TryWrite(rawData, in flags)) { return LinuxError.EFAULT; } rawData = rawData[sizeof(BsdSocketFlags)..]; - if (!MemoryMarshal.TryWrite(rawData, ref message.Length)) + if (!MemoryMarshal.TryWrite(rawData, in message.Length)) { return LinuxError.EFAULT; } diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/IResolver.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/IResolver.cs index d0fb6675..39af9038 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/IResolver.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/IResolver.cs @@ -654,7 +654,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres } uint sentinel = 0; - MemoryMarshal.Write(data, ref sentinel); + MemoryMarshal.Write(data, in sentinel); data = data[sizeof(uint)..]; return region.Memory.Span.Length - data.Length; diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/Types/AddrInfoSerialized.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/Types/AddrInfoSerialized.cs index a0613d7b..b57b0d5c 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/Types/AddrInfoSerialized.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/Types/AddrInfoSerialized.cs @@ -94,7 +94,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres.Types Header.ToNetworkOrder(); - MemoryMarshal.Write(buffer, ref Header); + MemoryMarshal.Write(buffer, in Header); buffer = buffer[Unsafe.SizeOf()..]; @@ -103,7 +103,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres.Types AddrInfo4 socketAddress = SocketAddress.Value; socketAddress.ToNetworkOrder(); - MemoryMarshal.Write(buffer, ref socketAddress); + MemoryMarshal.Write(buffer, in socketAddress); buffer = buffer[Unsafe.SizeOf()..]; } @@ -117,7 +117,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres.Types Array4 rawIPv4Address = RawIPv4Address.Value; AddrInfo4.RawIpv4AddressNetworkEndianSwap(ref rawIPv4Address); - MemoryMarshal.Write(buffer, ref rawIPv4Address); + MemoryMarshal.Write(buffer, in rawIPv4Address); buffer = buffer[Unsafe.SizeOf>()..]; } diff --git a/src/Ryujinx.HLE/HOS/Services/Ssl/SslService/SslManagedSocketConnection.cs b/src/Ryujinx.HLE/HOS/Services/Ssl/SslService/SslManagedSocketConnection.cs index dab099aa..e3c05df5 100644 --- a/src/Ryujinx.HLE/HOS/Services/Ssl/SslService/SslManagedSocketConnection.cs +++ b/src/Ryujinx.HLE/HOS/Services/Ssl/SslService/SslManagedSocketConnection.cs @@ -161,7 +161,7 @@ namespace Ryujinx.HLE.HOS.Services.Ssl.SslService } else { - throw exception; + throw; } } finally @@ -206,7 +206,7 @@ namespace Ryujinx.HLE.HOS.Services.Ssl.SslService } else { - throw exception; + throw; } } finally diff --git a/src/Ryujinx.HLE/Ryujinx.HLE.csproj b/src/Ryujinx.HLE/Ryujinx.HLE.csproj index f3439cc8..370933cc 100644 --- a/src/Ryujinx.HLE/Ryujinx.HLE.csproj +++ b/src/Ryujinx.HLE/Ryujinx.HLE.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 diff --git a/src/Ryujinx.Headless.SDL2/Ryujinx.Headless.SDL2.csproj b/src/Ryujinx.Headless.SDL2/Ryujinx.Headless.SDL2.csproj index d2585c56..7b13df73 100644 --- a/src/Ryujinx.Headless.SDL2/Ryujinx.Headless.SDL2.csproj +++ b/src/Ryujinx.Headless.SDL2/Ryujinx.Headless.SDL2.csproj @@ -1,8 +1,8 @@  - net7.0 - win10-x64;osx-x64;linux-x64 + net8.0 + win-x64;osx-x64;linux-x64 Exe true 1.0.0-dirty @@ -34,7 +34,7 @@ - + @@ -69,4 +69,4 @@ true partial - \ No newline at end of file + diff --git a/src/Ryujinx.Horizon.Common/Ryujinx.Horizon.Common.csproj b/src/Ryujinx.Horizon.Common/Ryujinx.Horizon.Common.csproj index d04c5a9b..fa1544c4 100644 --- a/src/Ryujinx.Horizon.Common/Ryujinx.Horizon.Common.csproj +++ b/src/Ryujinx.Horizon.Common/Ryujinx.Horizon.Common.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 diff --git a/src/Ryujinx.Horizon/Ryujinx.Horizon.csproj b/src/Ryujinx.Horizon/Ryujinx.Horizon.csproj index 0139c367..ae40f7b5 100644 --- a/src/Ryujinx.Horizon/Ryujinx.Horizon.csproj +++ b/src/Ryujinx.Horizon/Ryujinx.Horizon.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 diff --git a/src/Ryujinx.Input.SDL2/Ryujinx.Input.SDL2.csproj b/src/Ryujinx.Input.SDL2/Ryujinx.Input.SDL2.csproj index 817a96e2..1ab79d08 100644 --- a/src/Ryujinx.Input.SDL2/Ryujinx.Input.SDL2.csproj +++ b/src/Ryujinx.Input.SDL2/Ryujinx.Input.SDL2.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 true diff --git a/src/Ryujinx.Input/Ryujinx.Input.csproj b/src/Ryujinx.Input/Ryujinx.Input.csproj index df462734..59a9eeb6 100644 --- a/src/Ryujinx.Input/Ryujinx.Input.csproj +++ b/src/Ryujinx.Input/Ryujinx.Input.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 true diff --git a/src/Ryujinx.Memory/Range/MultiRange.cs b/src/Ryujinx.Memory/Range/MultiRange.cs index 7011e528..5a0b4178 100644 --- a/src/Ryujinx.Memory/Range/MultiRange.cs +++ b/src/Ryujinx.Memory/Range/MultiRange.cs @@ -52,10 +52,7 @@ namespace Ryujinx.Memory.Range { if (HasSingleRange) { - if (_singleRange.Size - offset < size) - { - throw new ArgumentOutOfRangeException(nameof(size)); - } + ArgumentOutOfRangeException.ThrowIfGreaterThan(size, _singleRange.Size - offset); return new MultiRange(_singleRange.Address + offset, size); } @@ -108,10 +105,7 @@ namespace Ryujinx.Memory.Range { if (HasSingleRange) { - if (index != 0) - { - throw new ArgumentOutOfRangeException(nameof(index)); - } + ArgumentOutOfRangeException.ThrowIfNotEqual(index, 0); return _singleRange; } diff --git a/src/Ryujinx.Memory/Ryujinx.Memory.csproj b/src/Ryujinx.Memory/Ryujinx.Memory.csproj index 91e46e48..8310a3e5 100644 --- a/src/Ryujinx.Memory/Ryujinx.Memory.csproj +++ b/src/Ryujinx.Memory/Ryujinx.Memory.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 true diff --git a/src/Ryujinx.SDL2.Common/Ryujinx.SDL2.Common.csproj b/src/Ryujinx.SDL2.Common/Ryujinx.SDL2.Common.csproj index 955e6d3f..8e795304 100644 --- a/src/Ryujinx.SDL2.Common/Ryujinx.SDL2.Common.csproj +++ b/src/Ryujinx.SDL2.Common/Ryujinx.SDL2.Common.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 diff --git a/src/Ryujinx.ShaderTools/Ryujinx.ShaderTools.csproj b/src/Ryujinx.ShaderTools/Ryujinx.ShaderTools.csproj index 74b4ec2f..ab89fb5c 100644 --- a/src/Ryujinx.ShaderTools/Ryujinx.ShaderTools.csproj +++ b/src/Ryujinx.ShaderTools/Ryujinx.ShaderTools.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 Exe Debug;Release diff --git a/src/Ryujinx.Tests.Memory/Ryujinx.Tests.Memory.csproj b/src/Ryujinx.Tests.Memory/Ryujinx.Tests.Memory.csproj index 4dcb6962..f0506083 100644 --- a/src/Ryujinx.Tests.Memory/Ryujinx.Tests.Memory.csproj +++ b/src/Ryujinx.Tests.Memory/Ryujinx.Tests.Memory.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 false diff --git a/src/Ryujinx.Tests.Unicorn/Ryujinx.Tests.Unicorn.csproj b/src/Ryujinx.Tests.Unicorn/Ryujinx.Tests.Unicorn.csproj index d925546f..befacfb2 100644 --- a/src/Ryujinx.Tests.Unicorn/Ryujinx.Tests.Unicorn.csproj +++ b/src/Ryujinx.Tests.Unicorn/Ryujinx.Tests.Unicorn.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 true Debug;Release diff --git a/src/Ryujinx.Tests/Ryujinx.Tests.csproj b/src/Ryujinx.Tests/Ryujinx.Tests.csproj index ab331ce5..3be9787a 100644 --- a/src/Ryujinx.Tests/Ryujinx.Tests.csproj +++ b/src/Ryujinx.Tests/Ryujinx.Tests.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 Exe false diff --git a/src/Ryujinx.Ui.Common/Ryujinx.Ui.Common.csproj b/src/Ryujinx.Ui.Common/Ryujinx.Ui.Common.csproj index 3da47431..7aff09ff 100644 --- a/src/Ryujinx.Ui.Common/Ryujinx.Ui.Common.csproj +++ b/src/Ryujinx.Ui.Common/Ryujinx.Ui.Common.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 true diff --git a/src/Ryujinx/Ryujinx.csproj b/src/Ryujinx/Ryujinx.csproj index 5b5ed463..9890b761 100644 --- a/src/Ryujinx/Ryujinx.csproj +++ b/src/Ryujinx/Ryujinx.csproj @@ -1,8 +1,8 @@ - net7.0 - win10-x64;osx-x64;linux-x64 + net8.0 + win-x64;osx-x64;linux-x64 Exe true 1.0.0-dirty @@ -25,7 +25,7 @@ - + diff --git a/src/Spv.Generator/Spv.Generator.csproj b/src/Spv.Generator/Spv.Generator.csproj index 082dac9c..ae2821ed 100644 --- a/src/Spv.Generator/Spv.Generator.csproj +++ b/src/Spv.Generator/Spv.Generator.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0