Fix ~3500 analyser issues

See merge request ryubing/ryujinx!44
This commit is contained in:
MrKev
2025-05-30 17:08:34 -05:00
committed by LotP
parent 417df486b1
commit 361d0c5632
622 changed files with 3080 additions and 2652 deletions

View File

@@ -111,7 +111,7 @@ namespace Ryujinx.Ava.Systems.Configuration
/// Enables printing FS access log messages
/// </summary>
public bool LoggingEnableFsAccessLog { get; set; }
/// <summary>
/// Enables log messages from Avalonia
/// </summary>
@@ -146,7 +146,7 @@ namespace Ryujinx.Ava.Systems.Configuration
/// Change System Time Offset in seconds
/// </summary>
public long SystemTimeOffset { get; set; }
/// <summary>
/// Instead of setting the time via configuration, use the values provided by the system.
/// </summary>
@@ -166,12 +166,12 @@ namespace Ryujinx.Ava.Systems.Configuration
/// DEPRECATED: Checks for updates when Ryujinx starts when enabled
/// </summary>
public bool CheckUpdatesOnStart { get; set; }
/// <summary>
/// Checks for updates when Ryujinx starts when enabled, either prompting when an update is found or just showing a notification.
/// </summary>
public UpdaterType UpdateCheckerType { get; set; }
/// <summary>
/// How the emulator should behave when you click off/on the window.
/// </summary>
@@ -263,7 +263,7 @@ namespace Ryujinx.Ava.Systems.Configuration
/// Enables or disables low-power profiled translation cache persistency loading
/// </summary>
public bool EnableLowPowerPtc { get; set; }
/// <summary>
/// Clock tick scalar, in percent points (100 = 1.0).
/// </summary>
@@ -398,7 +398,7 @@ namespace Ryujinx.Ava.Systems.Configuration
/// Enable or disable mouse support (Independent from controllers binding)
/// </summary>
public bool EnableMouse { get; set; }
/// <summary>
/// Enable/disable the ability to control Ryujinx when it's not the currently focused window.
/// </summary>
@@ -413,7 +413,7 @@ namespace Ryujinx.Ava.Systems.Configuration
/// Input configurations
/// </summary>
public List<InputConfig> InputConfig { get; set; }
/// <summary>
/// The speed of spectrum cycling for the Rainbow LED feature.
/// </summary>
@@ -458,17 +458,17 @@ namespace Ryujinx.Ava.Systems.Configuration
/// Uses Hypervisor over JIT if available
/// </summary>
public bool UseHypervisor { get; set; }
/// <summary>
/// Show toggles for dirty hacks in the UI.
/// </summary>
public bool ShowDirtyHacks { get; set; }
/// <summary>
/// The packed values of the enabled dirty hacks.
/// </summary>
public ulong[] DirtyHacks { get; set; }
/// <summary>
/// Loads a configuration file from disk
/// </summary>

View File

