mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2025-01-09 11:17:20 -03:00
misc: Prevent value change logging when the value is changed to the same thing it was before the value change.
This commit is contained in:
parent
3fa714bb72
commit
732aafd3bb
2 changed files with 24 additions and 66 deletions
|
@ -53,6 +53,17 @@ namespace Ryujinx.Common
|
||||||
{
|
{
|
||||||
public static void LogValueChange<T>(LogClass logClass, ReactiveEventArgs<T> eventArgs, string valueName)
|
public static void LogValueChange<T>(LogClass logClass, ReactiveEventArgs<T> eventArgs, string valueName)
|
||||||
{
|
{
|
||||||
|
if ((eventArgs.NewValue == null || eventArgs.OldValue == null))
|
||||||
|
{
|
||||||
|
if (!(eventArgs.NewValue == null && eventArgs.OldValue == null))
|
||||||
|
goto Log;
|
||||||
|
}
|
||||||
|
else if (!eventArgs.NewValue!.Equals(eventArgs.OldValue))
|
||||||
|
goto Log;
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
Log:
|
||||||
string message = string.Create(CultureInfo.InvariantCulture, $"{valueName} set to: {eventArgs.NewValue}");
|
string message = string.Create(CultureInfo.InvariantCulture, $"{valueName} set to: {eventArgs.NewValue}");
|
||||||
|
|
||||||
Logger.Info?.Print(logClass, message);
|
Logger.Info?.Print(logClass, message);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using Avalonia.Collections;
|
using Avalonia.Collections;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Threading;
|
using Avalonia.Threading;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using Gommon;
|
using Gommon;
|
||||||
using LibHac.Tools.FsSystem;
|
using LibHac.Tools.FsSystem;
|
||||||
using Ryujinx.Audio.Backends.OpenAL;
|
using Ryujinx.Audio.Backends.OpenAL;
|
||||||
|
@ -46,9 +47,9 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
private int _resolutionScale;
|
private int _resolutionScale;
|
||||||
private int _graphicsBackendMultithreadingIndex;
|
private int _graphicsBackendMultithreadingIndex;
|
||||||
private float _volume;
|
private float _volume;
|
||||||
private bool _isVulkanAvailable = true;
|
[ObservableProperty] private bool _isVulkanAvailable = true;
|
||||||
private bool _gameDirectoryChanged;
|
[ObservableProperty] private bool _gameDirectoryChanged;
|
||||||
private bool _autoloadDirectoryChanged;
|
[ObservableProperty] private bool _autoloadDirectoryChanged;
|
||||||
private readonly List<string> _gpuIds = new();
|
private readonly List<string> _gpuIds = new();
|
||||||
private int _graphicsBackendIndex;
|
private int _graphicsBackendIndex;
|
||||||
private int _scalingFilter;
|
private int _scalingFilter;
|
||||||
|
@ -63,7 +64,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
private int _networkInterfaceIndex;
|
private int _networkInterfaceIndex;
|
||||||
private int _multiplayerModeIndex;
|
private int _multiplayerModeIndex;
|
||||||
private string _ldnPassphrase;
|
private string _ldnPassphrase;
|
||||||
private string _ldnServer;
|
[ObservableProperty] private string _ldnServer;
|
||||||
|
|
||||||
public SettingsHacksViewModel DirtyHacks { get; }
|
public SettingsHacksViewModel DirtyHacks { get; }
|
||||||
|
|
||||||
|
@ -111,43 +112,10 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsVulkanAvailable
|
|
||||||
{
|
|
||||||
get => _isVulkanAvailable;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_isVulkanAvailable = value;
|
|
||||||
|
|
||||||
OnPropertyChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsOpenGLAvailable => !OperatingSystem.IsMacOS();
|
public bool IsOpenGLAvailable => !OperatingSystem.IsMacOS();
|
||||||
|
|
||||||
public bool IsAppleSiliconMac => OperatingSystem.IsMacOS() && RuntimeInformation.ProcessArchitecture == Architecture.Arm64;
|
public bool IsAppleSiliconMac => OperatingSystem.IsMacOS() && RuntimeInformation.ProcessArchitecture == Architecture.Arm64;
|
||||||
|
|
||||||
public bool GameDirectoryChanged
|
|
||||||
{
|
|
||||||
get => _gameDirectoryChanged;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_gameDirectoryChanged = value;
|
|
||||||
|
|
||||||
OnPropertyChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool AutoloadDirectoryChanged
|
|
||||||
{
|
|
||||||
get => _autoloadDirectoryChanged;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_autoloadDirectoryChanged = value;
|
|
||||||
|
|
||||||
OnPropertyChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsMacOS => OperatingSystem.IsMacOS();
|
public bool IsMacOS => OperatingSystem.IsMacOS();
|
||||||
|
|
||||||
public bool EnableDiscordIntegration { get; set; }
|
public bool EnableDiscordIntegration { get; set; }
|
||||||
|
@ -182,19 +150,12 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
_customVSyncInterval = newInterval;
|
_customVSyncInterval = newInterval;
|
||||||
_customVSyncIntervalPercentageProxy = value;
|
_customVSyncIntervalPercentageProxy = value;
|
||||||
OnPropertiesChanged(
|
OnPropertiesChanged(
|
||||||
nameof(CustomVSyncInterval),
|
nameof(CustomVSyncInterval),
|
||||||
nameof(CustomVSyncIntervalPercentageText));
|
nameof(CustomVSyncIntervalPercentageText));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string CustomVSyncIntervalPercentageText
|
public string CustomVSyncIntervalPercentageText => CustomVSyncIntervalPercentageProxy + "%";
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
string text = CustomVSyncIntervalPercentageProxy + "%";
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool EnableCustomVSyncInterval
|
public bool EnableCustomVSyncInterval
|
||||||
{
|
{
|
||||||
|
@ -356,7 +317,6 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_networkInterfaceIndex = value != -1 ? value : 0;
|
_networkInterfaceIndex = value != -1 ? value : 0;
|
||||||
ConfigurationState.Instance.Multiplayer.LanInterfaceId.Value = _networkInterfaces[NetworkInterfaceList[_networkInterfaceIndex]];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,7 +326,6 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_multiplayerModeIndex = value;
|
_multiplayerModeIndex = value;
|
||||||
ConfigurationState.Instance.Multiplayer.Mode.Value = (MultiplayerMode)_multiplayerModeIndex;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,16 +334,6 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
|
|
||||||
public bool IsInvalidLdnPassphraseVisible { get; set; }
|
public bool IsInvalidLdnPassphraseVisible { get; set; }
|
||||||
|
|
||||||
public string LdnServer
|
|
||||||
{
|
|
||||||
get => _ldnServer;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_ldnServer = value;
|
|
||||||
OnPropertyChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public SettingsViewModel(VirtualFileSystem virtualFileSystem, ContentManager contentManager) : this()
|
public SettingsViewModel(VirtualFileSystem virtualFileSystem, ContentManager contentManager) : this()
|
||||||
{
|
{
|
||||||
_virtualFileSystem = virtualFileSystem;
|
_virtualFileSystem = virtualFileSystem;
|
||||||
|
@ -647,16 +596,14 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
config.ShowTitleBar.Value = ShowTitleBar;
|
config.ShowTitleBar.Value = ShowTitleBar;
|
||||||
config.HideCursor.Value = (HideCursorMode)HideCursor;
|
config.HideCursor.Value = (HideCursorMode)HideCursor;
|
||||||
|
|
||||||
if (_gameDirectoryChanged)
|
if (GameDirectoryChanged)
|
||||||
{
|
{
|
||||||
List<string> gameDirs = new(GameDirectories);
|
config.UI.GameDirs.Value = [..GameDirectories];
|
||||||
config.UI.GameDirs.Value = gameDirs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_autoloadDirectoryChanged)
|
if (AutoloadDirectoryChanged)
|
||||||
{
|
{
|
||||||
List<string> autoloadDirs = new(AutoloadDirectories);
|
config.UI.AutoloadDirs.Value = [..AutoloadDirectories];
|
||||||
config.UI.AutoloadDirs.Value = autoloadDirs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
config.UI.BaseStyle.Value = BaseStyleIndex switch
|
config.UI.BaseStyle.Value = BaseStyleIndex switch
|
||||||
|
@ -766,8 +713,8 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
|
|
||||||
SaveSettingsEvent?.Invoke();
|
SaveSettingsEvent?.Invoke();
|
||||||
|
|
||||||
_gameDirectoryChanged = false;
|
GameDirectoryChanged = false;
|
||||||
_autoloadDirectoryChanged = false;
|
AutoloadDirectoryChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void RevertIfNotSaved()
|
private static void RevertIfNotSaved()
|
||||||
|
|
Loading…
Reference in a new issue