From 2ed9db1fcdc679aab552dc1ddeaf1e80e05ee65c Mon Sep 17 00:00:00 2001 From: Xpl0itR Date: Tue, 23 Jun 2020 01:32:07 +0100 Subject: Implement dlc management window (#1313) * Implement dlc management window * reduce repetition * Implement per NCA toggling of DLC rather than per container --- Ryujinx.HLE/HOS/ApplicationLoader.cs | 42 ++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 24 deletions(-) (limited to 'Ryujinx.HLE/HOS/ApplicationLoader.cs') diff --git a/Ryujinx.HLE/HOS/ApplicationLoader.cs b/Ryujinx.HLE/HOS/ApplicationLoader.cs index 5ca67445..f6ab5ba9 100644 --- a/Ryujinx.HLE/HOS/ApplicationLoader.cs +++ b/Ryujinx.HLE/HOS/ApplicationLoader.cs @@ -149,17 +149,6 @@ namespace Ryujinx.HLE.HOS _contentManager.ClearAocData(); _contentManager.AddAocData(securePartition, xciFile, mainNca.Header.TitleId); - // Check all nsp's in the base directory for AOC - foreach (var fn in new FileInfo(xciFile).Directory.EnumerateFiles("*.nsp")) - { - using (FileStream fs = fn.OpenRead()) - using (IStorage storage = fs.AsStorage()) - using (PartitionFileSystem pfs = new PartitionFileSystem(storage)) - { - _contentManager.AddAocData(pfs, fn.FullName, mainNca.Header.TitleId); - } - } - LoadNca(mainNca, patchNca, controlNca); } @@ -196,18 +185,6 @@ namespace Ryujinx.HLE.HOS _contentManager.ClearAocData(); _contentManager.AddAocData(nsp, nspFile, mainNca.Header.TitleId); - // Check all nsp's in the base directory for AOC - foreach (var fn in new FileInfo(nspFile).Directory.EnumerateFiles("*.nsp")) - { - if (fn.FullName == nspFile) continue; - using (FileStream fs = fn.OpenRead()) - using (IStorage storage = fs.AsStorage()) - using (PartitionFileSystem pfs = new PartitionFileSystem(storage)) - { - _contentManager.AddAocData(pfs, fn.FullName, mainNca.Header.TitleId); - } - } - LoadNca(mainNca, patchNca, controlNca); return; @@ -238,7 +215,8 @@ namespace Ryujinx.HLE.HOS IStorage dataStorage = null; IFileSystem codeFs = null; - string titleUpdateMetadataPath = System.IO.Path.Combine(_fileSystem.GetBasePath(), "games", mainNca.Header.TitleId.ToString("x16"), "updates.json"); + // Load Update + string titleUpdateMetadataPath = Path.Combine(_fileSystem.GetBasePath(), "games", mainNca.Header.TitleId.ToString("x16"), "updates.json"); if (File.Exists(titleUpdateMetadataPath)) { @@ -274,6 +252,22 @@ namespace Ryujinx.HLE.HOS } } + // Load Aoc + string titleAocMetadataPath = Path.Combine(_fileSystem.GetBasePath(), "games", mainNca.Header.TitleId.ToString("x16"), "dlc.json"); + + if (File.Exists(titleAocMetadataPath)) + { + List dlcContainerList = JsonHelper.DeserializeFromFile>(titleAocMetadataPath); + + foreach (DlcContainer dlcContainer in dlcContainerList) + { + foreach (DlcNca dlcNca in dlcContainer.DlcNcaList) + { + _contentManager.AddAocItem(dlcNca.TitleId, dlcContainer.Path, dlcNca.Path, dlcNca.Enabled); + } + } + } + if (patchNca == null) { if (mainNca.CanOpenSection(NcaSectionType.Data)) -- cgit v1.2.3