mirror of
https://github.com/Ryujinx-NX/Ryujinx.git
synced 2024-11-14 21:17:43 -07:00
Auto-load bundled DLC on startup
This commit is contained in:
parent
57de6a7dc5
commit
867bc7021f
@ -786,8 +786,29 @@ namespace Ryujinx.UI.App.Common
|
|||||||
|
|
||||||
foreach (ApplicationData application in Applications.Items)
|
foreach (ApplicationData application in Applications.Items)
|
||||||
{
|
{
|
||||||
var res = DownloadableContentsHelper.LoadDownloadableContentsJson(_virtualFileSystem, application.IdBase);
|
var savedDlc = DownloadableContentsHelper.LoadDownloadableContentsJson(_virtualFileSystem, application.IdBase);
|
||||||
it.AddOrUpdate(res);
|
it.AddOrUpdate(savedDlc);
|
||||||
|
|
||||||
|
if(TryGetDownloadableContentFromFile(application.Path, out var bundledDlc))
|
||||||
|
{
|
||||||
|
var savedDlcLookup = savedDlc.Select(dlc => dlc.Item1).ToHashSet();
|
||||||
|
|
||||||
|
bool addedNewDlc = false;
|
||||||
|
foreach (var dlc in bundledDlc)
|
||||||
|
{
|
||||||
|
if (!savedDlcLookup.Contains(dlc))
|
||||||
|
{
|
||||||
|
addedNewDlc = true;
|
||||||
|
it.AddOrUpdate((dlc, true));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (addedNewDlc)
|
||||||
|
{
|
||||||
|
var gameDlcs = it.Items.Where(dlc => dlc.Dlc.TitleIdBase == application.IdBase).ToList();
|
||||||
|
DownloadableContentsHelper.SaveDownloadableContentsJson(_virtualFileSystem, application.IdBase, gameDlcs);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,8 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
{
|
{
|
||||||
private readonly ApplicationLibrary _applicationLibrary;
|
private readonly ApplicationLibrary _applicationLibrary;
|
||||||
private AvaloniaList<DownloadableContentModel> _downloadableContents = new();
|
private AvaloniaList<DownloadableContentModel> _downloadableContents = new();
|
||||||
private AvaloniaList<DownloadableContentModel> _views = new();
|
|
||||||
private AvaloniaList<DownloadableContentModel> _selectedDownloadableContents = new();
|
private AvaloniaList<DownloadableContentModel> _selectedDownloadableContents = new();
|
||||||
|
private AvaloniaList<DownloadableContentModel> _views = new();
|
||||||
|
|
||||||
private string _search;
|
private string _search;
|
||||||
private readonly ApplicationData _applicationData;
|
private readonly ApplicationData _applicationData;
|
||||||
@ -106,14 +106,6 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
OnPropertyChanged(nameof(UpdateCount));
|
OnPropertyChanged(nameof(UpdateCount));
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: Try to load downloadable contents from PFS last to preserve enabled state.
|
|
||||||
if (AddDownloadableContent(_applicationData.Path, out var newDlc) && newDlc > 0)
|
|
||||||
{
|
|
||||||
ShowNewDlcAddedDialog(newDlc);
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE: Save the list again to remove leftovers.
|
|
||||||
Save();
|
|
||||||
Sort();
|
Sort();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,7 +174,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
|
|
||||||
if (totalDlcAdded > 0)
|
if (totalDlcAdded > 0)
|
||||||
{
|
{
|
||||||
await ShowNewDlcAddedDialog(0);
|
await ShowNewDlcAddedDialog(totalDlcAdded);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,7 +197,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
if (!DownloadableContents.Contains(dlc))
|
if (!DownloadableContents.Contains(dlc))
|
||||||
{
|
{
|
||||||
DownloadableContents.Add(dlc);
|
DownloadableContents.Add(dlc);
|
||||||
Dispatcher.UIThread.InvokeAsync(() => SelectedDownloadableContents.ReplaceOrAdd(dlc, dlc));
|
SelectedDownloadableContents.ReplaceOrAdd(dlc, dlc);
|
||||||
|
|
||||||
numDlcAdded++;
|
numDlcAdded++;
|
||||||
}
|
}
|
||||||
@ -276,6 +268,5 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||||||
await ContentDialogHelper.ShowTextDialog(LocaleManager.Instance[LocaleKeys.DialogConfirmationTitle], msg, "", "", "", LocaleManager.Instance[LocaleKeys.InputDialogOk], (int)Symbol.Checkmark);
|
await ContentDialogHelper.ShowTextDialog(LocaleManager.Instance[LocaleKeys.DialogConfirmationTitle], msg, "", "", "", LocaleManager.Instance[LocaleKeys.InputDialogOk], (int)Symbol.Checkmark);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user