From d5cce6b50c803f1801f8f06465c9c2b040d6889b Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Thu, 6 Sep 2018 17:34:38 -0500 Subject: [PATCH] Read XCIs with patches. Code style --- Ryujinx.HLE/HOS/Horizon.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Ryujinx.HLE/HOS/Horizon.cs b/Ryujinx.HLE/HOS/Horizon.cs index f682f1979d..92a87661df 100644 --- a/Ryujinx.HLE/HOS/Horizon.cs +++ b/Ryujinx.HLE/HOS/Horizon.cs @@ -136,6 +136,7 @@ namespace Ryujinx.HLE.HOS if (Nca == null) { Device.Log.PrintError(LogClass.Loader, "Unable to load XCI"); + return; } @@ -150,6 +151,7 @@ namespace Ryujinx.HLE.HOS } Nca MainNca = null; + Nca PatchNca = null; foreach (PfsFileEntry FileEntry in Xci.SecurePartition.Files.Where(x => x.Name.EndsWith(".nca"))) { @@ -159,7 +161,14 @@ namespace Ryujinx.HLE.HOS if (Nca.Header.ContentType == ContentType.Program) { - MainNca = Nca; + if (Nca.Sections.Any(x => x?.Type == SectionType.Romfs)) + { + MainNca = Nca; + } + else if (Nca.Sections.Any(x => x?.Type == SectionType.Bktr)) + { + PatchNca = Nca; + } } } @@ -168,6 +177,8 @@ namespace Ryujinx.HLE.HOS Device.Log.PrintError(LogClass.Loader, "Could not find an Application NCA in the provided XCI file"); } + MainNca.SetBaseNca(PatchNca); + return MainNca; } @@ -204,6 +215,7 @@ namespace Ryujinx.HLE.HOS if (Nca.Header.ContentType == ContentType.Program) { LoadNca(Nca); + return; } } @@ -219,12 +231,14 @@ namespace Ryujinx.HLE.HOS if (ExefsSection == null) { Device.Log.PrintError(LogClass.Loader, "No ExeFS found in NCA"); + return; } if (RomfsSection == null) { Device.Log.PrintError(LogClass.Loader, "No RomFS found in NCA"); + return; }