@@ -33,18 +33,18 @@ namespace Ryujinx.Ava.Systems.Configuration
foreach ((int newVersion, Action<ConfigurationFileFormat> migratorFunction)
in _migrations.OrderBy(x => x.Key))
{
if (cff.Version >= newVersion)
if (cff.Version >= newVersion)
continue;
RyuLogger.Warning?.Print(LogClass.Application,
RyuLogger.Warning?.Print(LogClass.Application,
$"Outdated configuration version {cff.Version}, migrating to version {newVersion}.");
migratorFunction(cff);
configurationFileUpdated = true;
}
EnableDiscordIntegration.Value = cff.EnableDiscordIntegration;
UpdateCheckerType.Value = shouldLoadFromFile ? cff.UpdateCheckerType : UpdateCheckerType.Value; // Get from global config only
FocusLostActionType.Value = cff.FocusLostActionType;
@@ -53,7 +53,7 @@ namespace Ryujinx.Ava.Systems.Configuration
ShowOldUI.Value = shouldLoadFromFile ? cff.ShowTitleBar : ShowOldUI.Value; // Get from global config only
EnableHardwareAcceleration.Value = shouldLoadFromFile ? cff.EnableHardwareAcceleration : EnableHardwareAcceleration.Value; // Get from global config only
HideCursor.Value = cff.HideCursor;
Logger.EnableFileLog.Value = cff.EnableFileLog;
Logger.EnableDebug.Value = cff.LoggingEnableDebug;
Logger.EnableStub.Value = cff.LoggingEnableStub;
@@ -65,7 +65,7 @@ namespace Ryujinx.Ava.Systems.Configuration
Logger.EnableFsAccessLog.Value = cff.LoggingEnableFsAccessLog;
Logger.FilteredClasses.Value = cff.LoggingFilteredClasses;
Logger.GraphicsDebugLevel.Value = cff.LoggingGraphicsDebugLevel;
Graphics.ResScale.Value = cff.ResScale;
Graphics.ResScaleCustom.Value = cff.ResScaleCustom;
Graphics.MaxAnisotropy.Value = cff.MaxAnisotropy;
@@ -84,7 +84,7 @@ namespace Ryujinx.Ava.Systems.Configuration
Graphics.EnableTextureRecompression.Value = cff.EnableTextureRecompression;
Graphics.EnableMacroHLE.Value = cff.EnableMacroHLE;
Graphics.EnableColorSpacePassthrough.Value = cff.EnableColorSpacePassthrough;
System.Language.Value = cff.SystemLanguage;
System.Region.Value = cff.SystemRegion;
System.TimeZone.Value = cff.SystemTimeZone;
@@ -142,10 +142,9 @@ namespace Ryujinx.Ava.Systems.Configuration
UI.WindowStartup.WindowPositionY.Value = shouldLoadFromFile ? cff.WindowStartup.WindowPositionY : UI.WindowStartup.WindowPositionY.Value;
UI.WindowStartup.WindowMaximized.Value = shouldLoadFromFile ? cff.WindowStartup.WindowMaximized : UI.WindowStartup.WindowMaximized.Value;
Hid.EnableKeyboard.Value = cff.EnableKeyboard;
Hid.EnableMouse.Value = cff.EnableMouse;
Hid.DisableInputWhenOutOfFocus.Value = shouldLoadFromFile ? cff.DisableInputWhenOutOfFocus: Hid.DisableInputWhenOutOfFocus.Value; // Get from global config only
Hid.DisableInputWhenOutOfFocus.Value = shouldLoadFromFile ? cff.DisableInputWhenOutOfFocus : Hid.DisableInputWhenOutOfFocus.Value; // Get from global config only
Hid.Hotkeys.Value = shouldLoadFromFile ? cff.Hotkeys : Hid.Hotkeys.Value; // Get from global config only
Hid.InputConfig.Value = cff.InputConfig ?? [];
Hid.RainbowSpeed.Value = cff.RainbowSpeed;
@@ -155,14 +154,14 @@ namespace Ryujinx.Ava.Systems.Configuration
Multiplayer.DisableP2p.Value = cff.MultiplayerDisableP2p;
Multiplayer.LdnPassphrase.Value = cff.MultiplayerLdnPassphrase;
Multiplayer.LdnServer.Value = cff.LdnServer;
{
Hacks.ShowDirtyHacks.Value = shouldLoadFromFile ? cff.ShowDirtyHacks: Hacks.ShowDirtyHacks.Value; // Get from global config only
DirtyHacks hacks = new (cff.DirtyHacks ?? []);
{
Hacks.ShowDirtyHacks.Value = shouldLoadFromFile ? cff.ShowDirtyHacks : Hacks.ShowDirtyHacks.Value; // Get from global config only
DirtyHacks hacks = new(cff.DirtyHacks ?? []);
Hacks.Xc2MenuSoftlockFix.Value = hacks.IsEnabled(DirtyHack.Xc2MenuSoftlockFix);
}
if (configurationFileUpdated)
@@ -172,7 +171,7 @@ namespace Ryujinx.Ava.Systems.Configuration
RyuLogger.Notice.Print(LogClass.Application, $"Configuration file updated to version {ConfigurationFileFormat.CurrentVersion}");
}
}
private static readonly Dictionary<int, Action<ConfigurationFileFormat>> _migrations =
Collections.NewDictionary<int, Action<ConfigurationFileFormat>>(
(2, static cff => cff.SystemRegion = Region.USA),
@@ -184,13 +183,15 @@ namespace Ryujinx.Ava.Systems.Configuration
{
cff.ColumnSort = new ColumnSort { SortColumnId = 0, SortAscending = false };
cff.Hotkeys = new KeyboardHotkeys { ToggleVSyncMode = Key.F1 };
}),
}
),
(10, static cff => cff.AudioBackend = AudioBackend.OpenAl),
(11, static cff =>
{
cff.ResScale = 1;
cff.ResScaleCustom = 1.0f;
}),
}
),
(12, static cff => cff.LoggingGraphicsDebugLevel = GraphicsDebugLevel.None),
// 13 -> LDN1
(14, static cff => cff.CheckUpdatesOnStart = true),
@@ -205,7 +206,8 @@ namespace Ryujinx.Ava.Systems.Configuration
cff.MultiplayerMode = MultiplayerMode.Disabled;
cff.MultiplayerLanInterfaceId = "0";
}),
}
),
(22, static cff => cff.HideCursor = HideCursorMode.Never),
(24, static cff =>
{
@@ -260,14 +262,17 @@ namespace Ryujinx.Ava.Systems.Configuration
},
}
];
}),
}
),
(26, static cff => cff.MemoryManagerMode = MemoryManagerMode.HostMappedUnsafe),
(27, static cff => cff.EnableMouse = false),
(29,
static cff =>
cff.Hotkeys = new KeyboardHotkeys
{
ToggleVSyncMode = Key.F1, Screenshot = Key.F8, ShowUI = Key.F4
ToggleVSyncMode = Key.F1,
Screenshot = Key.F8,
ShowUI = Key.F4
}),
(30, static cff =>
{
@@ -275,10 +280,13 @@ namespace Ryujinx.Ava.Systems.Configuration
{
config.Rumble = new RumbleConfigController
{
EnableRumble = false, StrongRumble = 1f, WeakRumble = 1f,
EnableRumble = false,
StrongRumble = 1f,
WeakRumble = 1f,
};
}
}),
}
),
(31, static cff => cff.BackendThreading = BackendThreading.Auto),
(32, static cff => cff.Hotkeys = new KeyboardHotkeys
{
@@ -299,7 +307,8 @@ namespace Ryujinx.Ava.Systems.Configuration
};
cff.AudioVolume = 1;
}),
}
),
(34, static cff => cff.EnableInternetAccess = false),
(35, static cff =>
{
@@ -309,7 +318,8 @@ namespace Ryujinx.Ava.Systems.Configuration
config.RangeLeft = 1.0f;
config.RangeRight = 1.0f;
}
}),
}
),
(36, static cff => cff.LoggingEnableTrace = false),
(37, static cff => cff.ShowConsole = true),
@@ -320,7 +330,8 @@ namespace Ryujinx.Ava.Systems.Configuration
cff.ShowNames = true;
cff.GridSize = 2;
cff.LanguageCode = "en_US";
}),
}
),
(39,
static cff => cff.Hotkeys = new KeyboardHotkeys
{
@@ -353,7 +364,8 @@ namespace Ryujinx.Ava.Systems.Configuration
cff.AntiAliasing = AntiAliasing.None;
cff.ScalingFilter = ScalingFilter.Bilinear;
cff.ScalingFilterLevel = 80;
}),
}
),
(45,
static cff => cff.ShownFileTypes = new ShownFileTypes
{
@@ -381,7 +393,8 @@ namespace Ryujinx.Ava.Systems.Configuration
{
AppDataManager.FixMacOSConfigurationFolders();
}
}),
}
),
(50, static cff => cff.EnableHardwareAcceleration = true),
(51, static cff => cff.RememberWindowState = true),
(52, static cff => cff.AutoloadDirs = []),
@@ -410,7 +423,8 @@ namespace Ryujinx.Ava.Systems.Configuration
};
cff.CustomVSyncInterval = 120;
}),
}
),
// 58 migration accidentally got skipped, but it worked with no issues somehow lol
(59, static cff =>
{
@@ -420,7 +434,8 @@ namespace Ryujinx.Ava.Systems.Configuration
// This was accidentally enabled by default when it was PRed. That is not what we want,
// so as a compromise users who want to use it will simply need to re-enable it once after updating.
cff.IgnoreApplet = false;
}),
}
),
(60, static cff => cff.StartNoUI = false),
(61, static cff =>
{
@@ -434,7 +449,8 @@ namespace Ryujinx.Ava.Systems.Configuration
LedColor = new Color(255, 5, 1, 253).ToUInt32()
};
}
}),
}
),
(62, static cff => cff.RainbowSpeed = 1f),
(63, static cff => cff.MatchSystemTime = false),
(64, static cff => cff.LoggingEnableAvalonia = false),
@@ -460,7 +476,8 @@ namespace Ryujinx.Ava.Systems.Configuration
TurboMode = Key.Unbound,
TurboModeWhileHeld = false
};
}),
}
),
(69, static cff => cff.SkipUserProfiles = false)
);
}

