From c6d05301aae7509ea6a1ec29d39a72bac94d80b0 Mon Sep 17 00:00:00 2001 From: Mary-nyan Date: Wed, 9 Nov 2022 20:22:43 +0100 Subject: [PATCH] infra: Migrate to .NET 7 (#3795) * Update readme to mention .NET 7 * infra: Migrate to .NET 7 .NET 7 is still in preview but this prepare for the release coming up next month. * Use Random.Shared in CreateRandom * Move UInt128Utils.cs to Ryujinx.Common project * Fix inverted parameters in System.UInt128 constructor * Fix Visual Studio complains on Ryujinx.Graphics.Vic * time: Fix missing alignment enforcement in SystemClockContext Fixes at least Smash * time: Fix missing alignment enforcement in SteadyClockContext Fix games (like recent version of Smash) using time shared memory * Switch to .NET 7.0.100 release * Enable Tiered PGO * Ensure CreateId validity requirements are meet when doing random generation Also enforce correct packing layout for other Mii structures. This fix a Mario Kart 8 crashes related to the default Miis. --- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 2 +- ARMeilleure/ARMeilleure.csproj | 2 +- README.md | 2 +- .../Ryujinx.Audio.Backends.OpenAL.csproj | 2 +- .../Ryujinx.Audio.Backends.SDL2.csproj | 2 +- .../Ryujinx.Audio.Backends.SoundIo.csproj | 2 +- .../Server/Splitter/SplitterContext.cs | 4 +- Ryujinx.Audio/Ryujinx.Audio.csproj | 2 +- Ryujinx.Ava/Ryujinx.Ava.csproj | 4 +- .../Extensions/BinaryReaderExtensions.cs | 6 + Ryujinx.Common/Ryujinx.Common.csproj | 2 +- Ryujinx.Common/Utilities/SpanHelpers.cs | 16 +-- Ryujinx.Common/Utilities/UInt128Utils.cs | 17 +++ Ryujinx.Cpu/Ryujinx.Cpu.csproj | 2 +- .../Ryujinx.Graphics.Device.csproj | 2 +- .../Ryujinx.Graphics.GAL.csproj | 2 +- .../Image/TextureBindingsManager.cs | 8 +- .../Ryujinx.Graphics.Gpu.csproj | 2 +- .../Shader/HashTable/PartitionHashTable.cs | 2 +- .../Shader/HashTable/PartitionedHashTable.cs | 2 +- .../Shader/ShaderSpecializationState.cs | 10 +- .../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 +- .../Ryujinx.Graphics.Shader.csproj | 2 +- .../Translation/ShaderConfig.cs | 2 +- .../Translation/Translator.cs | 4 +- .../Translation/UInt128.cs | 112 ------------------ .../Ryujinx.Graphics.Texture.csproj | 2 +- Ryujinx.Graphics.Vic/Image/SurfaceReader.cs | 4 +- .../Ryujinx.Graphics.Vic.csproj | 2 +- .../Ryujinx.Graphics.Video.csproj | 2 +- .../Ryujinx.Graphics.Vulkan.csproj | 2 +- Ryujinx.HLE/FileSystem/ContentManager.cs | 8 +- Ryujinx.HLE/HOS/Horizon.cs | 4 +- .../HOS/Services/Account/Acc/Types/UserId.cs | 3 +- Ryujinx.HLE/HOS/Services/Mii/Helper.cs | 4 +- .../HOS/Services/Mii/Types/CharInfo.cs | 2 +- .../HOS/Services/Mii/Types/CreateId.cs | 13 +- .../HOS/Services/Mii/Types/StoreData.cs | 3 +- Ryujinx.HLE/HOS/Services/Mii/UtilityImpl.cs | 11 +- .../Nifm/StaticService/IGeneralService.cs | 4 +- .../Nifm/StaticService/Types/DnsSetting.cs | 9 +- .../StaticService/Types/IpAddressSetting.cs | 5 +- .../StaticService/Types/NetworkProfileData.cs | 2 +- .../Settings/ISystemSettingsServer.cs | 6 +- .../SslService/SslManagedSocketConnection.cs | 3 + .../Services/Time/Clock/SteadyClockCore.cs | 6 +- .../Time/Clock/Types/SteadyClockTimePoint.cs | 6 +- .../Time/Clock/Types/SystemClockContext.cs | 2 +- Ryujinx.HLE/HOS/Services/Time/TimeManager.cs | 2 +- .../Services/Time/TimeZone/TimeZoneManager.cs | 2 +- .../Services/Time/Types/SteadyClockContext.cs | 4 +- Ryujinx.HLE/Ryujinx.HLE.csproj | 2 +- Ryujinx.HLE/Utilities/UInt128.cs | 75 ------------ .../Ryujinx.Headless.SDL2.csproj | 4 +- Ryujinx.Input.SDL2/Ryujinx.Input.SDL2.csproj | 2 +- Ryujinx.Input/Ryujinx.Input.csproj | 4 +- .../Ryujinx.Memory.Tests.csproj | 2 +- Ryujinx.Memory/Ryujinx.Memory.csproj | 2 +- .../Ryujinx.SDL2.Common.csproj | 2 +- .../Ryujinx.ShaderTools.csproj | 2 +- .../Ryujinx.Tests.Unicorn.csproj | 2 +- Ryujinx.Tests/Ryujinx.Tests.csproj | 2 +- Ryujinx.Ui.Common/Ryujinx.Ui.Common.csproj | 2 +- Ryujinx/Ryujinx.csproj | 4 +- Spv.Generator/Spv.Generator.csproj | 2 +- global.json | 2 +- 71 files changed, 144 insertions(+), 301 deletions(-) create mode 100644 Ryujinx.Common/Utilities/UInt128Utils.cs delete mode 100644 Ryujinx.Graphics.Shader/Translation/UInt128.cs delete mode 100644 Ryujinx.HLE/Utilities/UInt128.cs diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6feb14b84a..0970d72882 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -51,7 +51,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-dotnet@v3 with: - dotnet-version: 6.0.x + dotnet-version: 7.0.x - name: Ensure NuGet Source uses: fabriciomurta/ensure-nuget-source@v1 - name: Get git short hash diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index af665d51c3..1b24ce3f6e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,7 +28,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-dotnet@v3 with: - dotnet-version: 6.0.x + dotnet-version: 7.0.x - name: Ensure NuGet Source uses: fabriciomurta/ensure-nuget-source@v1 - name: Clear diff --git a/ARMeilleure/ARMeilleure.csproj b/ARMeilleure/ARMeilleure.csproj index e29e33e891..bb3f47219a 100644 --- a/ARMeilleure/ARMeilleure.csproj +++ b/ARMeilleure/ARMeilleure.csproj @@ -1,7 +1,7 @@ - net6.0 + net7.0 true diff --git a/README.md b/README.md index 3b7e802f96..0b59dd3489 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,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 6.0 (or higher) SDK](https://dotnet.microsoft.com/download/dotnet/6.0). +Install the X64 version of [.NET 7.0 (or higher) SDK](https://dotnet.microsoft.com/download/dotnet/7.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/Ryujinx.Audio.Backends.OpenAL/Ryujinx.Audio.Backends.OpenAL.csproj b/Ryujinx.Audio.Backends.OpenAL/Ryujinx.Audio.Backends.OpenAL.csproj index f1e783e6e6..a29848cf39 100644 --- a/Ryujinx.Audio.Backends.OpenAL/Ryujinx.Audio.Backends.OpenAL.csproj +++ b/Ryujinx.Audio.Backends.OpenAL/Ryujinx.Audio.Backends.OpenAL.csproj @@ -1,7 +1,7 @@  - net6.0 + net7.0 diff --git a/Ryujinx.Audio.Backends.SDL2/Ryujinx.Audio.Backends.SDL2.csproj b/Ryujinx.Audio.Backends.SDL2/Ryujinx.Audio.Backends.SDL2.csproj index fa70d34102..525f1f5b6e 100644 --- a/Ryujinx.Audio.Backends.SDL2/Ryujinx.Audio.Backends.SDL2.csproj +++ b/Ryujinx.Audio.Backends.SDL2/Ryujinx.Audio.Backends.SDL2.csproj @@ -1,7 +1,7 @@ - net6.0 + net7.0 true diff --git a/Ryujinx.Audio.Backends.SoundIo/Ryujinx.Audio.Backends.SoundIo.csproj b/Ryujinx.Audio.Backends.SoundIo/Ryujinx.Audio.Backends.SoundIo.csproj index 1c8f7ad0e2..9f242dbe28 100644 --- a/Ryujinx.Audio.Backends.SoundIo/Ryujinx.Audio.Backends.SoundIo.csproj +++ b/Ryujinx.Audio.Backends.SoundIo/Ryujinx.Audio.Backends.SoundIo.csproj @@ -1,7 +1,7 @@ - net6.0 + net7.0 true win10-x64;linux-x64;osx-x64 diff --git a/Ryujinx.Audio/Renderer/Server/Splitter/SplitterContext.cs b/Ryujinx.Audio/Renderer/Server/Splitter/SplitterContext.cs index 72f19a672c..91877cdda0 100644 --- a/Ryujinx.Audio/Renderer/Server/Splitter/SplitterContext.cs +++ b/Ryujinx.Audio/Renderer/Server/Splitter/SplitterContext.cs @@ -150,7 +150,7 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter /// /// The splitter header. /// The raw data after the splitter header. - private void UpdateState(ref SplitterInParameterHeader inputHeader, ref ReadOnlySpan input) + private void UpdateState(scoped ref SplitterInParameterHeader inputHeader, ref ReadOnlySpan input) { for (int i = 0; i < inputHeader.SplitterCount; i++) { @@ -177,7 +177,7 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter /// /// The splitter header. /// The raw data after the splitter header. - private void UpdateData(ref SplitterInParameterHeader inputHeader, ref ReadOnlySpan input) + private void UpdateData(scoped ref SplitterInParameterHeader inputHeader, ref ReadOnlySpan input) { for (int i = 0; i < inputHeader.SplitterDestinationCount; i++) { diff --git a/Ryujinx.Audio/Ryujinx.Audio.csproj b/Ryujinx.Audio/Ryujinx.Audio.csproj index 2499bb44ee..4a159eb5c9 100644 --- a/Ryujinx.Audio/Ryujinx.Audio.csproj +++ b/Ryujinx.Audio/Ryujinx.Audio.csproj @@ -1,7 +1,7 @@  - net6.0 + net7.0 true diff --git a/Ryujinx.Ava/Ryujinx.Ava.csproj b/Ryujinx.Ava/Ryujinx.Ava.csproj index 551fa976fc..3b4d8cf02a 100644 --- a/Ryujinx.Ava/Ryujinx.Ava.csproj +++ b/Ryujinx.Ava/Ryujinx.Ava.csproj @@ -1,6 +1,6 @@  - net6.0 + net7.0 win10-x64;osx-x64;linux-x64 Exe true @@ -8,11 +8,13 @@ $(DefineConstants);$(ExtraDefineConstants) Ryujinx.Ava Ryujinx.ico + true true true + partial diff --git a/Ryujinx.Common/Extensions/BinaryReaderExtensions.cs b/Ryujinx.Common/Extensions/BinaryReaderExtensions.cs index 05c77fe9a2..2c24678d11 100644 --- a/Ryujinx.Common/Extensions/BinaryReaderExtensions.cs +++ b/Ryujinx.Common/Extensions/BinaryReaderExtensions.cs @@ -53,5 +53,11 @@ namespace Ryujinx.Common writer.Write(data); } + + public static void Write(this BinaryWriter writer, UInt128 value) + { + writer.Write((ulong)value); + writer.Write((ulong)(value >> 64)); + } } } diff --git a/Ryujinx.Common/Ryujinx.Common.csproj b/Ryujinx.Common/Ryujinx.Common.csproj index e0cc2d56c2..818e5ba332 100644 --- a/Ryujinx.Common/Ryujinx.Common.csproj +++ b/Ryujinx.Common/Ryujinx.Common.csproj @@ -1,7 +1,7 @@ - net6.0 + net7.0 true diff --git a/Ryujinx.Common/Utilities/SpanHelpers.cs b/Ryujinx.Common/Utilities/SpanHelpers.cs index 84c130233f..4765eab3a2 100644 --- a/Ryujinx.Common/Utilities/SpanHelpers.cs +++ b/Ryujinx.Common/Utilities/SpanHelpers.cs @@ -7,19 +7,19 @@ namespace Ryujinx.Common.Utilities public static class SpanHelpers { [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Span CreateSpan(ref T reference, int length) + public static Span CreateSpan(scoped ref T reference, int length) { return MemoryMarshal.CreateSpan(ref reference, length); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Span AsSpan(ref T reference) where T : unmanaged + public static Span AsSpan(scoped ref T reference) where T : unmanaged { return CreateSpan(ref reference, 1); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Span AsSpan(ref TStruct reference) + public static Span AsSpan(scoped ref TStruct reference) where TStruct : unmanaged where TSpan : unmanaged { return CreateSpan(ref Unsafe.As(ref reference), @@ -27,25 +27,25 @@ namespace Ryujinx.Common.Utilities } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Span AsByteSpan(ref T reference) where T : unmanaged + public static Span AsByteSpan(scoped ref T reference) where T : unmanaged { return CreateSpan(ref Unsafe.As(ref reference), Unsafe.SizeOf()); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static ReadOnlySpan CreateReadOnlySpan(ref T reference, int length) + public static ReadOnlySpan CreateReadOnlySpan(scoped ref T reference, int length) { return MemoryMarshal.CreateReadOnlySpan(ref reference, length); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static ReadOnlySpan AsReadOnlySpan(ref T reference) where T : unmanaged + public static ReadOnlySpan AsReadOnlySpan(scoped ref T reference) where T : unmanaged { return CreateReadOnlySpan(ref reference, 1); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static ReadOnlySpan AsReadOnlySpan(ref TStruct reference) + public static ReadOnlySpan AsReadOnlySpan(scoped ref TStruct reference) where TStruct : unmanaged where TSpan : unmanaged { return CreateReadOnlySpan(ref Unsafe.As(ref reference), @@ -53,7 +53,7 @@ namespace Ryujinx.Common.Utilities } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static ReadOnlySpan AsReadOnlyByteSpan(ref T reference) where T : unmanaged + public static ReadOnlySpan AsReadOnlyByteSpan(scoped ref T reference) where T : unmanaged { return CreateReadOnlySpan(ref Unsafe.As(ref reference), Unsafe.SizeOf()); } diff --git a/Ryujinx.Common/Utilities/UInt128Utils.cs b/Ryujinx.Common/Utilities/UInt128Utils.cs new file mode 100644 index 0000000000..8cc437d17f --- /dev/null +++ b/Ryujinx.Common/Utilities/UInt128Utils.cs @@ -0,0 +1,17 @@ +using System; + +namespace Ryujinx.Common.Utilities +{ + public static class UInt128Utils + { + public static UInt128 FromHex(string hex) + { + return new UInt128((ulong)Convert.ToInt64(hex.Substring(0, 16), 16), (ulong)Convert.ToInt64(hex.Substring(16), 16)); + } + + public static UInt128 CreateRandom() + { + return new UInt128((ulong)Random.Shared.NextInt64(), (ulong)Random.Shared.NextInt64()); + } + } +} \ No newline at end of file diff --git a/Ryujinx.Cpu/Ryujinx.Cpu.csproj b/Ryujinx.Cpu/Ryujinx.Cpu.csproj index 84972af118..7da8da25a1 100644 --- a/Ryujinx.Cpu/Ryujinx.Cpu.csproj +++ b/Ryujinx.Cpu/Ryujinx.Cpu.csproj @@ -1,7 +1,7 @@  - net6.0 + net7.0 true diff --git a/Ryujinx.Graphics.Device/Ryujinx.Graphics.Device.csproj b/Ryujinx.Graphics.Device/Ryujinx.Graphics.Device.csproj index fff78129b3..082dac9c23 100644 --- a/Ryujinx.Graphics.Device/Ryujinx.Graphics.Device.csproj +++ b/Ryujinx.Graphics.Device/Ryujinx.Graphics.Device.csproj @@ -1,7 +1,7 @@  - net6.0 + net7.0 diff --git a/Ryujinx.Graphics.GAL/Ryujinx.Graphics.GAL.csproj b/Ryujinx.Graphics.GAL/Ryujinx.Graphics.GAL.csproj index 725f48eab0..189108a399 100644 --- a/Ryujinx.Graphics.GAL/Ryujinx.Graphics.GAL.csproj +++ b/Ryujinx.Graphics.GAL/Ryujinx.Graphics.GAL.csproj @@ -1,7 +1,7 @@  - net6.0 + net7.0 diff --git a/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs b/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs index cd84024b3a..892d9f6a78 100644 --- a/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs +++ b/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs @@ -413,10 +413,10 @@ namespace Ryujinx.Graphics.Gpu.Image [MethodImpl(MethodImplOptions.AggressiveInlining)] private void UpdateCachedBuffer( int stageIndex, - ref int cachedTextureBufferIndex, - ref int cachedSamplerBufferIndex, - ref ReadOnlySpan cachedTextureBuffer, - ref ReadOnlySpan cachedSamplerBuffer, + scoped ref int cachedTextureBufferIndex, + scoped ref int cachedSamplerBufferIndex, + scoped ref ReadOnlySpan cachedTextureBuffer, + scoped ref ReadOnlySpan cachedSamplerBuffer, int textureBufferIndex, int samplerBufferIndex) { diff --git a/Ryujinx.Graphics.Gpu/Ryujinx.Graphics.Gpu.csproj b/Ryujinx.Graphics.Gpu/Ryujinx.Graphics.Gpu.csproj index 7b5d73b69f..5255a6e006 100644 --- a/Ryujinx.Graphics.Gpu/Ryujinx.Graphics.Gpu.csproj +++ b/Ryujinx.Graphics.Gpu/Ryujinx.Graphics.Gpu.csproj @@ -1,7 +1,7 @@  - net6.0 + net7.0 true diff --git a/Ryujinx.Graphics.Gpu/Shader/HashTable/PartitionHashTable.cs b/Ryujinx.Graphics.Gpu/Shader/HashTable/PartitionHashTable.cs index 9b5e8013eb..d7cb3d99ee 100644 --- a/Ryujinx.Graphics.Gpu/Shader/HashTable/PartitionHashTable.cs +++ b/Ryujinx.Graphics.Gpu/Shader/HashTable/PartitionHashTable.cs @@ -350,7 +350,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.HashTable /// The item on the table, if found, otherwise unmodified /// The data on the table, if found, otherwise unmodified /// Table lookup result - public SearchResult TryFindItem(ref SmartDataAccessor dataAccessor, int size, ref T item, ref byte[] data) + public SearchResult TryFindItem(scoped ref SmartDataAccessor dataAccessor, int size, scoped ref T item, scoped ref byte[] data) { if (_count == 0) { diff --git a/Ryujinx.Graphics.Gpu/Shader/HashTable/PartitionedHashTable.cs b/Ryujinx.Graphics.Gpu/Shader/HashTable/PartitionedHashTable.cs index 4c9cc4d407..f26fbdbb3d 100644 --- a/Ryujinx.Graphics.Gpu/Shader/HashTable/PartitionedHashTable.cs +++ b/Ryujinx.Graphics.Gpu/Shader/HashTable/PartitionedHashTable.cs @@ -91,7 +91,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.HashTable /// The item on the table, if found, otherwise unmodified /// The data on the table, if found, otherwise unmodified /// Table lookup result - public PartitionHashTable.SearchResult TryFindItem(ref SmartDataAccessor dataAccessor, ref T item, ref byte[] data) + public PartitionHashTable.SearchResult TryFindItem(scoped ref SmartDataAccessor dataAccessor, scoped ref T item, scoped ref byte[] data) { return _table.TryFindItem(ref dataAccessor, Size, ref item, ref data); } diff --git a/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs b/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs index a8047f08c0..28818304a9 100644 --- a/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs +++ b/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs @@ -552,11 +552,11 @@ namespace Ryujinx.Graphics.Gpu.Shader private static void UpdateCachedBuffer( GpuChannel channel, bool isCompute, - ref int cachedTextureBufferIndex, - ref int cachedSamplerBufferIndex, - ref ReadOnlySpan cachedTextureBuffer, - ref ReadOnlySpan cachedSamplerBuffer, - ref int cachedStageIndex, + scoped ref int cachedTextureBufferIndex, + scoped ref int cachedSamplerBufferIndex, + scoped ref ReadOnlySpan cachedTextureBuffer, + scoped ref ReadOnlySpan cachedSamplerBuffer, + scoped ref int cachedStageIndex, int textureBufferIndex, int samplerBufferIndex, int stageIndex) diff --git a/Ryujinx.Graphics.Host1x/Ryujinx.Graphics.Host1x.csproj b/Ryujinx.Graphics.Host1x/Ryujinx.Graphics.Host1x.csproj index 49ed1a5c57..3cff4061e9 100644 --- a/Ryujinx.Graphics.Host1x/Ryujinx.Graphics.Host1x.csproj +++ b/Ryujinx.Graphics.Host1x/Ryujinx.Graphics.Host1x.csproj @@ -1,7 +1,7 @@ - net6.0 + net7.0 diff --git a/Ryujinx.Graphics.Nvdec.FFmpeg/Ryujinx.Graphics.Nvdec.FFmpeg.csproj b/Ryujinx.Graphics.Nvdec.FFmpeg/Ryujinx.Graphics.Nvdec.FFmpeg.csproj index b30e6aea0f..bff1e803bd 100644 --- a/Ryujinx.Graphics.Nvdec.FFmpeg/Ryujinx.Graphics.Nvdec.FFmpeg.csproj +++ b/Ryujinx.Graphics.Nvdec.FFmpeg/Ryujinx.Graphics.Nvdec.FFmpeg.csproj @@ -1,7 +1,7 @@  - net6.0 + net7.0 true diff --git a/Ryujinx.Graphics.Nvdec.Vp9/Ryujinx.Graphics.Nvdec.Vp9.csproj b/Ryujinx.Graphics.Nvdec.Vp9/Ryujinx.Graphics.Nvdec.Vp9.csproj index b30e6aea0f..bff1e803bd 100644 --- a/Ryujinx.Graphics.Nvdec.Vp9/Ryujinx.Graphics.Nvdec.Vp9.csproj +++ b/Ryujinx.Graphics.Nvdec.Vp9/Ryujinx.Graphics.Nvdec.Vp9.csproj @@ -1,7 +1,7 @@  - net6.0 + net7.0 true diff --git a/Ryujinx.Graphics.Nvdec/Ryujinx.Graphics.Nvdec.csproj b/Ryujinx.Graphics.Nvdec/Ryujinx.Graphics.Nvdec.csproj index 68c0c2af13..bfba98a733 100644 --- a/Ryujinx.Graphics.Nvdec/Ryujinx.Graphics.Nvdec.csproj +++ b/Ryujinx.Graphics.Nvdec/Ryujinx.Graphics.Nvdec.csproj @@ -1,7 +1,7 @@  - net6.0 + net7.0 true diff --git a/Ryujinx.Graphics.OpenGL/Ryujinx.Graphics.OpenGL.csproj b/Ryujinx.Graphics.OpenGL/Ryujinx.Graphics.OpenGL.csproj index d84ab23687..c12d6ff267 100644 --- a/Ryujinx.Graphics.OpenGL/Ryujinx.Graphics.OpenGL.csproj +++ b/Ryujinx.Graphics.OpenGL/Ryujinx.Graphics.OpenGL.csproj @@ -1,7 +1,7 @@ - net6.0 + net7.0 true diff --git a/Ryujinx.Graphics.Shader/Ryujinx.Graphics.Shader.csproj b/Ryujinx.Graphics.Shader/Ryujinx.Graphics.Shader.csproj index eed27c94e2..3434e2a811 100644 --- a/Ryujinx.Graphics.Shader/Ryujinx.Graphics.Shader.csproj +++ b/Ryujinx.Graphics.Shader/Ryujinx.Graphics.Shader.csproj @@ -1,7 +1,7 @@ - net6.0 + net7.0 diff --git a/Ryujinx.Graphics.Shader/Translation/ShaderConfig.cs b/Ryujinx.Graphics.Shader/Translation/ShaderConfig.cs index 2274716018..c70ec16c64 100644 --- a/Ryujinx.Graphics.Shader/Translation/ShaderConfig.cs +++ b/Ryujinx.Graphics.Shader/Translation/ShaderConfig.cs @@ -254,7 +254,7 @@ namespace Ryujinx.Graphics.Shader.Translation UsedInputAttributes |= mask; _thisUsedInputAttributes |= mask; - ThisInputAttributesComponents |= UInt128.Pow2(index * 4 + component); + ThisInputAttributesComponents |= UInt128.One << (index * 4 + component); } public void SetInputUserAttributePerPatch(int index) diff --git a/Ryujinx.Graphics.Shader/Translation/Translator.cs b/Ryujinx.Graphics.Shader/Translation/Translator.cs index ff0de1bd0b..8741f8487d 100644 --- a/Ryujinx.Graphics.Shader/Translation/Translator.cs +++ b/Ryujinx.Graphics.Shader/Translation/Translator.cs @@ -190,10 +190,10 @@ namespace Ryujinx.Graphics.Shader.Translation UInt128 usedAttributes = context.Config.NextInputAttributesComponents; while (usedAttributes != UInt128.Zero) { - int index = usedAttributes.TrailingZeroCount(); + int index = (int)UInt128.TrailingZeroCount(usedAttributes); int vecIndex = index / 4; - usedAttributes &= ~UInt128.Pow2(index); + usedAttributes &= ~(UInt128.One << index); // We don't need to initialize passthrough attributes. if ((context.Config.PassthroughAttributes & (1 << vecIndex)) != 0) diff --git a/Ryujinx.Graphics.Shader/Translation/UInt128.cs b/Ryujinx.Graphics.Shader/Translation/UInt128.cs deleted file mode 100644 index ffbce77a1e..0000000000 --- a/Ryujinx.Graphics.Shader/Translation/UInt128.cs +++ /dev/null @@ -1,112 +0,0 @@ -using System; -using System.Numerics; - -namespace Ryujinx.Graphics.Shader.Translation -{ - struct UInt128 : IEquatable - { - public static UInt128 Zero => new UInt128() { _v0 = 0, _v1 = 0 }; - - private ulong _v0; - private ulong _v1; - - public UInt128(ulong low, ulong high) - { - _v0 = low; - _v1 = high; - } - - public int TrailingZeroCount() - { - int count = BitOperations.TrailingZeroCount(_v0); - if (count == 64) - { - count += BitOperations.TrailingZeroCount(_v1); - } - - return count; - } - - public static UInt128 Pow2(int x) - { - if (x >= 64) - { - return new UInt128(0, 1UL << (x - 64)); - } - - return new UInt128(1UL << x, 0); - } - - public static UInt128 operator ~(UInt128 x) - { - return new UInt128(~x._v0, ~x._v1); - } - - public static UInt128 operator &(UInt128 x, UInt128 y) - { - return new UInt128(x._v0 & y._v0, x._v1 & y._v1); - } - - public static UInt128 operator |(UInt128 x, UInt128 y) - { - return new UInt128(x._v0 | y._v0, x._v1 | y._v1); - } - - public static UInt128 operator <<(UInt128 x, int shift) - { - if (shift == 0) - { - return new UInt128(x._v0, x._v1); - } - else if (shift >= 64) - { - return new UInt128(0, x._v0 << (shift - 64)); - } - - ulong shiftOut = x._v0 >> (64 - shift); - - return new UInt128(x._v0 << shift, (x._v1 << shift) | shiftOut); - } - - public static UInt128 operator >>(UInt128 x, int shift) - { - if (shift == 0) - { - return new UInt128(x._v0, x._v1); - } - else if (shift >= 64) - { - return new UInt128(x._v1 >> (shift - 64), 0); - } - - ulong shiftOut = x._v1 & ((1UL << shift) - 1); - - return new UInt128((x._v0 >> shift) | (shiftOut << (64 - shift)), x._v1 >> shift); - } - - public static bool operator ==(UInt128 x, UInt128 y) - { - return x.Equals(y); - } - - public static bool operator !=(UInt128 x, UInt128 y) - { - return !x.Equals(y); - } - - public override bool Equals(object obj) - { - return obj is UInt128 other && Equals(other); - } - - public bool Equals(UInt128 other) - { - return _v0 == other._v0 && _v1 == other._v1; - } - - public override int GetHashCode() - { - return HashCode.Combine(_v0, _v1); - } - } -} \ No newline at end of file diff --git a/Ryujinx.Graphics.Texture/Ryujinx.Graphics.Texture.csproj b/Ryujinx.Graphics.Texture/Ryujinx.Graphics.Texture.csproj index 6af7e775e6..70e3453c35 100644 --- a/Ryujinx.Graphics.Texture/Ryujinx.Graphics.Texture.csproj +++ b/Ryujinx.Graphics.Texture/Ryujinx.Graphics.Texture.csproj @@ -1,6 +1,6 @@ - net6.0 + net7.0 true diff --git a/Ryujinx.Graphics.Vic/Image/SurfaceReader.cs b/Ryujinx.Graphics.Vic/Image/SurfaceReader.cs index dda766a582..d9717bf85a 100644 --- a/Ryujinx.Graphics.Vic/Image/SurfaceReader.cs +++ b/Ryujinx.Graphics.Vic/Image/SurfaceReader.cs @@ -229,8 +229,8 @@ namespace Ryujinx.Graphics.Vic.Image private static RentedBuffer ReadBuffer( ResourceManager rm, - ref SlotConfig config, - ref Array8 offsets, + scoped ref SlotConfig config, + scoped ref Array8 offsets, bool linear, int plane, int width, diff --git a/Ryujinx.Graphics.Vic/Ryujinx.Graphics.Vic.csproj b/Ryujinx.Graphics.Vic/Ryujinx.Graphics.Vic.csproj index 0e564d0293..2a7cdd9851 100644 --- a/Ryujinx.Graphics.Vic/Ryujinx.Graphics.Vic.csproj +++ b/Ryujinx.Graphics.Vic/Ryujinx.Graphics.Vic.csproj @@ -1,7 +1,7 @@ - net6.0 + net7.0 true diff --git a/Ryujinx.Graphics.Video/Ryujinx.Graphics.Video.csproj b/Ryujinx.Graphics.Video/Ryujinx.Graphics.Video.csproj index 484b71774c..9cf37670e7 100644 --- a/Ryujinx.Graphics.Video/Ryujinx.Graphics.Video.csproj +++ b/Ryujinx.Graphics.Video/Ryujinx.Graphics.Video.csproj @@ -1,7 +1,7 @@ - net6.0 + net7.0 diff --git a/Ryujinx.Graphics.Vulkan/Ryujinx.Graphics.Vulkan.csproj b/Ryujinx.Graphics.Vulkan/Ryujinx.Graphics.Vulkan.csproj index fe22f3f5f2..c98d664235 100644 --- a/Ryujinx.Graphics.Vulkan/Ryujinx.Graphics.Vulkan.csproj +++ b/Ryujinx.Graphics.Vulkan/Ryujinx.Graphics.Vulkan.csproj @@ -1,7 +1,7 @@  - net6.0 + net7.0 diff --git a/Ryujinx.HLE/FileSystem/ContentManager.cs b/Ryujinx.HLE/FileSystem/ContentManager.cs index 24945af283..652c24695d 100644 --- a/Ryujinx.HLE/FileSystem/ContentManager.cs +++ b/Ryujinx.HLE/FileSystem/ContentManager.cs @@ -9,10 +9,10 @@ using LibHac.Tools.FsSystem; using LibHac.Tools.FsSystem.NcaUtils; using LibHac.Tools.Ncm; using Ryujinx.Common.Logging; +using Ryujinx.Common.Utilities; using Ryujinx.HLE.Exceptions; using Ryujinx.HLE.HOS.Services.Ssl; using Ryujinx.HLE.HOS.Services.Time; -using Ryujinx.HLE.Utilities; using System; using System.Collections.Generic; using System.IO; @@ -293,7 +293,7 @@ namespace Ryujinx.HLE.FileSystem } aocStorage = new Nca(_virtualFileSystem.KeySet, ncaFile.Get.AsStorage()).OpenStorage(NcaSectionType.Data, integrityCheckLevel); - + return true; } @@ -354,7 +354,7 @@ namespace Ryujinx.HLE.FileSystem { if (_contentDictionary.ContainsKey((titleId, contentType))) { - return new UInt128(_contentDictionary[(titleId, contentType)]); + return UInt128Utils.FromHex(_contentDictionary[(titleId, contentType)]); } } @@ -407,7 +407,7 @@ namespace Ryujinx.HLE.FileSystem { return false; } - + string installedPath = _virtualFileSystem.SwitchPathToSystemPath(locationEntry.ContentPath); if (!string.IsNullOrWhiteSpace(installedPath)) diff --git a/Ryujinx.HLE/HOS/Horizon.cs b/Ryujinx.HLE/HOS/Horizon.cs index b93ebc0329..d2716beb6e 100644 --- a/Ryujinx.HLE/HOS/Horizon.cs +++ b/Ryujinx.HLE/HOS/Horizon.cs @@ -10,6 +10,7 @@ using Ryujinx.Audio.Integration; using Ryujinx.Audio.Output; using Ryujinx.Audio.Renderer.Device; using Ryujinx.Audio.Renderer.Server; +using Ryujinx.Common.Utilities; using Ryujinx.Cpu; using Ryujinx.Cpu.Jit; using Ryujinx.HLE.FileSystem; @@ -35,7 +36,6 @@ using Ryujinx.HLE.HOS.Services.SurfaceFlinger; using Ryujinx.HLE.HOS.Services.Time.Clock; using Ryujinx.HLE.HOS.SystemState; using Ryujinx.HLE.Loaders.Executables; -using Ryujinx.HLE.Utilities; using System; using System.Collections.Generic; using System.IO; @@ -201,7 +201,7 @@ namespace Ryujinx.HLE.HOS // TODO: use set:sys (and get external clock source id from settings) // TODO: use "time!standard_steady_clock_rtc_update_interval_minutes" and implement a worker thread to be accurate. - UInt128 clockSourceId = new UInt128(Guid.NewGuid().ToByteArray()); + UInt128 clockSourceId = UInt128Utils.CreateRandom(); IRtcManager.GetExternalRtcValue(out ulong rtcValue); // We assume the rtc is system time. diff --git a/Ryujinx.HLE/HOS/Services/Account/Acc/Types/UserId.cs b/Ryujinx.HLE/HOS/Services/Account/Acc/Types/UserId.cs index 85ddb4393b..8cf4bff16f 100644 --- a/Ryujinx.HLE/HOS/Services/Account/Acc/Types/UserId.cs +++ b/Ryujinx.HLE/HOS/Services/Account/Acc/Types/UserId.cs @@ -1,5 +1,4 @@ using LibHac.Account; -using Ryujinx.HLE.Utilities; using System; using System.IO; using System.Linq; @@ -83,7 +82,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc public readonly UInt128 ToUInt128() { - return new UInt128(Low, High); + return new UInt128((ulong)High, (ulong)Low); } } } \ No newline at end of file diff --git a/Ryujinx.HLE/HOS/Services/Mii/Helper.cs b/Ryujinx.HLE/HOS/Services/Mii/Helper.cs index 47debd59d2..b02bbfd18a 100644 --- a/Ryujinx.HLE/HOS/Services/Mii/Helper.cs +++ b/Ryujinx.HLE/HOS/Services/Mii/Helper.cs @@ -1,4 +1,4 @@ -using Ryujinx.HLE.Utilities; +using Ryujinx.Common.Utilities; using System; using System.Buffers.Binary; @@ -36,7 +36,7 @@ namespace Ryujinx.HLE.HOS.Services.Mii public static UInt128 GetDeviceId() { // FIXME: call set:sys GetMiiAuthorId - return new UInt128("5279754d69694e780000000000000000"); // RyuMiiNx + return UInt128Utils.FromHex("5279754d69694e780000000000000000"); // RyuMiiNx } public static ReadOnlySpan Ver3FacelineColorTable => new byte[] { 0, 1, 2, 3, 4, 5 }; diff --git a/Ryujinx.HLE/HOS/Services/Mii/Types/CharInfo.cs b/Ryujinx.HLE/HOS/Services/Mii/Types/CharInfo.cs index 98e0f3072e..256ec9e062 100644 --- a/Ryujinx.HLE/HOS/Services/Mii/Types/CharInfo.cs +++ b/Ryujinx.HLE/HOS/Services/Mii/Types/CharInfo.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Mii.Types { - [StructLayout(LayoutKind.Sequential, Size = 0x58)] + [StructLayout(LayoutKind.Sequential, Pack = 1, Size = 0x58)] struct CharInfo : IStoredData { public CreateId CreateId; diff --git a/Ryujinx.HLE/HOS/Services/Mii/Types/CreateId.cs b/Ryujinx.HLE/HOS/Services/Mii/Types/CreateId.cs index 630a8c9d32..c1a97f5263 100644 --- a/Ryujinx.HLE/HOS/Services/Mii/Types/CreateId.cs +++ b/Ryujinx.HLE/HOS/Services/Mii/Types/CreateId.cs @@ -1,20 +1,19 @@ -using Ryujinx.HLE.Utilities; -using System; +using System; using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Mii.Types { - [StructLayout(LayoutKind.Sequential, Size = 0x10)] + [StructLayout(LayoutKind.Sequential, Pack = 1, Size = 0x10)] struct CreateId : IEquatable { public UInt128 Raw; - public bool IsNull => Raw.IsNull; - public bool IsValid => !IsNull && (Raw.High & 0xC0) == 0x80; + public bool IsNull => Raw == UInt128.Zero; + public bool IsValid => !IsNull && ((Raw >> 64) & 0xC0) == 0x80; - public CreateId(byte[] data) + public CreateId(UInt128 raw) { - Raw = new UInt128(data); + Raw = raw; } public static bool operator ==(CreateId x, CreateId y) diff --git a/Ryujinx.HLE/HOS/Services/Mii/Types/StoreData.cs b/Ryujinx.HLE/HOS/Services/Mii/Types/StoreData.cs index 6b7e3e5a04..31c46bc09b 100644 --- a/Ryujinx.HLE/HOS/Services/Mii/Types/StoreData.cs +++ b/Ryujinx.HLE/HOS/Services/Mii/Types/StoreData.cs @@ -1,11 +1,12 @@ using LibHac.Common; using Ryujinx.HLE.Utilities; using System; +using System.Diagnostics; using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Mii.Types { - [StructLayout(LayoutKind.Sequential, Pack = 4, Size = Size)] + [StructLayout(LayoutKind.Sequential, Pack = 1, Size = Size)] struct StoreData : IStoredData { public const int Size = 0x44; diff --git a/Ryujinx.HLE/HOS/Services/Mii/UtilityImpl.cs b/Ryujinx.HLE/HOS/Services/Mii/UtilityImpl.cs index 8b7f331305..30b201f658 100644 --- a/Ryujinx.HLE/HOS/Services/Mii/UtilityImpl.cs +++ b/Ryujinx.HLE/HOS/Services/Mii/UtilityImpl.cs @@ -1,4 +1,5 @@ -using Ryujinx.Cpu; +using Ryujinx.Common.Utilities; +using Ryujinx.Cpu; using Ryujinx.HLE.HOS.Services.Mii.Types; using Ryujinx.HLE.HOS.Services.Time; using Ryujinx.HLE.HOS.Services.Time.Clock; @@ -62,7 +63,13 @@ namespace Ryujinx.HLE.HOS.Services.Mii public CreateId MakeCreateId() { - return new CreateId(Guid.NewGuid().ToByteArray()); + UInt128 value = UInt128Utils.CreateRandom(); + + // Ensure the random ID generated is valid as a create id. + value &= ~new UInt128(0xC0, 0); + value |= new UInt128(0x80, 0); + + return new CreateId(value); } } } diff --git a/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs b/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs index e04dd81349..4a0259e600 100644 --- a/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs +++ b/Ryujinx.HLE/HOS/Services/Nifm/StaticService/IGeneralService.cs @@ -1,8 +1,8 @@ using Ryujinx.Common; using Ryujinx.Common.Logging; +using Ryujinx.Common.Utilities; using Ryujinx.HLE.HOS.Services.Nifm.StaticService.GeneralService; using Ryujinx.HLE.HOS.Services.Nifm.StaticService.Types; -using Ryujinx.HLE.Utilities; using System; using System.Net.NetworkInformation; using System.Runtime.CompilerServices; @@ -78,7 +78,7 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService NetworkProfileData networkProfile = new NetworkProfileData { - Uuid = new UInt128(Guid.NewGuid().ToByteArray()) + Uuid = UInt128Utils.CreateRandom() }; networkProfile.IpSettingData.IpAddressSetting = new IpAddressSetting(interfaceProperties, unicastAddress); diff --git a/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/DnsSetting.cs b/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/DnsSetting.cs index 9092f6e08b..374558eab5 100644 --- a/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/DnsSetting.cs +++ b/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/DnsSetting.cs @@ -14,14 +14,7 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService.Types public DnsSetting(IPInterfaceProperties interfaceProperties) { - try - { - IsDynamicDnsEnabled = interfaceProperties.IsDynamicDnsEnabled; - } - catch (PlatformNotSupportedException) - { - IsDynamicDnsEnabled = false; - } + IsDynamicDnsEnabled = OperatingSystem.IsWindows() && interfaceProperties.IsDynamicDnsEnabled; if (interfaceProperties.DnsAddresses.Count == 0) { diff --git a/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/IpAddressSetting.cs b/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/IpAddressSetting.cs index 50e6b01c63..5bb046abea 100644 --- a/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/IpAddressSetting.cs +++ b/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/IpAddressSetting.cs @@ -1,4 +1,5 @@ -using System.Net.NetworkInformation; +using System; +using System.Net.NetworkInformation; using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService.Types @@ -14,7 +15,7 @@ namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService.Types public IpAddressSetting(IPInterfaceProperties interfaceProperties, UnicastIPAddressInformation unicastIPAddressInformation) { - IsDhcpEnabled = interfaceProperties.DhcpServerAddresses.Count != 0; + IsDhcpEnabled = !OperatingSystem.IsMacOS() && interfaceProperties.DhcpServerAddresses.Count != 0; Address = new IpV4Address(unicastIPAddressInformation.Address); IPv4Mask = new IpV4Address(unicastIPAddressInformation.IPv4Mask); GatewayAddress = new IpV4Address(interfaceProperties.GatewayAddresses[0].Address); diff --git a/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/NetworkProfileData.cs b/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/NetworkProfileData.cs index 3c86aed503..e270c10aee 100644 --- a/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/NetworkProfileData.cs +++ b/Ryujinx.HLE/HOS/Services/Nifm/StaticService/Types/NetworkProfileData.cs @@ -1,5 +1,5 @@ using Ryujinx.Common.Memory; -using Ryujinx.HLE.Utilities; +using System; using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Nifm.StaticService.Types diff --git a/Ryujinx.HLE/HOS/Services/Settings/ISystemSettingsServer.cs b/Ryujinx.HLE/HOS/Services/Settings/ISystemSettingsServer.cs index 1ce7bbfc13..7f32ce6bd9 100644 --- a/Ryujinx.HLE/HOS/Services/Settings/ISystemSettingsServer.cs +++ b/Ryujinx.HLE/HOS/Services/Settings/ISystemSettingsServer.cs @@ -5,9 +5,9 @@ using LibHac.Fs.Fsa; using LibHac.FsSystem; using LibHac.Ncm; using LibHac.Tools.FsSystem.NcaUtils; +using Ryujinx.Common; using Ryujinx.Common.Logging; using Ryujinx.HLE.HOS.SystemState; -using Ryujinx.HLE.Utilities; using System; using System.IO; using System.Text; @@ -290,9 +290,7 @@ namespace Ryujinx.HLE.HOS.Services.Settings // NOTE: If miiAuthorId is null ResultCode.NullMiiAuthorIdBuffer is returned. // Doesn't occur in our case. - UInt128 miiAuthorId = Mii.Helper.GetDeviceId(); - - miiAuthorId.Write(context.ResponseData); + context.ResponseData.Write(Mii.Helper.GetDeviceId()); return ResultCode.Success; } diff --git a/Ryujinx.HLE/HOS/Services/Ssl/SslService/SslManagedSocketConnection.cs b/Ryujinx.HLE/HOS/Services/Ssl/SslService/SslManagedSocketConnection.cs index 36c8b51a71..56bfa709b2 100644 --- a/Ryujinx.HLE/HOS/Services/Ssl/SslService/SslManagedSocketConnection.cs +++ b/Ryujinx.HLE/HOS/Services/Ssl/SslService/SslManagedSocketConnection.cs @@ -66,6 +66,8 @@ namespace Ryujinx.HLE.HOS.Services.Ssl.SslService EndSslOperation(); } +// NOTE: We silence warnings about TLS 1.0 and 1.1 as games will likely use it. +#pragma warning disable SYSLIB0039 private static SslProtocols TranslateSslVersion(SslVersion version) { switch (version & SslVersion.VersionMask) @@ -84,6 +86,7 @@ namespace Ryujinx.HLE.HOS.Services.Ssl.SslService throw new NotImplementedException(version.ToString()); } } +#pragma warning restore SYSLIB0039 public ResultCode Handshake(string hostName) { diff --git a/Ryujinx.HLE/HOS/Services/Time/Clock/SteadyClockCore.cs b/Ryujinx.HLE/HOS/Services/Time/Clock/SteadyClockCore.cs index 4bb19e752f..18da4ed3e2 100644 --- a/Ryujinx.HLE/HOS/Services/Time/Clock/SteadyClockCore.cs +++ b/Ryujinx.HLE/HOS/Services/Time/Clock/SteadyClockCore.cs @@ -1,5 +1,5 @@ -using Ryujinx.Cpu; -using Ryujinx.HLE.Utilities; +using Ryujinx.Common.Utilities; +using Ryujinx.Cpu; using System; namespace Ryujinx.HLE.HOS.Services.Time.Clock @@ -12,7 +12,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.Clock public SteadyClockCore() { - _clockSourceId = new UInt128(Guid.NewGuid().ToByteArray()); + _clockSourceId = UInt128Utils.CreateRandom(); _isRtcResetDetected = false; _isInitialized = false; } diff --git a/Ryujinx.HLE/HOS/Services/Time/Clock/Types/SteadyClockTimePoint.cs b/Ryujinx.HLE/HOS/Services/Time/Clock/Types/SteadyClockTimePoint.cs index 71fb45212f..729e11b6b0 100644 --- a/Ryujinx.HLE/HOS/Services/Time/Clock/Types/SteadyClockTimePoint.cs +++ b/Ryujinx.HLE/HOS/Services/Time/Clock/Types/SteadyClockTimePoint.cs @@ -1,10 +1,10 @@ -using Ryujinx.HLE.Utilities; +using Ryujinx.Common.Utilities; using System; using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Time.Clock { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct SteadyClockTimePoint { public long TimePoint; @@ -36,7 +36,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.Clock return new SteadyClockTimePoint { TimePoint = 0, - ClockSourceId = new UInt128(Guid.NewGuid().ToByteArray()) + ClockSourceId = UInt128Utils.CreateRandom() }; } } diff --git a/Ryujinx.HLE/HOS/Services/Time/Clock/Types/SystemClockContext.cs b/Ryujinx.HLE/HOS/Services/Time/Clock/Types/SystemClockContext.cs index 38e10480ef..6b589c28ac 100644 --- a/Ryujinx.HLE/HOS/Services/Time/Clock/Types/SystemClockContext.cs +++ b/Ryujinx.HLE/HOS/Services/Time/Clock/Types/SystemClockContext.cs @@ -2,7 +2,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.Clock { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct SystemClockContext { public long Offset; diff --git a/Ryujinx.HLE/HOS/Services/Time/TimeManager.cs b/Ryujinx.HLE/HOS/Services/Time/TimeManager.cs index ac9f0880bd..e3b65f2add 100644 --- a/Ryujinx.HLE/HOS/Services/Time/TimeManager.cs +++ b/Ryujinx.HLE/HOS/Services/Time/TimeManager.cs @@ -3,7 +3,7 @@ using Ryujinx.HLE.Exceptions; using Ryujinx.HLE.HOS.Kernel.Memory; using Ryujinx.HLE.HOS.Services.Time.Clock; using Ryujinx.HLE.HOS.Services.Time.TimeZone; -using Ryujinx.HLE.Utilities; +using System; using System.IO; namespace Ryujinx.HLE.HOS.Services.Time diff --git a/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZoneManager.cs b/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZoneManager.cs index 736bc1025f..ef4b7b3992 100644 --- a/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZoneManager.cs +++ b/Ryujinx.HLE/HOS/Services/Time/TimeZone/TimeZoneManager.cs @@ -1,6 +1,6 @@ using Ryujinx.Common.Memory; using Ryujinx.HLE.HOS.Services.Time.Clock; -using Ryujinx.HLE.Utilities; +using System; using System.IO; namespace Ryujinx.HLE.HOS.Services.Time.TimeZone diff --git a/Ryujinx.HLE/HOS/Services/Time/Types/SteadyClockContext.cs b/Ryujinx.HLE/HOS/Services/Time/Types/SteadyClockContext.cs index 4cf1fc9918..38d37055c8 100644 --- a/Ryujinx.HLE/HOS/Services/Time/Types/SteadyClockContext.cs +++ b/Ryujinx.HLE/HOS/Services/Time/Types/SteadyClockContext.cs @@ -1,9 +1,9 @@ -using Ryujinx.HLE.Utilities; +using System; using System.Runtime.InteropServices; namespace Ryujinx.HLE.HOS.Services.Time.Types { - [StructLayout(LayoutKind.Sequential)] + [StructLayout(LayoutKind.Sequential, Pack = 1)] struct SteadyClockContext { public ulong InternalOffset; diff --git a/Ryujinx.HLE/Ryujinx.HLE.csproj b/Ryujinx.HLE/Ryujinx.HLE.csproj index c04ba7cf41..bdcbaca86f 100644 --- a/Ryujinx.HLE/Ryujinx.HLE.csproj +++ b/Ryujinx.HLE/Ryujinx.HLE.csproj @@ -1,7 +1,7 @@  - net6.0 + net7.0 diff --git a/Ryujinx.HLE/Utilities/UInt128.cs b/Ryujinx.HLE/Utilities/UInt128.cs deleted file mode 100644 index 22d87f6b17..0000000000 --- a/Ryujinx.HLE/Utilities/UInt128.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices; - -namespace Ryujinx.HLE.Utilities -{ - [StructLayout(LayoutKind.Sequential)] - public struct UInt128 : IEquatable - { - public readonly long Low; - public readonly long High; - - public bool IsNull => (Low | High) == 0; - - public UInt128(long low, long high) - { - Low = low; - High = high; - } - - public UInt128(byte[] bytes) - { - Low = BitConverter.ToInt64(bytes, 0); - High = BitConverter.ToInt64(bytes, 8); - } - - public UInt128(string hex) - { - if (hex == null || hex.Length != 32 || !hex.All("0123456789abcdefABCDEF".Contains)) - { - throw new ArgumentException("Invalid Hex value!", nameof(hex)); - } - - Low = Convert.ToInt64(hex.Substring(16), 16); - High = Convert.ToInt64(hex.Substring(0, 16), 16); - } - - public void Write(BinaryWriter binaryWriter) - { - binaryWriter.Write(Low); - binaryWriter.Write(High); - } - - public override string ToString() - { - return High.ToString("x16") + Low.ToString("x16"); - } - - public static bool operator ==(UInt128 x, UInt128 y) - { - return x.Equals(y); - } - - public static bool operator !=(UInt128 x, UInt128 y) - { - return !x.Equals(y); - } - - public override bool Equals(object obj) - { - return obj is UInt128 uint128 && Equals(uint128); - } - - public bool Equals(UInt128 cmpObj) - { - return Low == cmpObj.Low && High == cmpObj.High; - } - - public override int GetHashCode() - { - return HashCode.Combine(Low, High); - } - } -} \ No newline at end of file diff --git a/Ryujinx.Headless.SDL2/Ryujinx.Headless.SDL2.csproj b/Ryujinx.Headless.SDL2/Ryujinx.Headless.SDL2.csproj index 929b4131ce..a9d227c638 100644 --- a/Ryujinx.Headless.SDL2/Ryujinx.Headless.SDL2.csproj +++ b/Ryujinx.Headless.SDL2/Ryujinx.Headless.SDL2.csproj @@ -1,12 +1,13 @@  - net6.0 + net7.0 win10-x64;osx-x64;linux-x64 Exe true 1.0.0-dirty $(DefineConstants);$(ExtraDefineConstants) + true @@ -46,5 +47,6 @@ true true + partial diff --git a/Ryujinx.Input.SDL2/Ryujinx.Input.SDL2.csproj b/Ryujinx.Input.SDL2/Ryujinx.Input.SDL2.csproj index e93c02ee77..817a96e2e7 100644 --- a/Ryujinx.Input.SDL2/Ryujinx.Input.SDL2.csproj +++ b/Ryujinx.Input.SDL2/Ryujinx.Input.SDL2.csproj @@ -1,7 +1,7 @@  - net6.0 + net7.0 true diff --git a/Ryujinx.Input/Ryujinx.Input.csproj b/Ryujinx.Input/Ryujinx.Input.csproj index c7c76abc6a..55111f77f9 100644 --- a/Ryujinx.Input/Ryujinx.Input.csproj +++ b/Ryujinx.Input/Ryujinx.Input.csproj @@ -1,14 +1,14 @@ - net6.0 + net7.0 true - + diff --git a/Ryujinx.Memory.Tests/Ryujinx.Memory.Tests.csproj b/Ryujinx.Memory.Tests/Ryujinx.Memory.Tests.csproj index 90a7e54a1c..323b51823c 100644 --- a/Ryujinx.Memory.Tests/Ryujinx.Memory.Tests.csproj +++ b/Ryujinx.Memory.Tests/Ryujinx.Memory.Tests.csproj @@ -1,7 +1,7 @@ - net6.0 + net7.0 false diff --git a/Ryujinx.Memory/Ryujinx.Memory.csproj b/Ryujinx.Memory/Ryujinx.Memory.csproj index 0b2ed70616..91e46e48e7 100644 --- a/Ryujinx.Memory/Ryujinx.Memory.csproj +++ b/Ryujinx.Memory/Ryujinx.Memory.csproj @@ -1,7 +1,7 @@  - net6.0 + net7.0 true diff --git a/Ryujinx.SDL2.Common/Ryujinx.SDL2.Common.csproj b/Ryujinx.SDL2.Common/Ryujinx.SDL2.Common.csproj index bf4e042713..51b3b374e7 100644 --- a/Ryujinx.SDL2.Common/Ryujinx.SDL2.Common.csproj +++ b/Ryujinx.SDL2.Common/Ryujinx.SDL2.Common.csproj @@ -1,7 +1,7 @@ - net6.0 + net7.0 diff --git a/Ryujinx.ShaderTools/Ryujinx.ShaderTools.csproj b/Ryujinx.ShaderTools/Ryujinx.ShaderTools.csproj index 898528277a..51416232e6 100644 --- a/Ryujinx.ShaderTools/Ryujinx.ShaderTools.csproj +++ b/Ryujinx.ShaderTools/Ryujinx.ShaderTools.csproj @@ -1,7 +1,7 @@ - net6.0 + net7.0 Exe Debug;Release diff --git a/Ryujinx.Tests.Unicorn/Ryujinx.Tests.Unicorn.csproj b/Ryujinx.Tests.Unicorn/Ryujinx.Tests.Unicorn.csproj index 2005e4fb49..b3ee86d376 100644 --- a/Ryujinx.Tests.Unicorn/Ryujinx.Tests.Unicorn.csproj +++ b/Ryujinx.Tests.Unicorn/Ryujinx.Tests.Unicorn.csproj @@ -1,7 +1,7 @@ - net6.0 + net7.0 true Debug;Release diff --git a/Ryujinx.Tests/Ryujinx.Tests.csproj b/Ryujinx.Tests/Ryujinx.Tests.csproj index 42a35e9ea6..6ab2fa6b10 100644 --- a/Ryujinx.Tests/Ryujinx.Tests.csproj +++ b/Ryujinx.Tests/Ryujinx.Tests.csproj @@ -1,7 +1,7 @@  - net6.0 + net7.0 Exe false diff --git a/Ryujinx.Ui.Common/Ryujinx.Ui.Common.csproj b/Ryujinx.Ui.Common/Ryujinx.Ui.Common.csproj index c5247279ab..4dd1dba83a 100644 --- a/Ryujinx.Ui.Common/Ryujinx.Ui.Common.csproj +++ b/Ryujinx.Ui.Common/Ryujinx.Ui.Common.csproj @@ -1,7 +1,7 @@ - net6.0 + net7.0 diff --git a/Ryujinx/Ryujinx.csproj b/Ryujinx/Ryujinx.csproj index 582f99f0f0..23f5d15595 100644 --- a/Ryujinx/Ryujinx.csproj +++ b/Ryujinx/Ryujinx.csproj @@ -1,7 +1,7 @@  - net6.0 + net7.0 win10-x64;osx-x64;linux-x64 Exe true @@ -9,11 +9,13 @@ $(DefineConstants);$(ExtraDefineConstants) true + true true true + partial diff --git a/Spv.Generator/Spv.Generator.csproj b/Spv.Generator/Spv.Generator.csproj index fff78129b3..082dac9c23 100644 --- a/Spv.Generator/Spv.Generator.csproj +++ b/Spv.Generator/Spv.Generator.csproj @@ -1,7 +1,7 @@  - net6.0 + net7.0 diff --git a/global.json b/global.json index d6c2c37f77..1c7274b725 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "6.0.100", + "version": "7.0.100", "rollForward": "latestFeature" } } \ No newline at end of file