From bf52e9d440e280351b36d05259fdca77e9108ff9 Mon Sep 17 00:00:00 2001 From: Emmanuel Hansen Date: Tue, 8 Mar 2022 12:19:05 +0000 Subject: [PATCH] rebased. --- Ryujinx.Ava/Assets/Locales/en_US.json | 6 ++++- Ryujinx.Ava/Configuration/LoggerModule.cs | 2 +- Ryujinx.Ava/Modules/Updater/Updater.cs | 24 +++++++++++++++++-- Ryujinx.Ava/Program.cs | 13 ++++++++++ Ryujinx.Ava/Ui/Controls/GameGridView.axaml | 4 ++++ .../Ui/ViewModels/MainWindowViewModel.cs | 16 ++++++++++++- Ryujinx.Ava/Ui/Windows/MainWindow.axaml | 4 ++++ Ryujinx.Ava/Ui/Windows/MainWindow.axaml.cs | 2 +- .../IParentalControlService.cs | 1 + 9 files changed, 66 insertions(+), 6 deletions(-) diff --git a/Ryujinx.Ava/Assets/Locales/en_US.json b/Ryujinx.Ava/Assets/Locales/en_US.json index a3262a04fd57..4267e025cf8c 100644 --- a/Ryujinx.Ava/Assets/Locales/en_US.json +++ b/Ryujinx.Ava/Assets/Locales/en_US.json @@ -506,5 +506,9 @@ "SettingsTabGraphicsFrameRate" : "Host Refresh Rate:", "SettingsTabGraphicsFrameRateTooltip" : "Sets host refresh rate. Set to 0 to remove limit.", "SettingsTabCpuCache" : "CPU Cache", - "SettingsTabCpuMemory" : "CPU Memory" + "SettingsTabCpuMemory" : "CPU Memory", + "DialogUpdaterFlatpakNotSupportedMessage" : "Please update Ryujinx via FlatHub.", + "UpdaterDisabledWarningTitle" : "Updater Disabled!", + "GameListContextMenuOpenSdModsDirectory": "Open Atmosphere Mods Directory", + "GameListContextMenuOpenSdModsDirectoryToolTip": "Opens the alternative SD card atmosphere directory which contains Application's Mods" } diff --git a/Ryujinx.Ava/Configuration/LoggerModule.cs b/Ryujinx.Ava/Configuration/LoggerModule.cs index e2ae1b73d795..857710300120 100644 --- a/Ryujinx.Ava/Configuration/LoggerModule.cs +++ b/Ryujinx.Ava/Configuration/LoggerModule.cs @@ -80,7 +80,7 @@ private static void ReloadFileLogger(object sender, ReactiveEventArgs e) if (e.NewValue) { Logger.AddTarget(new AsyncLogTargetWrapper( - new FileLogTarget(AppDomain.CurrentDomain.BaseDirectory, "file"), + new FileLogTarget(ReleaseInformations.GetBaseApplicationDirectory(), "file"), 1000, AsyncLogTargetOverflowAction.Block )); diff --git a/Ryujinx.Ava/Modules/Updater/Updater.cs b/Ryujinx.Ava/Modules/Updater/Updater.cs index 3e20408dae4b..a5e4459f2c98 100644 --- a/Ryujinx.Ava/Modules/Updater/Updater.cs +++ b/Ryujinx.Ava/Modules/Updater/Updater.cs @@ -304,7 +304,7 @@ private static void DoUpdateWithMultipleThreads(UpdaterWindow updateDialog, stri catch (Exception e) { Logger.Warning?.Print(LogClass.Application, e.Message); - Logger.Warning?.Print(LogClass.Application, $"Multi-Threaded update failed, falling back to single-threaded updater."); + Logger.Warning?.Print(LogClass.Application, "Multi-Threaded update failed, falling back to single-threaded updater."); DoUpdateWithSingleThread(updateDialog, downloadUrl, updateFile); @@ -320,7 +320,7 @@ private static void DoUpdateWithMultipleThreads(UpdaterWindow updateDialog, stri catch (WebException ex) { Logger.Warning?.Print(LogClass.Application, ex.Message); - Logger.Warning?.Print(LogClass.Application, $"Multi-Threaded update failed, falling back to single-threaded updater."); + Logger.Warning?.Print(LogClass.Application, "Multi-Threaded update failed, falling back to single-threaded updater."); for (int j = 0; j < webClients.Count; j++) { @@ -523,6 +523,7 @@ await Task.Run(() => public static bool CanUpdate(bool showWarnings, StyleableWindow parent) { +#if !DISABLE_UPDATER if (RuntimeInformation.OSArchitecture != Architecture.X64) { if (showWarnings) @@ -557,6 +558,25 @@ public static bool CanUpdate(bool showWarnings, StyleableWindow parent) } return true; +#else + if (showWarnings) + { + if (ReleaseInformations.IsFlatHubBuild()) + { + ContentDialogHelper.CreateWarningDialog(parent, + LocaleManager.Instance["UpdaterDisabledWarningTitle"], + LocaleManager.Instance["DialogUpdaterFlatpakNotSupportedMessage"]); + } + else + { + ContentDialogHelper.CreateWarningDialog(parent, + LocaleManager.Instance["UpdaterDisabledWarningTitle"], + LocaleManager.Instance["DialogUpdaterDirtyBuildSubMessage"]); + } + } +#endif + + return false; } // NOTE: This method should always reflect the latest build layout.s diff --git a/Ryujinx.Ava/Program.cs b/Ryujinx.Ava/Program.cs index 3face390163b..65c9865a47f0 100644 --- a/Ryujinx.Ava/Program.cs +++ b/Ryujinx.Ava/Program.cs @@ -34,6 +34,8 @@ internal class Program public static double WindowScaleFactor { get; set; } public static string Version { get; private set; } public static string ConfigurationPath { get; private set; } + + public static string CommandLineProfile { get; set; } public static bool PreviewerDetached { get; private set; } public static AdjustableRenderTimer RenderTimer { get; private set; } @@ -106,6 +108,17 @@ private static void Initialize(string[] args) baseDirPathArg = args[++i]; } + else if (arg == "-p" || arg == "--profile") + { + if (i + 1 >= args.Length) + { + Logger.Error?.Print(LogClass.Application, $"Invalid option '{arg}'"); + + continue; + } + + CommandLineProfile = args[++i]; + } else if (arg == "-f" || arg == "--fullscreen") { startFullscreenArg = true; diff --git a/Ryujinx.Ava/Ui/Controls/GameGridView.axaml b/Ryujinx.Ava/Ui/Controls/GameGridView.axaml index 3af40af211b8..c16995e3eb28 100644 --- a/Ryujinx.Ava/Ui/Controls/GameGridView.axaml +++ b/Ryujinx.Ava/Ui/Controls/GameGridView.axaml @@ -44,6 +44,10 @@ Command="{Binding OpenModsDirectory}" Header="{locale:Locale GameListContextMenuOpenModsDirectory}" ToolTip.Tip="{locale:Locale GameListContextMenuOpenModsDirectoryToolTip}" /> + +