mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-12-26 18:43:04 +00:00
Add setting for autoloading dlc/updates
This commit is contained in:
parent
a381cea311
commit
bc60126a24
7 changed files with 172 additions and 124 deletions
|
@ -779,6 +779,11 @@ namespace Ryujinx.UI.App.Common
|
|||
}
|
||||
}
|
||||
|
||||
public void LoadTitleUpdates()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public void LoadDownloadableContents()
|
||||
{
|
||||
_downloadableContents.Edit(it =>
|
||||
|
@ -790,7 +795,7 @@ namespace Ryujinx.UI.App.Common
|
|||
var savedDlc = DownloadableContentsHelper.LoadDownloadableContentsJson(_virtualFileSystem, application.IdBase);
|
||||
it.AddOrUpdate(savedDlc);
|
||||
|
||||
if(TryGetDownloadableContentFromFile(application.Path, out var bundledDlc))
|
||||
if (TryGetDownloadableContentFromFile(application.Path, out var bundledDlc))
|
||||
{
|
||||
var savedDlcLookup = savedDlc.Select(dlc => dlc.Item1).ToHashSet();
|
||||
|
||||
|
@ -932,9 +937,9 @@ namespace Ryujinx.UI.App.Common
|
|||
return newDlcLoaded;
|
||||
}
|
||||
|
||||
public void AutoLoadTitleUpdates(List<string> appDirs)
|
||||
public int AutoLoadTitleUpdates(List<string> appDirs)
|
||||
{
|
||||
return;
|
||||
return 0;
|
||||
// _cancellationToken = new CancellationTokenSource();
|
||||
// _titleUpdates.Clear();
|
||||
//
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Ryujinx.UI.Common.Configuration
|
|||
/// <summary>
|
||||
/// The current version of the file format
|
||||
/// </summary>
|
||||
public const int CurrentVersion = 51;
|
||||
public const int CurrentVersion = 52;
|
||||
|
||||
/// <summary>
|
||||
/// Version of the configuration file format
|
||||
|
@ -167,6 +167,11 @@ namespace Ryujinx.UI.Common.Configuration
|
|||
/// </summary>
|
||||
public bool RememberWindowState { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables automatically loading DLC/title updates on library refresh.
|
||||
/// </summary>
|
||||
public bool AutoloadContent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables hardware-accelerated rendering for Avalonia
|
||||
/// </summary>
|
||||
|
|
|
@ -632,6 +632,11 @@ namespace Ryujinx.UI.Common.Configuration
|
|||
/// </summary>
|
||||
public ReactiveObject<bool> RememberWindowState { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables automatically loading DLC/title updates on library refresh.
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> AutoloadContent { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables hardware-accelerated rendering for Avalonia
|
||||
/// </summary>
|
||||
|
@ -654,6 +659,7 @@ namespace Ryujinx.UI.Common.Configuration
|
|||
CheckUpdatesOnStart = new ReactiveObject<bool>();
|
||||
ShowConfirmExit = new ReactiveObject<bool>();
|
||||
RememberWindowState = new ReactiveObject<bool>();
|
||||
AutoloadContent = new ReactiveObject<bool>();
|
||||
EnableHardwareAcceleration = new ReactiveObject<bool>();
|
||||
HideCursor = new ReactiveObject<HideCursorMode>();
|
||||
}
|
||||
|
@ -692,6 +698,7 @@ namespace Ryujinx.UI.Common.Configuration
|
|||
CheckUpdatesOnStart = CheckUpdatesOnStart,
|
||||
ShowConfirmExit = ShowConfirmExit,
|
||||
RememberWindowState = RememberWindowState,
|
||||
AutoloadContent = AutoloadContent,
|
||||
EnableHardwareAcceleration = EnableHardwareAcceleration,
|
||||
HideCursor = HideCursor,
|
||||
EnableVsync = Graphics.EnableVsync,
|
||||
|
@ -801,6 +808,7 @@ namespace Ryujinx.UI.Common.Configuration
|
|||
CheckUpdatesOnStart.Value = true;
|
||||
ShowConfirmExit.Value = true;
|
||||
RememberWindowState.Value = true;
|
||||
AutoloadContent.Value = false;
|
||||
EnableHardwareAcceleration.Value = true;
|
||||
HideCursor.Value = HideCursorMode.OnIdle;
|
||||
Graphics.EnableVsync.Value = true;
|
||||
|
@ -1477,6 +1485,15 @@ namespace Ryujinx.UI.Common.Configuration
|
|||
configurationFileUpdated = true;
|
||||
}
|
||||
|
||||
if (configurationFileFormat.Version < 52)
|
||||
{
|
||||
Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 52.");
|
||||
|
||||
configurationFileFormat.AutoloadContent = false;
|
||||
|
||||
configurationFileUpdated = true;
|
||||
}
|
||||
|
||||
Logger.EnableFileLog.Value = configurationFileFormat.EnableFileLog;
|
||||
Graphics.ResScale.Value = configurationFileFormat.ResScale;
|
||||
Graphics.ResScaleCustom.Value = configurationFileFormat.ResScaleCustom;
|
||||
|
@ -1508,6 +1525,7 @@ namespace Ryujinx.UI.Common.Configuration
|
|||
CheckUpdatesOnStart.Value = configurationFileFormat.CheckUpdatesOnStart;
|
||||
ShowConfirmExit.Value = configurationFileFormat.ShowConfirmExit;
|
||||
RememberWindowState.Value = configurationFileFormat.RememberWindowState;
|
||||
AutoloadContent.Value = configurationFileFormat.AutoloadContent;
|
||||
EnableHardwareAcceleration.Value = configurationFileFormat.EnableHardwareAcceleration;
|
||||
HideCursor.Value = configurationFileFormat.HideCursor;
|
||||
Graphics.EnableVsync.Value = configurationFileFormat.EnableVsync;
|
||||
|
|
|
@ -98,6 +98,7 @@
|
|||
"SettingsTabGeneralCheckUpdatesOnLaunch": "Check for Updates on Launch",
|
||||
"SettingsTabGeneralShowConfirmExitDialog": "Show \"Confirm Exit\" Dialog",
|
||||
"SettingsTabGeneralRememberWindowState": "Remember Window Size/Position",
|
||||
"SettingsTabGeneralAutoloadContent": "Automatically load DLC/updates",
|
||||
"SettingsTabGeneralHideCursor": "Hide Cursor:",
|
||||
"SettingsTabGeneralHideCursorNever": "Never",
|
||||
"SettingsTabGeneralHideCursorOnIdle": "On Idle",
|
||||
|
@ -709,7 +710,7 @@
|
|||
"DlcWindowTitle": "Manage Downloadable Content for {0} ({1})",
|
||||
"ModWindowTitle": "Manage Mods for {0} ({1})",
|
||||
"UpdateWindowTitle": "Title Update Manager",
|
||||
"UpdateWindowUpdateAddedMessage": "{0} new update(s) added",
|
||||
"UpdateWindowDlcAddedMessage": "{0} new update(s) added",
|
||||
"CheatWindowHeading": "Cheats Available for {0} [{1}]",
|
||||
"BuildId": "BuildId:",
|
||||
"DlcWindowBundledContentNotice": "Bundled DLC cannot be removed, only disabled.",
|
||||
|
|
|
@ -132,6 +132,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
public bool CheckUpdatesOnStart { get; set; }
|
||||
public bool ShowConfirmExit { get; set; }
|
||||
public bool RememberWindowState { get; set; }
|
||||
public bool AutoloadContent { get; set; }
|
||||
public int HideCursor { get; set; }
|
||||
public bool EnableDockedMode { get; set; }
|
||||
public bool EnableKeyboard { get; set; }
|
||||
|
@ -392,6 +393,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
CheckUpdatesOnStart = config.CheckUpdatesOnStart;
|
||||
ShowConfirmExit = config.ShowConfirmExit;
|
||||
RememberWindowState = config.RememberWindowState;
|
||||
AutoloadContent = config.AutoloadContent;
|
||||
HideCursor = (int)config.HideCursor.Value;
|
||||
|
||||
GameDirectories.Clear();
|
||||
|
@ -484,6 +486,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
config.CheckUpdatesOnStart.Value = CheckUpdatesOnStart;
|
||||
config.ShowConfirmExit.Value = ShowConfirmExit;
|
||||
config.RememberWindowState.Value = RememberWindowState;
|
||||
config.AutoloadContent.Value = AutoloadContent;
|
||||
config.HideCursor.Value = (HideCursorMode)HideCursor;
|
||||
|
||||
if (_directoryChanged)
|
||||
|
|
|
@ -39,6 +39,9 @@
|
|||
<CheckBox IsChecked="{Binding RememberWindowState}">
|
||||
<TextBlock Text="{locale:Locale SettingsTabGeneralRememberWindowState}" />
|
||||
</CheckBox>
|
||||
<CheckBox IsChecked="{Binding AutoloadContent}">
|
||||
<TextBlock Text="{locale:Locale SettingsTabGeneralAutoloadContent}" />
|
||||
</CheckBox>
|
||||
<StackPanel Margin="0, 15, 0, 0" Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center"
|
||||
Text="{locale:Locale SettingsTabGeneralHideCursor}"
|
||||
|
|
|
@ -651,15 +651,22 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
{
|
||||
ApplicationLibrary.DesiredLanguage = ConfigurationState.Instance.System.Language;
|
||||
TimeIt("games", () => ApplicationLibrary.LoadApplications(ConfigurationState.Instance.UI.GameDirs));
|
||||
// TimeIt("updates", () => ApplicationLibrary.LoadTitleUpdates(ConfigurationState.Instance.UI.GameDirs));
|
||||
TimeIt("updates", () => ApplicationLibrary.LoadTitleUpdates());
|
||||
TimeIt("DLC", () => ApplicationLibrary.LoadDownloadableContents());
|
||||
// TODO(jpr): conditional
|
||||
var dlcLoaded = 0;
|
||||
TimeIt("AUTO DLC", () => dlcLoaded = ApplicationLibrary.AutoLoadDownloadableContents(ConfigurationState.Instance.UI.GameDirs));
|
||||
|
||||
if (dlcLoaded > 0)
|
||||
if (ConfigurationState.Instance.AutoloadContent)
|
||||
{
|
||||
ShowNewContentAddedDialog(dlcLoaded, 0);
|
||||
var updatesLoaded = 0;
|
||||
TimeIt("auto updates",
|
||||
() => updatesLoaded =
|
||||
ApplicationLibrary.AutoLoadTitleUpdates(ConfigurationState.Instance.UI.GameDirs));
|
||||
|
||||
var dlcLoaded = 0;
|
||||
TimeIt("auto dlc",
|
||||
() => dlcLoaded =
|
||||
ApplicationLibrary.AutoLoadDownloadableContents(ConfigurationState.Instance.UI.GameDirs));
|
||||
|
||||
ShowNewContentAddedDialog(dlcLoaded, updatesLoaded);
|
||||
}
|
||||
|
||||
_isLoading = false;
|
||||
|
@ -687,15 +694,21 @@ namespace Ryujinx.Ava.UI.Windows
|
|||
if (numDlcAdded > 0 && numUpdatesAdded > 0)
|
||||
{
|
||||
msg = string.Format(LocaleManager.Instance[LocaleKeys.AutoloadDlcAndUpdateAddedMessage], numDlcAdded, numUpdatesAdded);
|
||||
} else if (numDlcAdded > 0)
|
||||
}
|
||||
else if (numDlcAdded > 0)
|
||||
{
|
||||
msg = string.Format(LocaleManager.Instance[LocaleKeys.AutoloadDlcAddedMessage], numDlcAdded);
|
||||
} else if (numUpdatesAdded > 0)
|
||||
}
|
||||
else if (numUpdatesAdded > 0)
|
||||
{
|
||||
msg = string.Format(LocaleManager.Instance[LocaleKeys.AutoloadUpdateAddedMessage], numUpdatesAdded);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
return msg == "" ? Task.CompletedTask : Dispatcher.UIThread.InvokeAsync(async () =>
|
||||
return Dispatcher.UIThread.InvokeAsync(async () =>
|
||||
{
|
||||
await ContentDialogHelper.ShowTextDialog(LocaleManager.Instance[LocaleKeys.DialogConfirmationTitle],
|
||||
msg, "", "", "", LocaleManager.Instance[LocaleKeys.InputDialogOk], (int)Symbol.Checkmark);
|
||||
|
|
Loading…
Reference in a new issue