diff options
Diffstat (limited to 'Ryujinx.HLE')
| -rw-r--r-- | Ryujinx.HLE/FileSystem/Content/ContentManager.cs | 13 | ||||
| -rw-r--r-- | Ryujinx.HLE/HOS/ApplicationLoader.cs | 42 |
2 files changed, 30 insertions, 25 deletions
diff --git a/Ryujinx.HLE/FileSystem/Content/ContentManager.cs b/Ryujinx.HLE/FileSystem/Content/ContentManager.cs index 839078e8..1b9ea143 100644 --- a/Ryujinx.HLE/FileSystem/Content/ContentManager.cs +++ b/Ryujinx.HLE/FileSystem/Content/ContentManager.cs @@ -4,7 +4,6 @@ using LibHac.Fs; using LibHac.FsSystem; using LibHac.FsSystem.NcaUtils; using LibHac.Ncm; -using LibHac.Spl; using Ryujinx.Common.Logging; using Ryujinx.HLE.Exceptions; using Ryujinx.HLE.HOS.Services.Time; @@ -241,6 +240,18 @@ namespace Ryujinx.HLE.FileSystem.Content } } + public void AddAocItem(ulong titleId, string containerPath, string ncaPath, bool enabled) + { + if (!_aocData.TryAdd(titleId, new AocItem(containerPath, ncaPath, enabled))) + { + Logger.PrintWarning(LogClass.Application, $"Duplicate AddOnContent detected. TitleId {titleId:X16}"); + } + else + { + Logger.PrintInfo(LogClass.Application, $"Found AddOnContent with TitleId {titleId:X16}"); + } + } + public void ClearAocData() => _aocData.Clear(); public int GetAocCount() => _aocData.Where(e => e.Value.Enabled).Count(); 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<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)) |
