mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
3d50085e22
*Create an IStorage interface and Storage abstract class to use instead of Stream * Improve AES-XTS performance by ~16x * Double AES-CTR performance: 800 MB/s -> 1600 MB/s on a 6700K * Add AES-XTS tests * Add AES benchmark and AES-CTR writing * Add support for a hashed FAT in save files * Add option to export decrypted NCA * Allow opening decrypted package1 and package2 * Make sure romfs disposal can cascade all the way down * Validate NCA, NPDM and package2 signatures
43 lines
1.2 KiB
C#
43 lines
1.2 KiB
C#
using System.IO;
|
|
using LibHac;
|
|
using LibHac.IO;
|
|
|
|
namespace hactoolnet
|
|
{
|
|
internal static class ProcessRomfs
|
|
{
|
|
public static void Process(Context ctx)
|
|
{
|
|
using (var file = new FileStream(ctx.Options.InFile, FileMode.Open, FileAccess.Read))
|
|
{
|
|
var romfs = new Romfs(file.AsStorage());
|
|
Process(ctx, romfs);
|
|
}
|
|
}
|
|
|
|
public static void Process(Context ctx, Romfs romfs)
|
|
{
|
|
if (ctx.Options.ListRomFs)
|
|
{
|
|
foreach (RomfsFile romfsFile in romfs.Files)
|
|
{
|
|
ctx.Logger.LogMessage(romfsFile.FullPath);
|
|
}
|
|
}
|
|
|
|
if (ctx.Options.RomfsOut != null)
|
|
{
|
|
using (var outFile = new FileStream(ctx.Options.RomfsOut, FileMode.Create, FileAccess.ReadWrite))
|
|
{
|
|
IStorage romfsStorage = romfs.OpenRawStream();
|
|
romfsStorage.CopyToStream(outFile, romfsStorage.Length, ctx.Logger);
|
|
}
|
|
}
|
|
|
|
if (ctx.Options.RomfsOutDir != null)
|
|
{
|
|
romfs.Extract(ctx.Options.RomfsOutDir, ctx.Logger);
|
|
}
|
|
}
|
|
}
|
|
}
|