Archived
1
0
Fork 0
forked from Mirror/Ryujinx

Ava UI: Auto select newly added updates & DLC (#7026)

* Fix DLC not being selected

* FIx conflicts

* Apply suggestions from code review

Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com>

---------

Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com>
This commit is contained in:
Isaac Marovitz 2024-07-19 18:00:15 +01:00 committed by GitHub
parent 827069e784
commit 2cb80f37d4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 4 deletions

View file

@ -263,7 +263,7 @@ namespace Ryujinx.Ava.UI.ViewModels
var content = new DownloadableContentModel(nca.Header.TitleId.ToString("X16"), path, fileEntry.FullPath, true); var content = new DownloadableContentModel(nca.Header.TitleId.ToString("X16"), path, fileEntry.FullPath, true);
DownloadableContents.Add(content); DownloadableContents.Add(content);
SelectedDownloadableContents.Add(content); Dispatcher.UIThread.InvokeAsync(() => SelectedDownloadableContents.Add(content));
success = true; success = true;
} }

View file

@ -169,7 +169,7 @@ namespace Ryujinx.Ava.UI.ViewModels
} }
} }
private void AddUpdate(string path, bool ignoreNotFound = false) private void AddUpdate(string path, bool ignoreNotFound = false, bool selected = false)
{ {
if (!File.Exists(path) || TitleUpdates.Any(x => x.Path == path)) if (!File.Exists(path) || TitleUpdates.Any(x => x.Path == path))
{ {
@ -204,7 +204,13 @@ namespace Ryujinx.Ava.UI.ViewModels
controlNca.OpenFileSystem(NcaSectionType.Data, IntegrityCheckLevel.None).OpenFile(ref nacpFile.Ref, "/control.nacp".ToU8Span(), OpenMode.Read).ThrowIfFailure(); controlNca.OpenFileSystem(NcaSectionType.Data, IntegrityCheckLevel.None).OpenFile(ref nacpFile.Ref, "/control.nacp".ToU8Span(), OpenMode.Read).ThrowIfFailure();
nacpFile.Get.Read(out _, 0, SpanHelpers.AsByteSpan(ref controlData), ReadOption.None).ThrowIfFailure(); nacpFile.Get.Read(out _, 0, SpanHelpers.AsByteSpan(ref controlData), ReadOption.None).ThrowIfFailure();
TitleUpdates.Add(new TitleUpdateModel(controlData, path)); var update = new TitleUpdateModel(controlData, path);
TitleUpdates.Add(update);
if (selected)
{
Dispatcher.UIThread.InvokeAsync(() => SelectedUpdate = update);
}
} }
else else
{ {
@ -245,7 +251,7 @@ namespace Ryujinx.Ava.UI.ViewModels
foreach (var file in result) foreach (var file in result)
{ {
AddUpdate(file.Path.LocalPath); AddUpdate(file.Path.LocalPath, selected: true);
} }
SortUpdates(); SortUpdates();