From 091230af222a309584ab35df8379ab3a725cd3c1 Mon Sep 17 00:00:00 2001 From: SamusAranX Date: Wed, 15 May 2024 18:10:47 +0200 Subject: [PATCH] Improves some log messages and fixes a typo (#6773) * Improves some log messages and fixes a typo * oops * Update src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs Co-authored-by: Ac_K * Log config file path --------- Co-authored-by: Ac_K Co-authored-by: TSR Berry <20988865+TSRBerry@users.noreply.github.com> --- src/Ryujinx.Gtk3/Program.cs | 7 +++++-- src/Ryujinx.UI.Common/App/ApplicationData.cs | 2 +- src/Ryujinx.UI.Common/App/ApplicationLibrary.cs | 2 +- src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs | 5 ++++- src/Ryujinx/Program.cs | 7 +++++-- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/Ryujinx.Gtk3/Program.cs b/src/Ryujinx.Gtk3/Program.cs index f69934313..749cb6978 100644 --- a/src/Ryujinx.Gtk3/Program.cs +++ b/src/Ryujinx.Gtk3/Program.cs @@ -181,21 +181,24 @@ namespace Ryujinx { // No configuration, we load the default values and save it to disk ConfigurationPath = appDataConfigurationPath; + Logger.Notice.Print(LogClass.Application, $"No configuration file found. Saving default configuration to: {ConfigurationPath}"); ConfigurationState.Instance.LoadDefault(); ConfigurationState.Instance.ToFileFormat().SaveConfig(ConfigurationPath); } else { + Logger.Notice.Print(LogClass.Application, $"Loading configuration from: {ConfigurationPath}"); + if (ConfigurationFileFormat.TryLoad(ConfigurationPath, out ConfigurationFileFormat configurationFileFormat)) { ConfigurationState.Instance.Load(configurationFileFormat, ConfigurationPath); } else { - ConfigurationState.Instance.LoadDefault(); + Logger.Warning?.PrintMsg(LogClass.Application, $"Failed to load config! Loading the default config instead.\nFailed config location: {ConfigurationPath}"); - Logger.Warning?.PrintMsg(LogClass.Application, $"Failed to load config! Loading the default config instead.\nFailed config location {ConfigurationPath}"); + ConfigurationState.Instance.LoadDefault(); } } diff --git a/src/Ryujinx.UI.Common/App/ApplicationData.cs b/src/Ryujinx.UI.Common/App/ApplicationData.cs index 8cc7238e9..13c05655b 100644 --- a/src/Ryujinx.UI.Common/App/ApplicationData.cs +++ b/src/Ryujinx.UI.Common/App/ApplicationData.cs @@ -45,7 +45,7 @@ namespace Ryujinx.UI.App.Common if (!System.IO.Path.Exists(titleFilePath)) { - Logger.Error?.Print(LogClass.Application, $"File does not exists. {titleFilePath}"); + Logger.Error?.Print(LogClass.Application, $"File \"{titleFilePath}\" does not exist."); return string.Empty; } diff --git a/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs b/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs index 65cf7a9e6..82783e638 100644 --- a/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs +++ b/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs @@ -106,7 +106,7 @@ namespace Ryujinx.UI.App.Common if (!Directory.Exists(appDir)) { - Logger.Warning?.Print(LogClass.Application, $"The \"game_dirs\" section in \"{ReleaseInformation.ConfigName}\" contains an invalid directory: \"{appDir}\""); + Logger.Warning?.Print(LogClass.Application, $"The specified game directory \"{appDir}\" does not exist."); continue; } diff --git a/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs b/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs index 01c60a5e2..8420dc5d9 100644 --- a/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs +++ b/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs @@ -11,6 +11,7 @@ using Ryujinx.UI.Common.Configuration.UI; using Ryujinx.UI.Common.Helper; using System; using System.Collections.Generic; +using System.Globalization; using System.Text.Json.Nodes; namespace Ryujinx.UI.Common.Configuration @@ -1594,7 +1595,9 @@ namespace Ryujinx.UI.Common.Configuration private static void LogValueChange(ReactiveEventArgs eventArgs, string valueName) { - Ryujinx.Common.Logging.Logger.Info?.Print(LogClass.Configuration, $"{valueName} set to: {eventArgs.NewValue}"); + string message = string.Create(CultureInfo.InvariantCulture, $"{valueName} set to: {eventArgs.NewValue}"); + + Ryujinx.Common.Logging.Logger.Info?.Print(LogClass.Configuration, message); } public static void Initialize() diff --git a/src/Ryujinx/Program.cs b/src/Ryujinx/Program.cs index f925ce154..4f68ca24f 100644 --- a/src/Ryujinx/Program.cs +++ b/src/Ryujinx/Program.cs @@ -148,21 +148,24 @@ namespace Ryujinx.Ava { // No configuration, we load the default values and save it to disk ConfigurationPath = appDataConfigurationPath; + Logger.Notice.Print(LogClass.Application, $"No configuration file found. Saving default configuration to: {ConfigurationPath}"); ConfigurationState.Instance.LoadDefault(); ConfigurationState.Instance.ToFileFormat().SaveConfig(ConfigurationPath); } else { + Logger.Notice.Print(LogClass.Application, $"Loading configuration from: {ConfigurationPath}"); + if (ConfigurationFileFormat.TryLoad(ConfigurationPath, out ConfigurationFileFormat configurationFileFormat)) { ConfigurationState.Instance.Load(configurationFileFormat, ConfigurationPath); } else { - ConfigurationState.Instance.LoadDefault(); + Logger.Warning?.PrintMsg(LogClass.Application, $"Failed to load config! Loading the default config instead.\nFailed config location: {ConfigurationPath}"); - Logger.Warning?.PrintMsg(LogClass.Application, $"Failed to load config! Loading the default config instead.\nFailed config location {ConfigurationPath}"); + ConfigurationState.Instance.LoadDefault(); } }