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 6feb14b84..0970d7288 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 af665d51c..1b24ce3f6 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 e29e33e89..bb3f47219 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 3b7e802f9..0b59dd348 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 f1e783e6e..a29848cf3 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 fa70d3410..525f1f5b6 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 1c8f7ad0e..9f242dbe2 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 72f19a672..91877cdda 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 2499bb44e..4a159eb5c 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 551fa976f..3b4d8cf02 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 05c77fe9a..2c24678d1 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 e0cc2d56c..818e5ba33 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 84c130233..4765eab3a 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 000000000..8cc437d17 --- /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 84972af11..7da8da25a 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 fff78129b..082dac9c2 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 725f48eab..189108a39 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 cd84024b3..892d9f6a7 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 7b5d73b69..5255a6e00 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 9b5e8013e..d7cb3d99e 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 4c9cc4d40..f26fbdbb3 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 a8047f08c..28818304a 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 49ed1a5c5..3cff4061e 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 b30e6aea0..bff1e803b 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 b30e6aea0..bff1e803b 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 68c0c2af1..bfba98a73 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 d84ab2368..c12d6ff26 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 eed27c94e..3434e2a81 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 227471601..c70ec16c6 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 ff0de1bd0..8741f8487 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 ffbce77a1..000000000 --- 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 6af7e775e..70e3453c3 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 dda766a58..d9717bf85 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 0e564d029..2a7cdd985 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 484b71774..9cf37670e 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 fe22f3f5f..c98d66423 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 24945af28..652c24695 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 b93ebc032..d2716beb6 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 85ddb4393..8cf4bff16 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 47debd59d..b02bbfd18 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 98e0f3072..256ec9e06 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 630a8c9d3..c1a97f526 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 6b7e3e5a0..31c46bc09 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 8b7f33130..30b201f65 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 e04dd8134..4a0259e60 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 9092f6e08..374558eab 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 50e6b01c6..5bb046abe 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 3c86aed50..e270c10ae 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 1ce7bbfc1..7f32ce6bd 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 36c8b51a7..56bfa709b 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 4bb19e752..18da4ed3e 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 71fb45212..729e11b6b 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 38e10480e..6b589c28a 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 ac9f0880b..e3b65f2ad 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 736bc1025..ef4b7b399 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 4cf1fc991..38d37055c 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 c04ba7cf4..bdcbaca86 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 22d87f6b1..000000000 --- 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 929b4131c..a9d227c63 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 e93c02ee7..817a96e2e 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 c7c76abc6..55111f77f 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 90a7e54a1..323b51823 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 0b2ed7061..91e46e48e 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 bf4e04271..51b3b374e 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 898528277..51416232e 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 2005e4fb4..b3ee86d37 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 42a35e9ea..6ab2fa6b1 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 c5247279a..4dd1dba83 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 582f99f0f..23f5d1559 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 fff78129b..082dac9c2 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 d6c2c37f7..1c7274b72 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