mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-13 06:46:41 +00:00
Don't blow up everything if a DLC file is moved or renamed. (#2867)
* Don't blow up everything if a DLC file is missing * change comment * More correctly setting the "enabled" check box on dlc dialog for the add-on NSP based on the enabled state of all NCAs in the package. * Update Ryujinx.HLE/HOS/ApplicationLoader.cs Co-authored-by: Ac_K <Acoustik666@gmail.com> Co-authored-by: Logan Stromberg <lostromb@microsoft.com> Co-authored-by: Ac_K <Acoustik666@gmail.com>
This commit is contained in:
parent
57d3296ba4
commit
560ed5eebd
2 changed files with 32 additions and 13 deletions
|
@ -334,9 +334,16 @@ namespace Ryujinx.HLE.HOS
|
|||
foreach (DlcContainer dlcContainer in dlcContainerList)
|
||||
{
|
||||
foreach (DlcNca dlcNca in dlcContainer.DlcNcaList)
|
||||
{
|
||||
if (File.Exists(dlcContainer.Path))
|
||||
{
|
||||
_device.Configuration.ContentManager.AddAocItem(dlcNca.TitleId, dlcContainer.Path, dlcNca.Path, dlcNca.Enabled);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Warning?.Print(LogClass.Application, $"Cannot find AddOnContent file {dlcContainer.Path}. It may have been moved or renamed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -75,8 +75,14 @@ namespace Ryujinx.Ui.Windows
|
|||
|
||||
foreach (DlcContainer dlcContainer in _dlcContainerList)
|
||||
{
|
||||
TreeIter parentIter = ((TreeStore)_dlcTreeView.Model).AppendValues(false, "", dlcContainer.Path);
|
||||
|
||||
if (File.Exists(dlcContainer.Path))
|
||||
{
|
||||
// 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);
|
||||
PartitionFileSystem pfs = new PartitionFileSystem(containerFile.AsStorage());
|
||||
_virtualFileSystem.ImportTickets(pfs);
|
||||
|
@ -92,6 +98,12 @@ namespace Ryujinx.Ui.Windows
|
|||
}
|
||||
}
|
||||
}
|
||||
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}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Nca TryCreateNca(IStorage ncaStorage, string containerPath)
|
||||
|
|
Loading…
Reference in a new issue