mii: Fix multiple inconsistencies (#2392)

I found multiple inconsistencies while diffing with latest sdb, this PR fixes those findings.
This commit is contained in:
Mary 2021-06-23 22:24:16 +02:00 committed by GitHub
parent 0644db02ad
commit e334303559
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 44 additions and 40 deletions

View file

@ -6,7 +6,7 @@ namespace Ryujinx.HLE.HOS.Services.Mii
{
static class Helper
{
public static ushort CalculateCrc16BE(ReadOnlySpan<byte> data, int crc = 0)
public static ushort CalculateCrc16(ReadOnlySpan<byte> data, int crc, bool reverseEndianess)
{
const ushort poly = 0x1021;
@ -25,7 +25,12 @@ namespace Ryujinx.HLE.HOS.Services.Mii
}
}
return BinaryPrimitives.ReverseEndianness((ushort)crc);
if (reverseEndianess)
{
return (ushort)(BinaryPrimitives.ReverseEndianness(crc) >> 16);
}
return (ushort)crc;
}
public static UInt128 GetDeviceId()