From d56d335c0bcd37672debd30896d47694fb29f905 Mon Sep 17 00:00:00 2001 From: Mary Date: Sun, 12 Mar 2023 03:24:11 +0100 Subject: [PATCH] misc: Some dependencies cleanup (#4507) * Remove dependencies on libraries provided by .NET standard library * Use System.IO.Hashing instead of Crc32.NET --- Directory.Packages.props | 5 +---- .../Ryujinx.Graphics.Vulkan.csproj | 3 --- Ryujinx.Input/Motion/CemuHook/Client.cs | 15 +++++++-------- Ryujinx.Input/Motion/CemuHook/Protocol/Header.cs | 9 +++++---- Ryujinx.Input/Ryujinx.Input.csproj | 2 +- 5 files changed, 14 insertions(+), 20 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 5de9461a..95359100 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -12,7 +12,6 @@ - @@ -45,10 +44,8 @@ - + - - diff --git a/Ryujinx.Graphics.Vulkan/Ryujinx.Graphics.Vulkan.csproj b/Ryujinx.Graphics.Vulkan/Ryujinx.Graphics.Vulkan.csproj index 57e2240a..20216e51 100644 --- a/Ryujinx.Graphics.Vulkan/Ryujinx.Graphics.Vulkan.csproj +++ b/Ryujinx.Graphics.Vulkan/Ryujinx.Graphics.Vulkan.csproj @@ -29,9 +29,6 @@ - - - diff --git a/Ryujinx.Input/Motion/CemuHook/Client.cs b/Ryujinx.Input/Motion/CemuHook/Client.cs index ecaf26f0..f5f7b864 100644 --- a/Ryujinx.Input/Motion/CemuHook/Client.cs +++ b/Ryujinx.Input/Motion/CemuHook/Client.cs @@ -1,5 +1,4 @@ -using Force.Crc32; -using Ryujinx.Common; +using Ryujinx.Common; using Ryujinx.Common.Configuration.Hid; using Ryujinx.Common.Configuration.Hid.Controller; using Ryujinx.Common.Configuration.Hid.Controller.Motion; @@ -9,6 +8,7 @@ using Ryujinx.Input.Motion.CemuHook.Protocol; using System; using System.Collections.Generic; using System.IO; +using System.IO.Hashing; using System.Net; using System.Net.Sockets; using System.Numerics; @@ -401,10 +401,10 @@ namespace Ryujinx.Input.Motion.CemuHook writer.Seek(6, SeekOrigin.Begin); writer.Write(header.Length); - header.Crc32 = Crc32Algorithm.Compute(stream.ToArray()); + Crc32.Hash(stream.ToArray(), header.Crc32.AsSpan()); writer.Seek(8, SeekOrigin.Begin); - writer.Write(header.Crc32); + writer.Write(header.Crc32.AsSpan()); byte[] data = stream.ToArray(); @@ -440,10 +440,10 @@ namespace Ryujinx.Input.Motion.CemuHook writer.Seek(6, SeekOrigin.Begin); writer.Write(header.Length); - header.Crc32 = Crc32Algorithm.Compute(stream.ToArray()); + Crc32.Hash(stream.ToArray(), header.Crc32.AsSpan()); writer.Seek(8, SeekOrigin.Begin); - writer.Write(header.Crc32); + writer.Write(header.Crc32.AsSpan()); byte[] data = stream.ToArray(); @@ -458,8 +458,7 @@ namespace Ryujinx.Input.Motion.CemuHook Id = (uint)clientId, MagicString = Magic, Version = Version, - Length = 0, - Crc32 = 0 + Length = 0 }; return header; diff --git a/Ryujinx.Input/Motion/CemuHook/Protocol/Header.cs b/Ryujinx.Input/Motion/CemuHook/Protocol/Header.cs index 94cf4bb6..57f58ff0 100644 --- a/Ryujinx.Input/Motion/CemuHook/Protocol/Header.cs +++ b/Ryujinx.Input/Motion/CemuHook/Protocol/Header.cs @@ -1,14 +1,15 @@ -using System.Runtime.InteropServices; +using Ryujinx.Common.Memory; +using System.Runtime.InteropServices; namespace Ryujinx.Input.Motion.CemuHook.Protocol { [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Header { - public uint MagicString; + public uint MagicString; public ushort Version; public ushort Length; - public uint Crc32; - public uint Id; + public Array4 Crc32; + public uint Id; } } \ No newline at end of file diff --git a/Ryujinx.Input/Ryujinx.Input.csproj b/Ryujinx.Input/Ryujinx.Input.csproj index 40b82246..df462734 100644 --- a/Ryujinx.Input/Ryujinx.Input.csproj +++ b/Ryujinx.Input/Ryujinx.Input.csproj @@ -6,7 +6,7 @@ - +