mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Adds language info to Switch title data (#311)
Shows supported languages in title list
This commit is contained in:
parent
559b8c89f9
commit
fefa38ff22
3 changed files with 34 additions and 4 deletions
|
@ -133,6 +133,26 @@ public struct ApplicationControlProperty
|
||||||
BrazilianPortuguese = 15
|
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")]
|
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||||
public enum Organization
|
public enum Organization
|
||||||
{
|
{
|
||||||
|
|
|
@ -232,13 +232,20 @@ public class SwitchFs : IDisposable
|
||||||
control.Get.Read(out _, 0, title.Control.ByteSpan).ThrowIfFailure();
|
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)
|
foreach (ref readonly ApplicationControlProperty.ApplicationTitle desc in title.Control.Value.Title)
|
||||||
{
|
{
|
||||||
if (!desc.NameString.IsEmpty())
|
if (!desc.NameString.IsEmpty())
|
||||||
|
{
|
||||||
|
if (!nameSet)
|
||||||
{
|
{
|
||||||
title.Name = desc.NameString.ToString();
|
title.Name = desc.NameString.ToString();
|
||||||
break;
|
nameSet = true;
|
||||||
}
|
}
|
||||||
|
title.Languages.Add((ApplicationControlProperty.Language)i);
|
||||||
|
}
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -360,6 +367,8 @@ public class Title
|
||||||
public SwitchFsNca MainNca { get; internal set; }
|
public SwitchFsNca MainNca { get; internal set; }
|
||||||
public SwitchFsNca ControlNca { get; internal set; }
|
public SwitchFsNca ControlNca { get; internal set; }
|
||||||
|
|
||||||
|
public List<ApplicationControlProperty.Language> Languages { get; internal set; } = [];
|
||||||
|
|
||||||
public long GetSize()
|
public long GetSize()
|
||||||
{
|
{
|
||||||
return Ncas.Sum(x => x.Nca.Header.NcaSize);
|
return Ncas.Sum(x => x.Nca.Header.NcaSize);
|
||||||
|
|
|
@ -237,7 +237,7 @@ internal static class ProcessSwitchFs
|
||||||
|
|
||||||
public static string ListTitles(SwitchFs sdfs)
|
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))
|
foreach (Title title in sdfs.Titles.Values.OrderBy(x => x.Id))
|
||||||
{
|
{
|
||||||
|
@ -247,7 +247,8 @@ internal static class ProcessSwitchFs
|
||||||
title.Metadata?.Type.Print(),
|
title.Metadata?.Type.Print(),
|
||||||
Utilities.GetBytesReadable(title.GetSize()),
|
Utilities.GetBytesReadable(title.GetSize()),
|
||||||
title.Control.Value.DisplayVersionString.ToString(),
|
title.Control.Value.DisplayVersionString.ToString(),
|
||||||
title.Name);
|
title.Name,
|
||||||
|
string.Join(',', title.Languages.Select(x => ApplicationControlProperty.LanguageCodes[(int)x])));
|
||||||
}
|
}
|
||||||
|
|
||||||
return table.Print();
|
return table.Print();
|
||||||
|
|
Loading…
Reference in a new issue