Implement dlc management window (#1313)

* Implement dlc management window

* reduce repetition

* Implement per NCA toggling of DLC rather than per container
This commit is contained in:
Xpl0itR 2020-06-23 01:32:07 +01:00 committed by GitHub
parent fcd187ce42
commit 2ed9db1fcd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 581 additions and 164 deletions

View file

@ -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<DlcContainer> dlcContainerList = JsonHelper.DeserializeFromFile<List<DlcContainer>>(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))