View File

@@ -256,7 +256,7 @@ namespace Ryujinx.Ava.Systems.Configuration
/// Enables printing FS access log messages
/// </summary>
public ReactiveObject<bool> EnableFsAccessLog { get; private set; }
/// <summary>
/// Enables log messages from Avalonia
/// </summary>
@@ -320,7 +320,7 @@ namespace Ryujinx.Ava.Systems.Configuration
/// System Time Offset in Seconds
/// </summary>
public ReactiveObject<long> SystemTimeOffset { get; private set; }
/// <summary>
/// Instead of setting the time via configuration, use the values provided by the system.
/// </summary>
@@ -335,7 +335,7 @@ namespace Ryujinx.Ava.Systems.Configuration
/// Enables or disables persistent profiled translation cache
/// </summary>
public ReactiveObject<bool> EnablePtc { get; private set; }
/// <summary>
/// Clock tick scalar, in percent points (100 = 1.0).
/// </summary>
@@ -389,7 +389,7 @@ namespace Ryujinx.Ava.Systems.Configuration
/// Enable or disable ignoring missing services
/// </summary>
public ReactiveObject<bool> IgnoreMissingServices { get; private set; }
/// <summary>
/// Ignore Controller Applet
/// </summary>
@@ -423,7 +423,7 @@ namespace Ryujinx.Ava.Systems.Configuration
EnablePtc.LogChangesToValue(nameof(EnablePtc));
EnableLowPowerPtc = new ReactiveObject<bool>();
EnableLowPowerPtc.LogChangesToValue(nameof(EnableLowPowerPtc));
EnableLowPowerPtc.Event += (_, evnt)
EnableLowPowerPtc.Event += (_, evnt)
=> Optimizations.LowPower = evnt.NewValue;
TickScalar = new ReactiveObject<long>();
TickScalar.LogChangesToValue(nameof(TickScalar));
@@ -473,7 +473,7 @@ namespace Ryujinx.Ava.Systems.Configuration
/// Enable or disable mouse support (Independent from controllers binding)
/// </summary>
public ReactiveObject<bool> EnableMouse { get; private set; }
/// <summary>
/// Enable/disable the ability to control Ryujinx when it's not the currently focused window.
/// </summary>
@@ -490,7 +490,7 @@ namespace Ryujinx.Ava.Systems.Configuration
/// TODO: Implement a ReactiveList class.
/// </summary>
public ReactiveObject<List<InputConfig>> InputConfig { get; private set; }
/// <summary>
/// The speed of spectrum cycling for the Rainbow LED feature.
/// </summary>
@@ -676,8 +676,8 @@ namespace Ryujinx.Ava.Systems.Configuration
public string GetLdnServer()
{
string ldnServer = LdnServer;
return string.IsNullOrEmpty(ldnServer)
? SharedConstants.DefaultLanPlayHost
return string.IsNullOrEmpty(ldnServer)
? SharedConstants.DefaultLanPlayHost
: ldnServer;
}
@@ -701,9 +701,9 @@ namespace Ryujinx.Ava.Systems.Configuration
/// Show toggles for dirty hacks in the UI.
/// </summary>
public ReactiveObject<bool> ShowDirtyHacks { get; private set; }
public ReactiveObject<bool> Xc2MenuSoftlockFix { get; private set; }
public ReactiveObject<bool> DisableNifmIsAnyInternetRequestAccepted { get; private set; }
public HacksSection()
@@ -717,15 +717,15 @@ namespace Ryujinx.Ava.Systems.Configuration
private void HackChanged(object sender, ReactiveEventArgs<bool> rxe)
{
if (!ShowDirtyHacks)
if (!ShowDirtyHacks)
return;
string newHacks = EnabledHacks.Select(x => x.Hack)
.JoinToString(", ");
if (newHacks != _lastHackCollection)
{
RyuLogger.Info?.Print(LogClass.Configuration,
RyuLogger.Info?.Print(LogClass.Configuration,
$"EnabledDirtyHacks set to: [{newHacks}]", "LogValueChange");
_lastHackCollection = newHacks;
@@ -739,13 +739,13 @@ namespace Ryujinx.Ava.Systems.Configuration
get
{
List<EnabledDirtyHack> enabledHacks = [];
if (Xc2MenuSoftlockFix)
Apply(DirtyHack.Xc2MenuSoftlockFix);
if (DisableNifmIsAnyInternetRequestAccepted)
Apply(DirtyHack.NifmServiceDisableIsAnyInternetRequestAccepted);
return enabledHacks.ToArray();
void Apply(DirtyHack hack, int value = 0)
@@ -790,7 +790,7 @@ namespace Ryujinx.Ava.Systems.Configuration
/// The Multiplayer section
/// </summary>
public MultiplayerSection Multiplayer { get; private set; }
/// <summary>
/// The Dirty Hacks section
/// </summary>
@@ -800,12 +800,12 @@ namespace Ryujinx.Ava.Systems.Configuration
/// Enables or disables Discord Rich Presence
/// </summary>
public ReactiveObject<bool> EnableDiscordIntegration { get; private set; }
/// <summary>
/// Checks for updates when Ryujinx starts when enabled, either prompting when an update is found or just showing a notification.
/// </summary>
public ReactiveObject<UpdaterType> UpdateCheckerType { get; private set; }
/// <summary>
/// How the emulator should behave when you click off/on the window.
/// </summary>
@@ -865,8 +865,8 @@ namespace Ryujinx.Ava.Systems.Configuration
System.EnablePtc,
System.TickScalar,
System.EnableInternetAccess,
System.EnableFsIntegrityChecks
? IntegrityCheckLevel.ErrorOnInvalid
System.EnableFsIntegrityChecks
? IntegrityCheckLevel.ErrorOnInvalid
: IntegrityCheckLevel.None,
System.FsGlobalAccessLogMode,
System.MatchSystemTime

View File

@@ -13,7 +13,7 @@ namespace Ryujinx.Ava.Systems.Configuration
NRO,
NSO
}
public static class FileTypesExtensions
{
/// <summary>

View File

@@ -10,23 +10,23 @@ namespace Ryujinx.Ava.Systems.Configuration
{
public static void Initialize()
{
ConfigurationState.Instance.Logger.EnableDebug.Event +=
ConfigurationState.Instance.Logger.EnableDebug.Event +=
(_, e) => Logger.SetEnable(LogLevel.Debug, e.NewValue);
ConfigurationState.Instance.Logger.EnableStub.Event +=
ConfigurationState.Instance.Logger.EnableStub.Event +=
(_, e) => Logger.SetEnable(LogLevel.Stub, e.NewValue);
ConfigurationState.Instance.Logger.EnableInfo.Event +=
ConfigurationState.Instance.Logger.EnableInfo.Event +=
(_, e) => Logger.SetEnable(LogLevel.Info, e.NewValue);
ConfigurationState.Instance.Logger.EnableWarn.Event +=
ConfigurationState.Instance.Logger.EnableWarn.Event +=
(_, e) => Logger.SetEnable(LogLevel.Warning, e.NewValue);
ConfigurationState.Instance.Logger.EnableError.Event +=
ConfigurationState.Instance.Logger.EnableError.Event +=
(_, e) => Logger.SetEnable(LogLevel.Error, e.NewValue);
ConfigurationState.Instance.Logger.EnableTrace.Event +=
ConfigurationState.Instance.Logger.EnableTrace.Event +=
(_, e) => Logger.SetEnable(LogLevel.Trace, e.NewValue);
ConfigurationState.Instance.Logger.EnableGuest.Event +=
ConfigurationState.Instance.Logger.EnableGuest.Event +=
(_, e) => Logger.SetEnable(LogLevel.Guest, e.NewValue);
ConfigurationState.Instance.Logger.EnableFsAccessLog.Event +=
(_, e) => Logger.SetEnable(LogLevel.AccessLog, e.NewValue);
ConfigurationState.Instance.Logger.FilteredClasses.Event += (_, e) =>
{
bool noFilter = e.NewValue.Length == 0;

View File

@@ -14,7 +14,7 @@ namespace Ryujinx.Ava.Systems.Configuration.System
Korea,
Taiwan,
}
public static class RegionEnumHelper
{
public static Region ToUI(this HLE.HOS.SystemState.RegionCode hleRegion)

View File

@@ -1,4 +1,4 @@
using Ryujinx.Common.Utilities;
using Ryujinx.Common.Utilities;
using System.Text.Json.Serialization;
namespace Ryujinx.Ava.Systems.Configuration.UI

View File

@@ -1,4 +1,4 @@
using Ryujinx.Common.Utilities;
using Ryujinx.Common.Utilities;
using System.Text.Json.Serialization;
namespace Ryujinx.Ava.Systems.Configuration.UI