From 086564c3c88d8006670199b3aba5977c07f16261 Mon Sep 17 00:00:00 2001 From: riperiperi Date: Fri, 6 Oct 2023 23:23:39 +0100 Subject: HLE: Fix Mii crc generation and minor issues (#5766) * HLE: Fix Mii crc generation Validating CRCs for data and device involves calculating the crc of all data including the crc being checked, which should then be 0. The crc should be _generated_ on all data _before_ the crc in the struct. It shouldn't include the crcs themselves. This fixes all generated miis (eg. default) having invalid crcs. This does not affect mii maker, as that generates its own charinfo. Does not fix MK8D crash. * Fix other mii issues * Fully define all fields for Nickname and Ver3StoreData Fixes an issue where the nickname for a mii would only have the first character on some method calls. * Add Array96 type --- src/Ryujinx.Common/Memory/StructArrayHelpers.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/Ryujinx.Common') diff --git a/src/Ryujinx.Common/Memory/StructArrayHelpers.cs b/src/Ryujinx.Common/Memory/StructArrayHelpers.cs index 65956ed3..807bd69c 100644 --- a/src/Ryujinx.Common/Memory/StructArrayHelpers.cs +++ b/src/Ryujinx.Common/Memory/StructArrayHelpers.cs @@ -756,6 +756,18 @@ namespace Ryujinx.Common.Memory public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array96 : IArray where T : unmanaged + { + T _e0; + Array64 _other; + Array31 _other2; + public readonly int Length => 96; + public ref T this[int index] => ref AsSpan()[index]; + + [Pure] + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + } + public struct Array127 : IArray where T : unmanaged { T _e0; -- cgit v1.2.3