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 9d695c7fb..db08c67e2 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 16058d9f8..7d46adc2c 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 008561f9c..4dc1d091d 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 009430f92..3d8aac1a7 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 b2a6646f5..b2f95cc1f 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 39ccef0d0..391ba3c2a 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 fa5551154..550e50c26 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 115a37601..3863e4439 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 525f1f5b6..dd18e70a1 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 9f242dbe2..1d92d9d2e 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 4771ae4dd..abbb6ea6c 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 4a159eb5c..fc20f4ec4 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 f0e99f427..6812e57c4 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 ca55d0399..35d16b9e0 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 c02b11e0c..da2f13a21 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 7da8da25a..5a6bf5c3d 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 082dac9c2..ae2821edb 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 189108a39..d88b641a3 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 5255a6e00..6f1cce6ac 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 ccec763e3..2d5eede58 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 3cff4061e..22959fad8 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 bff1e803b..d1a6358c2 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 bff1e803b..d1a6358c2 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 bfba98a73..fd49a7c80 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 2313cc68f..3d64da99b 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 6c95c7bdd..f4c4fef42 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 ea9a7821b..8ccf5348f 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 70e3453c3..51721490e 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 de7c9262d..8ca3f89bc 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 2a7cdd985..cfebcfa2a 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 9cf37670e..abff58a53 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 156b3db16..7346d7891 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 8d30457e2..f6a7be91e 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 983f03d4e..2d9dbc348 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 e43c838a2..9cb1cf2c7 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 724cb675c..b27eb5ead 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 9c6d025eb..b83c642e5 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 07c97182c..62a7ccb59 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 d0fb6675a..39af90383 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 a0613d7bc..b57b0d5ca 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 dab099aab..e3c05df51 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 f3439cc8f..370933ccf 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 d2585c563..7b13df736 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 d04c5a9b6..fa1544c4f 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 0139c367f..ae40f7b5e 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 817a96e2e..1ab79d08a 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 df462734f..59a9eeb61 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 7011e528e..5a0b4178a 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 91e46e48e..8310a3e5c 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 955e6d3f1..8e7953045 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 74b4ec2f7..ab89fb5c7 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 4dcb69623..f05060838 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 d925546fe..befacfb22 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 ab331ce58..3be9787a3 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 3da47431f..7aff09ff6 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 5b5ed4637..9890b761b 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 082dac9c2..ae2821edb 100644 --- a/src/Spv.Generator/Spv.Generator.csproj +++ b/src/Spv.Generator/Spv.Generator.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0