Read XCIs with patches. Code style

This commit is contained in:
Alex Barney 2018-09-06 17:34:38 -05:00
parent 9b09156d5b
commit d5cce6b50c

View file

@ -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;
}