From d6bfecb63f2a401626b345a1888db9d2d1bab165 Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Sat, 19 Feb 2022 19:48:03 -0700 Subject: [PATCH] Add nacp U8Span properties for convenience Adds U8Span properties for the fields in ApplicationControlProperty that contain strings. Makes it easier to know what these fields contain. --- src/LibHac/Ns/ApplicationControlProperty.cs | 5 +++++ src/LibHac/Tools/Fs/SwitchFs.cs | 4 ++-- src/hactoolnet/ProcessSwitchFs.cs | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/LibHac/Ns/ApplicationControlProperty.cs b/src/LibHac/Ns/ApplicationControlProperty.cs index 4d856046..47a377c4 100644 --- a/src/LibHac/Ns/ApplicationControlProperty.cs +++ b/src/LibHac/Ns/ApplicationControlProperty.cs @@ -71,6 +71,11 @@ public struct ApplicationControlProperty public AccessibleLaunchRequiredVersionValue AccessibleLaunchRequiredVersion; public Array3000 Reserved3448; + public U8Span IsbnString => new U8Span(Isbn.ItemsRo); + public U8Span DisplayVersionString => new U8Span(DisplayVersion.ItemsRo); + public U8Span ApplicationErrorCodeCategoryString => new U8Span(ApplicationErrorCodeCategory.ItemsRo); + public U8Span BcatPassphraseString => new U8Span(BcatPassphrase.ItemsRo); + public struct ApplicationTitle { private Array512 _name; diff --git a/src/LibHac/Tools/Fs/SwitchFs.cs b/src/LibHac/Tools/Fs/SwitchFs.cs index 5f109d6a..b0ec3e71 100644 --- a/src/LibHac/Tools/Fs/SwitchFs.cs +++ b/src/LibHac/Tools/Fs/SwitchFs.cs @@ -406,14 +406,14 @@ public class Application { Name = Patch.Name; Version = Patch.Version; - DisplayVersion = Patch.Control.Value.DisplayVersion.ToString(); + DisplayVersion = Patch.Control.Value.DisplayVersionString.ToString(); Nacp = Patch.Control; } else if (Main != null) { Name = Main.Name; Version = Main.Version; - DisplayVersion = Main.Control.Value.DisplayVersion.ToString(); + DisplayVersion = Main.Control.Value.DisplayVersionString.ToString(); Nacp = Main.Control; } else diff --git a/src/hactoolnet/ProcessSwitchFs.cs b/src/hactoolnet/ProcessSwitchFs.cs index 5ffe7a51..2998c695 100644 --- a/src/hactoolnet/ProcessSwitchFs.cs +++ b/src/hactoolnet/ProcessSwitchFs.cs @@ -245,7 +245,7 @@ internal static class ProcessSwitchFs title.Version?.ToString(), title.Metadata?.Type.Print(), Utilities.GetBytesReadable(title.GetSize()), - title.Control.Value.DisplayVersion.ToString(), + title.Control.Value.DisplayVersionString.ToString(), title.Name); }