From 85a3b569024a28ebb1956b6a13e9b4f73367ec21 Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Tue, 12 Mar 2019 17:02:16 -0500 Subject: [PATCH] Work around DiscUtil's quirks --- src/LibHac.Nand/FatFileSystemDirectory.cs | 4 ++-- src/NandReader/Program.cs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/LibHac.Nand/FatFileSystemDirectory.cs b/src/LibHac.Nand/FatFileSystemDirectory.cs index 7e5700c3..ba00a303 100644 --- a/src/LibHac.Nand/FatFileSystemDirectory.cs +++ b/src/LibHac.Nand/FatFileSystemDirectory.cs @@ -35,8 +35,8 @@ namespace LibHac.Nand if (!CanReturnEntry(isDir, Mode)) continue; - DirectoryEntryType type = isDir ? DirectoryEntryType.File : DirectoryEntryType.Directory; - long length = isDir ? 0 : ((DiscFileInfo)entry).Length; + DirectoryEntryType type = isDir ? DirectoryEntryType.Directory : DirectoryEntryType.File; + long length = isDir ? 0 : entry.FileSystem.GetFileLength(entry.FullName); yield return new DirectoryEntry(entry.Name, FullPath + '/' + entry.Name, type, length) { diff --git a/src/NandReader/Program.cs b/src/NandReader/Program.cs index 4725e7b5..fcc49f72 100644 --- a/src/NandReader/Program.cs +++ b/src/NandReader/Program.cs @@ -18,7 +18,7 @@ namespace NandReader Console.WriteLine("Usage: NandReader raw_nand_dump_file"); return; } - GetTitleKeys(args[0]); + ReadSwitchFs(args[0]); } private static void GetTitleKeys(string nandFile) @@ -51,6 +51,7 @@ namespace NandReader var nand = new Nand(stream, keyset); FatFileSystemProvider user = nand.OpenSystemPartition(); SwitchFs sdfs = SwitchFs.OpenNandPartition(keyset, user); + ; } }