mirror of
https://git.ryujinx.app/kenji-nx/ryujinx.git
synced 2025-12-18 10:37:04 +00:00
UI: Scanning for mods on DLC content
This commit is contained in:
parent
628a28290f
commit
01cd935cc3
5 changed files with 35 additions and 13 deletions
|
|
@ -12,6 +12,7 @@ using Ryujinx.Common.Configuration;
|
|||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.Common.Utilities;
|
||||
using Ryujinx.HLE.HOS;
|
||||
using Ryujinx.UI.App.Common;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
|
@ -28,6 +29,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
|
||||
private string _search;
|
||||
private readonly ulong _applicationId;
|
||||
private readonly ulong[] _installedDlcIds;
|
||||
private readonly IStorageProvider _storageProvider;
|
||||
|
||||
private static readonly ModMetadataJsonSerializerContext _serializerContext = new(JsonHelper.GetDefaultSerializerOptions());
|
||||
|
|
@ -80,10 +82,15 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
get => string.Format(LocaleManager.Instance[LocaleKeys.ModWindowHeading], Mods.Count);
|
||||
}
|
||||
|
||||
public ModManagerViewModel(ulong applicationId)
|
||||
public ModManagerViewModel(ulong applicationId, ulong applicationIdBase, ApplicationLibrary appLibrary)
|
||||
{
|
||||
_applicationId = applicationId;
|
||||
|
||||
_installedDlcIds = appLibrary.DownloadableContents.Keys
|
||||
.Where(x => x.TitleIdBase == applicationIdBase)
|
||||
.Select(x => x.TitleId)
|
||||
.ToArray();
|
||||
|
||||
_modJsonPath = Path.Combine(AppDataManager.GamesDirPath, applicationId.ToString("x16"), "mods.json");
|
||||
|
||||
if (Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
|
|
@ -91,10 +98,10 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
_storageProvider = desktop.MainWindow.StorageProvider;
|
||||
}
|
||||
|
||||
LoadMods(applicationId);
|
||||
LoadMods(applicationId, _installedDlcIds);
|
||||
}
|
||||
|
||||
private void LoadMods(ulong applicationId)
|
||||
private void LoadMods(ulong applicationId, ulong[] installedDlcIds)
|
||||
{
|
||||
Mods.Clear();
|
||||
SelectedMods.Clear();
|
||||
|
|
@ -106,7 +113,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
var inSd = path == ModLoader.GetSdModsBasePath();
|
||||
var modCache = new ModLoader.ModCache();
|
||||
|
||||
ModLoader.QueryContentsDir(modCache, new DirectoryInfo(Path.Combine(path, "contents")), applicationId);
|
||||
ModLoader.QueryContentsDir(modCache, new DirectoryInfo(Path.Combine(path, "contents")), applicationId, _installedDlcIds);
|
||||
|
||||
foreach (var mod in modCache.RomfsDirs)
|
||||
{
|
||||
|
|
@ -298,7 +305,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
File.Copy(file, file.Replace(directory.Parent.ToString(), destinationDir), true);
|
||||
}
|
||||
|
||||
LoadMods(_applicationId);
|
||||
LoadMods(_applicationId, _installedDlcIds);
|
||||
}
|
||||
|
||||
public async void Add()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue