From 346e50b949134a83ff0e24984323d3f60c07e752 Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Sat, 7 Jul 2018 17:47:03 -0500 Subject: [PATCH] Support reading patched titles from the SD card --- hactoolnet/Program.cs | 2 +- libhac/SdFs.cs | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/hactoolnet/Program.cs b/hactoolnet/Program.cs index 9c61366a..026305b5 100644 --- a/hactoolnet/Program.cs +++ b/hactoolnet/Program.cs @@ -156,7 +156,7 @@ namespace hactoolnet return; } - var section = title.MainNca.Sections.FirstOrDefault(x => x.Type == SectionType.Romfs); + var section = title.MainNca.Sections.FirstOrDefault(x => x?.Type == SectionType.Romfs || x?.Type == SectionType.Bktr); if (section == null) { diff --git a/libhac/SdFs.cs b/libhac/SdFs.cs index c2d6afa0..691b8c6d 100644 --- a/libhac/SdFs.cs +++ b/libhac/SdFs.cs @@ -160,6 +160,17 @@ namespace libhac app.AddTitle(title); } + + foreach (var app in Applications.Values) + { + var main = app.Main?.MainNca; + var patch = app.Patch?.MainNca; + + if (main != null) + { + patch?.SetBaseNca(main); + } + } } internal static Stream OpenSplitNcaStream(string path)