diff options
| author | Mary <mary@mary.zone> | 2023-03-12 03:24:11 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-12 03:24:11 +0100 |
| commit | d56d335c0bcd37672debd30896d47694fb29f905 (patch) | |
| tree | a7aa93cdc005364e246e5237b10be03b3c0374d3 /Ryujinx.Input/Motion | |
| parent | 23c844b2aa84a65e573dcc023d19b8f5294a8baf (diff) | |
misc: Some dependencies cleanup (#4507)
* Remove dependencies on libraries provided by .NET standard library
* Use System.IO.Hashing instead of Crc32.NET
Diffstat (limited to 'Ryujinx.Input/Motion')
| -rw-r--r-- | Ryujinx.Input/Motion/CemuHook/Client.cs | 15 | ||||
| -rw-r--r-- | Ryujinx.Input/Motion/CemuHook/Protocol/Header.cs | 9 |
2 files changed, 12 insertions, 12 deletions
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<byte> Crc32; + public uint Id; } }
\ No newline at end of file |
