From 7b0ae0c9542043c2bc1898dcaab22ffad1c9be43 Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Wed, 22 Aug 2018 09:58:36 -0500 Subject: [PATCH] Option to export raw RomFS from XCI --- hactoolnet/CliParser.cs | 1 + hactoolnet/Program.cs | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/hactoolnet/CliParser.cs b/hactoolnet/CliParser.cs index 71e418f6..c097b771 100644 --- a/hactoolnet/CliParser.cs +++ b/hactoolnet/CliParser.cs @@ -156,6 +156,7 @@ namespace hactoolnet sb.AppendLine(" --section1dir Specify Section 1 directory path."); sb.AppendLine(" --section2dir Specify Section 2 directory path."); sb.AppendLine(" --section3dir Specify Section 3 directory path."); + sb.AppendLine(" --romfsdir Specify main RomFS directory path."); sb.AppendLine(" --listromfs List files in RomFS."); sb.AppendLine(" --basenca Set Base NCA to use with update partitions."); sb.AppendLine("XCI options:"); diff --git a/hactoolnet/Program.cs b/hactoolnet/Program.cs index d516ec29..95239873 100644 --- a/hactoolnet/Program.cs +++ b/hactoolnet/Program.cs @@ -249,7 +249,7 @@ namespace hactoolnet } } - if (ctx.Options.RomfsOutDir != null) + if (ctx.Options.RomfsOutDir != null || ctx.Options.RomfsOut != null) { if (xci.SecurePartition == null) { @@ -284,8 +284,16 @@ namespace hactoolnet return; } - var romfs = new Romfs(mainNca.OpenSection(romfsSection.SectionNum, false)); - romfs.Extract(ctx.Options.RomfsOutDir, ctx.Logger); + if (ctx.Options.RomfsOutDir != null) + { + var romfs = new Romfs(mainNca.OpenSection(romfsSection.SectionNum, false)); + romfs.Extract(ctx.Options.RomfsOutDir, ctx.Logger); + } + + if (ctx.Options.RomfsOut != null) + { + mainNca.ExportSection(romfsSection.SectionNum, ctx.Options.RomfsOut, ctx.Options.Raw, ctx.Logger); + } } } }