From 71824f06dc5f73530837a452bbbfa78fd4806537 Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Mon, 17 Aug 2020 18:50:18 -0700 Subject: [PATCH] Fixes in Nca and U8Span --- src/LibHac/Common/U8Span.cs | 2 +- src/LibHac/Common/U8SpanMutable.cs | 2 +- src/LibHac/FsSystem/NcaUtils/Nca.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/LibHac/Common/U8Span.cs b/src/LibHac/Common/U8Span.cs index 92cd9978..25daf063 100644 --- a/src/LibHac/Common/U8Span.cs +++ b/src/LibHac/Common/U8Span.cs @@ -90,7 +90,7 @@ public U8String ToU8String() /// /// if the span has no buffer. /// Otherwise, . - public bool IsNull() => _buffer.IsEmpty; + public unsafe bool IsNull() => (IntPtr)Unsafe.AsPointer(ref MemoryMarshal.GetReference(_buffer)) == IntPtr.Zero; /// /// Checks if the has no buffer or begins with a null terminator. diff --git a/src/LibHac/Common/U8SpanMutable.cs b/src/LibHac/Common/U8SpanMutable.cs index 418fdccc..7d782ff2 100644 --- a/src/LibHac/Common/U8SpanMutable.cs +++ b/src/LibHac/Common/U8SpanMutable.cs @@ -86,7 +86,7 @@ public U8StringMutable ToU8String() /// /// if the span has no buffer. /// Otherwise, . - public bool IsNull() => _buffer.IsEmpty; + public unsafe bool IsNull() => (IntPtr)Unsafe.AsPointer(ref MemoryMarshal.GetReference(_buffer)) == IntPtr.Zero; /// /// Checks if the has no buffer or begins with a null terminator. diff --git a/src/LibHac/FsSystem/NcaUtils/Nca.cs b/src/LibHac/FsSystem/NcaUtils/Nca.cs index f9ee9676..7e55a6f4 100644 --- a/src/LibHac/FsSystem/NcaUtils/Nca.cs +++ b/src/LibHac/FsSystem/NcaUtils/Nca.cs @@ -557,7 +557,7 @@ private static HierarchicalIntegrityVerificationStorage InitIvfcForRomFs(NcaFsIn return new HierarchicalIntegrityVerificationStorage(initInfo, integrityCheckLevel, leaveOpen); } - public IStorage OpenDecryptedHeaderStorage() => OpenHeaderStorage(true); + public IStorage OpenDecryptedHeaderStorage() => OpenHeaderStorage(false); public IStorage OpenHeaderStorage(bool openEncrypted) {