Skip to content

Commit

Permalink
misc: chore: Use ApplicationLibrary helpers for getting DLCs & Update…
Browse files Browse the repository at this point in the history
…s for a game
  • Loading branch information
GreemDev committed Feb 5, 2025
1 parent b0fcc5b commit 222ceb8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ public DownloadableContentManagerViewModel(ApplicationLibrary applicationLibrary

private void LoadDownloadableContents()
{
IEnumerable<(DownloadableContentModel Dlc, bool IsEnabled)> dlcs = _applicationLibrary.DownloadableContents.Items
.Where(it => it.Dlc.TitleIdBase == _applicationData.IdBase);
(DownloadableContentModel Dlc, bool IsEnabled)[] dlcs = _applicationLibrary.FindDlcConfigurationFor(_applicationData.Id);

bool hasBundledContent = false;
foreach ((DownloadableContentModel dlc, bool isEnabled) in dlcs)
Expand Down
3 changes: 1 addition & 2 deletions src/Ryujinx/UI/ViewModels/TitleUpdateViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ public TitleUpdateViewModel(ApplicationLibrary applicationLibrary, ApplicationDa

private void LoadUpdates()
{
IEnumerable<(TitleUpdateModel TitleUpdate, bool IsSelected)> updates = ApplicationLibrary.TitleUpdates.Items
.Where(it => it.TitleUpdate.TitleIdBase == ApplicationData.IdBase);
(TitleUpdateModel TitleUpdate, bool IsSelected)[] updates = ApplicationLibrary.FindUpdateConfigurationFor(ApplicationData.Id);

bool hasBundledContent = false;
SelectedUpdate = new TitleUpdateViewModelNoUpdate();
Expand Down
6 changes: 6 additions & 0 deletions src/Ryujinx/Utilities/AppLibrary/ApplicationLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,15 @@ public bool FindUpdate(ulong id, out TitleUpdateModel foundData)
public TitleUpdateModel[] FindUpdatesFor(ulong id)
=> TitleUpdates.Keys.Where(x => x.TitleIdBase == (id & ~0x1FFFUL)).ToArray();

public (TitleUpdateModel TitleUpdate, bool IsSelected)[] FindUpdateConfigurationFor(ulong id)
=> TitleUpdates.Items.Where(x => x.TitleUpdate.TitleIdBase == (id & ~0x1FFFUL)).ToArray();

public DownloadableContentModel[] FindDlcsFor(ulong id)
=> DownloadableContents.Keys.Where(x => x.TitleIdBase == (id & ~0x1FFFUL)).ToArray();

public (DownloadableContentModel Dlc, bool IsEnabled)[] FindDlcConfigurationFor(ulong id)
=> DownloadableContents.Items.Where(x => x.Dlc.TitleIdBase == (id & ~0x1FFFUL)).ToArray();

public bool HasDlcs(ulong id)
=> DownloadableContents.Keys.Any(x => x.TitleIdBase == (id & ~0x1FFFUL));

Expand Down

0 comments on commit 222ceb8

Please sign in to comment.