mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
hactoolnet: Set archive bit when missing from concat files
This commit is contained in:
parent
67bf8b19ce
commit
da5a3449dd
1 changed files with 25 additions and 0 deletions
|
@ -21,11 +21,15 @@ namespace hactoolnet
|
||||||
{
|
{
|
||||||
ctx.Logger.LogMessage("Treating path as SD card storage");
|
ctx.Logger.LogMessage("Treating path as SD card storage");
|
||||||
switchFs = SwitchFs.OpenSdCard(ctx.Keyset, baseFs);
|
switchFs = SwitchFs.OpenSdCard(ctx.Keyset, baseFs);
|
||||||
|
|
||||||
|
CheckForNcaFolders(ctx, switchFs);
|
||||||
}
|
}
|
||||||
else if (Directory.Exists(Path.Combine(ctx.Options.InFile, "Contents", "registered")))
|
else if (Directory.Exists(Path.Combine(ctx.Options.InFile, "Contents", "registered")))
|
||||||
{
|
{
|
||||||
ctx.Logger.LogMessage("Treating path as NAND storage");
|
ctx.Logger.LogMessage("Treating path as NAND storage");
|
||||||
switchFs = SwitchFs.OpenNandPartition(ctx.Keyset, baseFs);
|
switchFs = SwitchFs.OpenNandPartition(ctx.Keyset, baseFs);
|
||||||
|
|
||||||
|
CheckForNcaFolders(ctx, switchFs);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -298,5 +302,26 @@ namespace hactoolnet
|
||||||
save.Value.Extract(outDir, ctx.Logger);
|
save.Value.Extract(outDir, ctx.Logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void CheckForNcaFolders(Context ctx, SwitchFs switchFs)
|
||||||
|
{
|
||||||
|
IFileSystem fs = switchFs.ContentFs;
|
||||||
|
|
||||||
|
DirectoryEntry[] ncaDirs = fs.EnumerateEntries("*.nca", SearchOptions.RecurseSubdirectories)
|
||||||
|
.Where(x => x.Type == DirectoryEntryType.Directory)
|
||||||
|
.Where(x => fs.FileExists($"{x.FullPath}/00"))
|
||||||
|
.ToArray();
|
||||||
|
|
||||||
|
if (ncaDirs.Length > 0)
|
||||||
|
{
|
||||||
|
ctx.Logger.LogMessage("Warning: NCA folders without the archive flag were found. Fixing...");
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (DirectoryEntry file in ncaDirs)
|
||||||
|
{
|
||||||
|
fs.SetConcatenationFileAttribute(file.FullPath);
|
||||||
|
ctx.Logger.LogMessage($"{file.FullPath}");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue