diff --git a/src/LibHac/Ns/ApplicationControlProperty.cs b/src/LibHac/Ns/ApplicationControlProperty.cs index 89a96c96..984d8f20 100644 --- a/src/LibHac/Ns/ApplicationControlProperty.cs +++ b/src/LibHac/Ns/ApplicationControlProperty.cs @@ -133,6 +133,26 @@ public struct ApplicationControlProperty BrazilianPortuguese = 15 } + public static readonly string[] LanguageCodes = + [ + "en-US", + "en-GB", + "ja", + "fr", + "de", + "es-419", + "es", + "it", + "nl", + "fr-CA", + "pt", + "ru", + "ko", + "zh-Hans", + "zh-Hant", + "pt-BR" + ]; + [SuppressMessage("ReSharper", "InconsistentNaming")] public enum Organization { diff --git a/src/LibHac/Tools/Fs/SwitchFs.cs b/src/LibHac/Tools/Fs/SwitchFs.cs index dd7217d0..1ee93830 100644 --- a/src/LibHac/Tools/Fs/SwitchFs.cs +++ b/src/LibHac/Tools/Fs/SwitchFs.cs @@ -232,13 +232,20 @@ public class SwitchFs : IDisposable control.Get.Read(out _, 0, title.Control.ByteSpan).ThrowIfFailure(); } + int i = 0; + bool nameSet = false; foreach (ref readonly ApplicationControlProperty.ApplicationTitle desc in title.Control.Value.Title) { if (!desc.NameString.IsEmpty()) { - title.Name = desc.NameString.ToString(); - break; + if (!nameSet) + { + title.Name = desc.NameString.ToString(); + nameSet = true; + } + title.Languages.Add((ApplicationControlProperty.Language)i); } + i++; } } } @@ -360,6 +367,8 @@ public class Title public SwitchFsNca MainNca { get; internal set; } public SwitchFsNca ControlNca { get; internal set; } + public List Languages { get; internal set; } = []; + public long GetSize() { return Ncas.Sum(x => x.Nca.Header.NcaSize); diff --git a/src/hactoolnet/ProcessSwitchFs.cs b/src/hactoolnet/ProcessSwitchFs.cs index cc815b98..9e60bdae 100644 --- a/src/hactoolnet/ProcessSwitchFs.cs +++ b/src/hactoolnet/ProcessSwitchFs.cs @@ -237,7 +237,7 @@ internal static class ProcessSwitchFs public static string ListTitles(SwitchFs sdfs) { - var table = new TableBuilder("Title ID", "Version", "", "Type", "Size", "Display Version", "Name"); + var table = new TableBuilder("Title ID", "Version", "", "Type", "Size", "Display Version", "Name", "Languages"); foreach (Title title in sdfs.Titles.Values.OrderBy(x => x.Id)) { @@ -247,7 +247,8 @@ internal static class ProcessSwitchFs title.Metadata?.Type.Print(), Utilities.GetBytesReadable(title.GetSize()), title.Control.Value.DisplayVersionString.ToString(), - title.Name); + title.Name, + string.Join(',', title.Languages.Select(x => ApplicationControlProperty.LanguageCodes[(int)x]))); } return table.Print();