diff options
Diffstat (limited to 'Ryujinx/Ui/Windows/DlcWindow.cs')
-rw-r--r-- | Ryujinx/Ui/Windows/DlcWindow.cs | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/Ryujinx/Ui/Windows/DlcWindow.cs b/Ryujinx/Ui/Windows/DlcWindow.cs index 76be60ef..1a47ae41 100644 --- a/Ryujinx/Ui/Windows/DlcWindow.cs +++ b/Ryujinx/Ui/Windows/DlcWindow.cs @@ -21,10 +21,10 @@ namespace Ryujinx.Ui.Windows { public class DlcWindow : Window { - private readonly VirtualFileSystem _virtualFileSystem; - private readonly string _titleId; - private readonly string _dlcJsonPath; - private readonly List<DlcContainer> _dlcContainerList; + private readonly VirtualFileSystem _virtualFileSystem; + private readonly string _titleId; + private readonly string _dlcJsonPath; + private readonly List<DownloadableContentContainer> _dlcContainerList; #pragma warning disable CS0649, IDE0044 [GUI] Label _baseTitleInfoLabel; @@ -45,11 +45,11 @@ namespace Ryujinx.Ui.Windows try { - _dlcContainerList = JsonHelper.DeserializeFromFile<List<DlcContainer>>(_dlcJsonPath); + _dlcContainerList = JsonHelper.DeserializeFromFile<List<DownloadableContentContainer>>(_dlcJsonPath); } catch { - _dlcContainerList = new List<DlcContainer>(); + _dlcContainerList = new List<DownloadableContentContainer>(); } _dlcTreeView.Model = new TreeStore(typeof(bool), typeof(string), typeof(string)); @@ -75,37 +75,37 @@ namespace Ryujinx.Ui.Windows _dlcTreeView.AppendColumn("TitleId", new CellRendererText(), "text", 1); _dlcTreeView.AppendColumn("Path", new CellRendererText(), "text", 2); - foreach (DlcContainer dlcContainer in _dlcContainerList) + foreach (DownloadableContentContainer dlcContainer in _dlcContainerList) { - if (File.Exists(dlcContainer.Path)) + if (File.Exists(dlcContainer.ContainerPath)) { // The parent tree item has its own "enabled" check box, but it's the actual // nca entries that store the enabled / disabled state. A bit of a UI inconsistency. // Maybe a tri-state check box would be better, but for now we check the parent // "enabled" box if all child NCAs are enabled. Usually fine since each nsp has only one nca. - bool areAllContentPacksEnabled = dlcContainer.DlcNcaList.TrueForAll((nca) => nca.Enabled); - TreeIter parentIter = ((TreeStore)_dlcTreeView.Model).AppendValues(areAllContentPacksEnabled, "", dlcContainer.Path); - using FileStream containerFile = File.OpenRead(dlcContainer.Path); + bool areAllContentPacksEnabled = dlcContainer.DownloadableContentNcaList.TrueForAll((nca) => nca.Enabled); + TreeIter parentIter = ((TreeStore)_dlcTreeView.Model).AppendValues(areAllContentPacksEnabled, "", dlcContainer.ContainerPath); + using FileStream containerFile = File.OpenRead(dlcContainer.ContainerPath); PartitionFileSystem pfs = new PartitionFileSystem(containerFile.AsStorage()); _virtualFileSystem.ImportTickets(pfs); - foreach (DlcNca dlcNca in dlcContainer.DlcNcaList) + foreach (DownloadableContentNca dlcNca in dlcContainer.DownloadableContentNcaList) { using var ncaFile = new UniqueRef<IFile>(); - pfs.OpenFile(ref ncaFile.Ref(), dlcNca.Path.ToU8Span(), OpenMode.Read).ThrowIfFailure(); - Nca nca = TryCreateNca(ncaFile.Get.AsStorage(), dlcContainer.Path); + pfs.OpenFile(ref ncaFile.Ref(), dlcNca.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure(); + Nca nca = TryCreateNca(ncaFile.Get.AsStorage(), dlcContainer.ContainerPath); if (nca != null) { - ((TreeStore)_dlcTreeView.Model).AppendValues(parentIter, dlcNca.Enabled, nca.Header.TitleId.ToString("X16"), dlcNca.Path); + ((TreeStore)_dlcTreeView.Model).AppendValues(parentIter, dlcNca.Enabled, nca.Header.TitleId.ToString("X16"), dlcNca.FullPath); } } } else { // DLC file moved or renamed. Allow the user to remove it without crashing the whole dialog. - TreeIter parentIter = ((TreeStore)_dlcTreeView.Model).AppendValues(false, "", $"(MISSING) {dlcContainer.Path}"); + TreeIter parentIter = ((TreeStore)_dlcTreeView.Model).AppendValues(false, "", $"(MISSING) {dlcContainer.ContainerPath}"); } } } @@ -237,19 +237,19 @@ namespace Ryujinx.Ui.Windows { if (_dlcTreeView.Model.IterChildren(out TreeIter childIter, parentIter)) { - DlcContainer dlcContainer = new DlcContainer + DownloadableContentContainer dlcContainer = new DownloadableContentContainer { - Path = (string)_dlcTreeView.Model.GetValue(parentIter, 2), - DlcNcaList = new List<DlcNca>() + ContainerPath = (string)_dlcTreeView.Model.GetValue(parentIter, 2), + DownloadableContentNcaList = new List<DownloadableContentNca>() }; do { - dlcContainer.DlcNcaList.Add(new DlcNca + dlcContainer.DownloadableContentNcaList.Add(new DownloadableContentNca { - Enabled = (bool)_dlcTreeView.Model.GetValue(childIter, 0), - TitleId = Convert.ToUInt64(_dlcTreeView.Model.GetValue(childIter, 1).ToString(), 16), - Path = (string)_dlcTreeView.Model.GetValue(childIter, 2) + Enabled = (bool)_dlcTreeView.Model.GetValue(childIter, 0), + TitleId = Convert.ToUInt64(_dlcTreeView.Model.GetValue(childIter, 1).ToString(), 16), + FullPath = (string)_dlcTreeView.Model.GetValue(childIter, 2) }); } while (_dlcTreeView.Model.IterNext(ref childIter)); |