mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Improve finding a title's main RomFS
This commit is contained in:
parent
c4efec762f
commit
57103c0e0b
3 changed files with 22 additions and 13 deletions
|
@ -16,17 +16,17 @@ namespace hactoolnet
|
|||
ctx.Options = CliParser.Parse(args);
|
||||
if (ctx.Options == null) return;
|
||||
|
||||
if (ctx.Options.RunCustom)
|
||||
{
|
||||
CustomTask(ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
using (var logger = new ProgressBar())
|
||||
{
|
||||
ctx.Logger = logger;
|
||||
OpenKeyset(ctx);
|
||||
|
||||
if (ctx.Options.RunCustom)
|
||||
{
|
||||
CustomTask(ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (ctx.Options.InFileType)
|
||||
{
|
||||
case FileType.Nca:
|
||||
|
@ -120,13 +120,21 @@ namespace hactoolnet
|
|||
return;
|
||||
}
|
||||
|
||||
if (title.ProgramNca == null)
|
||||
if (title.MainNca == null)
|
||||
{
|
||||
ctx.Logger.LogMessage($"Could not find main program data for title {id:X16}");
|
||||
ctx.Logger.LogMessage($"Could not find main data for title {id:X16}");
|
||||
return;
|
||||
}
|
||||
|
||||
var romfs = new Romfs(title.ProgramNca.OpenSection(1, false));
|
||||
var section = title.MainNca.Sections.FirstOrDefault(x => x.Type == SectionType.Romfs);
|
||||
|
||||
if (section == null)
|
||||
{
|
||||
ctx.Logger.LogMessage($"Main NCA for title {id:X16} has no Rom FS section");
|
||||
return;
|
||||
}
|
||||
|
||||
var romfs = new Romfs(title.MainNca.OpenSection(section.SectionNum, false));
|
||||
romfs.Extract(ctx.Options.RomfsOutDir, ctx.Logger);
|
||||
}
|
||||
|
||||
|
@ -189,7 +197,7 @@ namespace hactoolnet
|
|||
{
|
||||
var sdfs = LoadSdFs(args);
|
||||
var title = sdfs.Titles[0x0100E95004038000];
|
||||
var nca = title.ProgramNca;
|
||||
var nca = title.MainNca;
|
||||
var romfsStream = nca.OpenSection(1, false);
|
||||
var romfs = new Romfs(romfsStream);
|
||||
var file = romfs.OpenFile("/stream/voice/us/127/127390101.nop");
|
||||
|
|
|
@ -275,7 +275,7 @@ namespace libhac
|
|||
Control,
|
||||
Manual,
|
||||
Data,
|
||||
Unknown
|
||||
AocData
|
||||
}
|
||||
|
||||
public enum DistributionType
|
||||
|
|
|
@ -111,7 +111,8 @@ namespace libhac
|
|||
switch (content.Type)
|
||||
{
|
||||
case CnmtContentType.Program:
|
||||
title.ProgramNca = contentNca;
|
||||
case CnmtContentType.Data:
|
||||
title.MainNca = contentNca;
|
||||
break;
|
||||
case CnmtContentType.Control:
|
||||
title.ControlNca = contentNca;
|
||||
|
@ -227,7 +228,7 @@ namespace libhac
|
|||
public string Name { get; internal set; }
|
||||
public Nacp Control { get; internal set; }
|
||||
public Nca MetaNca { get; internal set; }
|
||||
public Nca ProgramNca { get; internal set; }
|
||||
public Nca MainNca { get; internal set; }
|
||||
public Nca ControlNca { get; internal set; }
|
||||
|
||||
public long GetSize()
|
||||
|
|
Loading…
Reference in a new issue