mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-25 06:17:10 +02:00
misc: small Avalonia project restructure
Moved AppLibrary, Configuration, and PlayReport namespaces to Ryujinx.Systems, add the compat list stuff in the base Ryujinx.Systems namespace. Moved the compatibility UI stuff to the proper UI view/viewmodel folders.
This commit is contained in:
parent
c12a59ecd6
commit
2317c06364
84 changed files with 128 additions and 129 deletions
14
src/Ryujinx/Systems/Configuration/AudioBackend.cs
Normal file
14
src/Ryujinx/Systems/Configuration/AudioBackend.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
using Ryujinx.Common.Utilities;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Ryujinx.Ava.Systems.Configuration
|
||||
{
|
||||
[JsonConverter(typeof(TypedStringEnumConverter<AudioBackend>))]
|
||||
public enum AudioBackend
|
||||
{
|
||||
Dummy,
|
||||
OpenAl,
|
||||
SoundIo,
|
||||
SDL2,
|
||||
}
|
||||
}
|
492
src/Ryujinx/Systems/Configuration/ConfigurationFileFormat.cs
Normal file
492
src/Ryujinx/Systems/Configuration/ConfigurationFileFormat.cs
Normal file
|
@ -0,0 +1,492 @@
|
|||
using Ryujinx.Ava.Systems.Configuration.System;
|
||||
using Ryujinx.Ava.Systems.Configuration.UI;
|
||||
using Ryujinx.Common.Configuration;
|
||||
using Ryujinx.Common.Configuration.Hid;
|
||||
using Ryujinx.Common.Configuration.Multiplayer;
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.Common.Utilities;
|
||||
using Ryujinx.HLE;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ryujinx.Ava.Systems.Configuration
|
||||
{
|
||||
public class ConfigurationFileFormat
|
||||
{
|
||||
/// <summary>
|
||||
/// The current version of the file format
|
||||
/// </summary>
|
||||
public const int CurrentVersion = 67;
|
||||
|
||||
/// <summary>
|
||||
/// Version of the configuration file format
|
||||
/// </summary>
|
||||
public int Version { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables logging to a file on disk
|
||||
/// </summary>
|
||||
public bool EnableFileLog { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not backend threading is enabled. The "Auto" setting will determine whether threading should be enabled at runtime.
|
||||
/// </summary>
|
||||
public BackendThreading BackendThreading { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Resolution Scale. An integer scale applied to applicable render targets. Values 1-4, or -1 to use a custom floating point scale instead.
|
||||
/// </summary>
|
||||
public int ResScale { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Custom Resolution Scale. A custom floating point scale applied to applicable render targets. Only active when Resolution Scale is -1.
|
||||
/// </summary>
|
||||
public float ResScaleCustom { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Max Anisotropy. Values range from 0 - 16. Set to -1 to let the game decide.
|
||||
/// </summary>
|
||||
public float MaxAnisotropy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Aspect Ratio applied to the renderer window.
|
||||
/// </summary>
|
||||
public AspectRatio AspectRatio { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Applies anti-aliasing to the renderer.
|
||||
/// </summary>
|
||||
public AntiAliasing AntiAliasing { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets the framebuffer upscaling type.
|
||||
/// </summary>
|
||||
public ScalingFilter ScalingFilter { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets the framebuffer upscaling level.
|
||||
/// </summary>
|
||||
public int ScalingFilterLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Dumps shaders in this local directory
|
||||
/// </summary>
|
||||
public string GraphicsShadersDumpPath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables printing debug log messages
|
||||
/// </summary>
|
||||
public bool LoggingEnableDebug { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables printing stub log messages
|
||||
/// </summary>
|
||||
public bool LoggingEnableStub { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables printing info log messages
|
||||
/// </summary>
|
||||
public bool LoggingEnableInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables printing warning log messages
|
||||
/// </summary>
|
||||
public bool LoggingEnableWarn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables printing error log messages
|
||||
/// </summary>
|
||||
public bool LoggingEnableError { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables printing trace log messages
|
||||
/// </summary>
|
||||
public bool LoggingEnableTrace { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables printing guest log messages
|
||||
/// </summary>
|
||||
public bool LoggingEnableGuest { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables printing FS access log messages
|
||||
/// </summary>
|
||||
public bool LoggingEnableFsAccessLog { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables log messages from Avalonia
|
||||
/// </summary>
|
||||
public bool LoggingEnableAvalonia { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Controls which log messages are written to the log targets
|
||||
/// </summary>
|
||||
public LogClass[] LoggingFilteredClasses { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Change Graphics API debug log level
|
||||
/// </summary>
|
||||
public GraphicsDebugLevel LoggingGraphicsDebugLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Change System Language
|
||||
/// </summary>
|
||||
public Language SystemLanguage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Change System Region
|
||||
/// </summary>
|
||||
public Region SystemRegion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Change System TimeZone
|
||||
/// </summary>
|
||||
public string SystemTimeZone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 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>
|
||||
public bool MatchSystemTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables Docked Mode
|
||||
/// </summary>
|
||||
public bool DockedMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables Discord Rich Presence
|
||||
/// </summary>
|
||||
public bool EnableDiscordIntegration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 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>
|
||||
public FocusLostType FocusLostActionType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Show "Confirm Exit" Dialog
|
||||
/// </summary>
|
||||
public bool ShowConfirmExit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Ignore Controller Applet dialog
|
||||
/// </summary>
|
||||
public bool IgnoreApplet { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables save window size, position and state on close.
|
||||
/// </summary>
|
||||
public bool RememberWindowState { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables the redesigned title bar
|
||||
/// </summary>
|
||||
public bool ShowTitleBar { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables hardware-accelerated rendering for Avalonia
|
||||
/// </summary>
|
||||
public bool EnableHardwareAcceleration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether to hide cursor on idle, always or never
|
||||
/// </summary>
|
||||
public HideCursorMode HideCursor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables Vertical Sync
|
||||
/// </summary>
|
||||
/// <remarks>Kept for file format compatibility (to avoid possible failure when parsing configuration on old versions)</remarks>
|
||||
/// TODO: Remove this when those older versions aren't in use anymore.
|
||||
public bool EnableVsync { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Current VSync mode; 60 (Switch), unbounded ("Vsync off"), or custom
|
||||
/// </summary>
|
||||
public VSyncMode VSyncMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables the custom present interval
|
||||
/// </summary>
|
||||
public bool EnableCustomVSyncInterval { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The custom present interval value
|
||||
/// </summary>
|
||||
public int CustomVSyncInterval { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables Shader cache
|
||||
/// </summary>
|
||||
public bool EnableShaderCache { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables texture recompression
|
||||
/// </summary>
|
||||
public bool EnableTextureRecompression { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables Macro high-level emulation
|
||||
/// </summary>
|
||||
public bool EnableMacroHLE { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables color space passthrough, if available.
|
||||
/// </summary>
|
||||
public bool EnableColorSpacePassthrough { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables profiled translation cache persistency
|
||||
/// </summary>
|
||||
public bool EnablePtc { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables low-power profiled translation cache persistency loading
|
||||
/// </summary>
|
||||
public bool EnableLowPowerPtc { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables guest Internet access
|
||||
/// </summary>
|
||||
public bool EnableInternetAccess { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables integrity checks on Game content files
|
||||
/// </summary>
|
||||
public bool EnableFsIntegrityChecks { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables FS access log output to the console. Possible modes are 0-3
|
||||
/// </summary>
|
||||
public int FsGlobalAccessLogMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The selected audio backend
|
||||
/// </summary>
|
||||
public AudioBackend AudioBackend { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The audio volume
|
||||
/// </summary>
|
||||
public float AudioVolume { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The selected memory manager mode
|
||||
/// </summary>
|
||||
public MemoryManagerMode MemoryManagerMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Expands the RAM amount on the emulated system
|
||||
/// </summary>
|
||||
public MemoryConfiguration DramSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enable or disable ignoring missing services
|
||||
/// </summary>
|
||||
public bool IgnoreMissingServices { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Used to toggle columns in the GUI
|
||||
/// </summary>
|
||||
public GuiColumns GuiColumns { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Used to configure column sort settings in the GUI
|
||||
/// </summary>
|
||||
public ColumnSort ColumnSort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A list of directories containing games to be used to load games into the games list
|
||||
/// </summary>
|
||||
public List<string> GameDirs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A list of directories containing DLC/updates the user wants to autoload during library refreshes
|
||||
/// </summary>
|
||||
public List<string> AutoloadDirs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A list of file types to be hidden in the games List
|
||||
/// </summary>
|
||||
public ShownFileTypes ShownFileTypes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Main window start-up position, size and state
|
||||
/// </summary>
|
||||
public WindowStartup WindowStartup { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Language Code for the UI
|
||||
/// </summary>
|
||||
public string LanguageCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Chooses the base style // Not Used
|
||||
/// </summary>
|
||||
public string BaseStyle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Chooses the view mode of the game list // Not Used
|
||||
/// </summary>
|
||||
public int GameListViewMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Show application name in Grid Mode // Not Used
|
||||
/// </summary>
|
||||
public bool ShowNames { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets App Icon Size // Not Used
|
||||
/// </summary>
|
||||
public int GridSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sorts Apps in the game list // Not Used
|
||||
/// </summary>
|
||||
public int ApplicationSort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets if Grid is ordered in Ascending Order // Not Used
|
||||
/// </summary>
|
||||
public bool IsAscendingOrder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Start games in fullscreen mode
|
||||
/// </summary>
|
||||
public bool StartFullscreen { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Start games with UI hidden
|
||||
/// </summary>
|
||||
public bool StartNoUI { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Show console window
|
||||
/// </summary>
|
||||
public bool ShowConsole { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enable or disable keyboard support (Independent from controllers binding)
|
||||
/// </summary>
|
||||
public bool EnableKeyboard { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 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>
|
||||
public bool DisableInputWhenOutOfFocus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Hotkey Keyboard Bindings
|
||||
/// </summary>
|
||||
public KeyboardHotkeys Hotkeys { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Input configurations
|
||||
/// </summary>
|
||||
public List<InputConfig> InputConfig { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The speed of spectrum cycling for the Rainbow LED feature.
|
||||
/// </summary>
|
||||
public float RainbowSpeed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Graphics backend
|
||||
/// </summary>
|
||||
public GraphicsBackend GraphicsBackend { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preferred GPU
|
||||
/// </summary>
|
||||
public string PreferredGpu { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Multiplayer Mode
|
||||
/// </summary>
|
||||
public MultiplayerMode MultiplayerMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// GUID for the network interface used by LAN (or 0 for default)
|
||||
/// </summary>
|
||||
public string MultiplayerLanInterfaceId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Disable P2p Toggle
|
||||
/// </summary>
|
||||
public bool MultiplayerDisableP2p { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Local network passphrase, for private networks.
|
||||
/// </summary>
|
||||
public string MultiplayerLdnPassphrase { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Custom LDN Server
|
||||
/// </summary>
|
||||
public string LdnServer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 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>
|
||||
/// <param name="path">The path to the JSON configuration file</param>
|
||||
/// <param name="configurationFileFormat">Parsed configuration file</param>
|
||||
public static bool TryLoad(string path, out ConfigurationFileFormat configurationFileFormat)
|
||||
{
|
||||
try
|
||||
{
|
||||
configurationFileFormat = JsonHelper.DeserializeFromFile(path, ConfigurationFileFormatSettings.SerializerContext.ConfigurationFileFormat);
|
||||
|
||||
return configurationFileFormat.Version != 0;
|
||||
}
|
||||
catch
|
||||
{
|
||||
configurationFileFormat = null;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Save a configuration file to disk
|
||||
/// </summary>
|
||||
/// <param name="path">The path to the JSON configuration file</param>
|
||||
public void SaveConfig(string path)
|
||||
{
|
||||
JsonHelper.SerializeToFile(path, this, ConfigurationFileFormatSettings.SerializerContext.ConfigurationFileFormat);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
using Ryujinx.Common.Utilities;
|
||||
|
||||
namespace Ryujinx.Ava.Systems.Configuration
|
||||
{
|
||||
internal static class ConfigurationFileFormatSettings
|
||||
{
|
||||
public static readonly ConfigurationJsonSerializerContext SerializerContext = new(JsonHelper.GetDefaultSerializerOptions());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Ryujinx.Ava.Systems.Configuration
|
||||
{
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(ConfigurationFileFormat))]
|
||||
internal partial class ConfigurationJsonSerializerContext : JsonSerializerContext;
|
||||
}
|
|
@ -0,0 +1,447 @@
|
|||
using Avalonia.Media;
|
||||
using Gommon;
|
||||
using Ryujinx.Ava.Systems.Configuration.System;
|
||||
using Ryujinx.Ava.Systems.Configuration.UI;
|
||||
using Ryujinx.Common.Configuration;
|
||||
using Ryujinx.Common.Configuration.Hid;
|
||||
using Ryujinx.Common.Configuration.Hid.Controller;
|
||||
using Ryujinx.Common.Configuration.Hid.Keyboard;
|
||||
using Ryujinx.Common.Configuration.Multiplayer;
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.HLE;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using RyuLogger = Ryujinx.Common.Logging.Logger;
|
||||
|
||||
namespace Ryujinx.Ava.Systems.Configuration
|
||||
{
|
||||
public partial class ConfigurationState
|
||||
{
|
||||
public void Load(ConfigurationFileFormat cff, string configurationFilePath, string titleId = "")
|
||||
{
|
||||
bool configurationFileUpdated = false;
|
||||
bool shouldLoadFromFile = string.IsNullOrEmpty(titleId);
|
||||
|
||||
if (cff.Version is < 0 or > ConfigurationFileFormat.CurrentVersion)
|
||||
{
|
||||
RyuLogger.Warning?.Print(LogClass.Application, $"Unsupported configuration version {cff.Version}, loading default.");
|
||||
|
||||
LoadDefault();
|
||||
}
|
||||
|
||||
foreach ((int newVersion, Action<ConfigurationFileFormat> migratorFunction)
|
||||
in _migrations.OrderBy(x => x.Key))
|
||||
{
|
||||
if (cff.Version >= newVersion)
|
||||
continue;
|
||||
|
||||
RyuLogger.Warning?.Print(LogClass.Application,
|
||||
$"Outdated configuration version {cff.Version}, migrating to version {newVersion}.");
|
||||
|
||||
migratorFunction(cff);
|
||||
|
||||
configurationFileUpdated = true;
|
||||
}
|
||||
|
||||
|
||||
EnableDiscordIntegration.Value = cff.EnableDiscordIntegration;
|
||||
CheckUpdatesOnStart.Value = shouldLoadFromFile ? cff.CheckUpdatesOnStart : CheckUpdatesOnStart.Value; // Get from global config only
|
||||
UpdateCheckerType.Value = shouldLoadFromFile ? cff.UpdateCheckerType : UpdateCheckerType.Value; // Get from global config only
|
||||
FocusLostActionType.Value = cff.FocusLostActionType;
|
||||
ShowConfirmExit.Value = shouldLoadFromFile ? cff.ShowConfirmExit : ShowConfirmExit.Value; // Get from global config only
|
||||
RememberWindowState.Value = shouldLoadFromFile ? cff.RememberWindowState : RememberWindowState.Value; // Get from global config only
|
||||
ShowTitleBar.Value = shouldLoadFromFile ? cff.ShowTitleBar : ShowTitleBar.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;
|
||||
Logger.EnableInfo.Value = cff.LoggingEnableInfo;
|
||||
Logger.EnableWarn.Value = cff.LoggingEnableWarn;
|
||||
Logger.EnableError.Value = cff.LoggingEnableError;
|
||||
Logger.EnableTrace.Value = cff.LoggingEnableTrace;
|
||||
Logger.EnableGuest.Value = cff.LoggingEnableGuest;
|
||||
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;
|
||||
Graphics.AspectRatio.Value = cff.AspectRatio;
|
||||
Graphics.ShadersDumpPath.Value = cff.GraphicsShadersDumpPath;
|
||||
Graphics.BackendThreading.Value = cff.BackendThreading;
|
||||
Graphics.GraphicsBackend.Value = cff.GraphicsBackend;
|
||||
Graphics.PreferredGpu.Value = cff.PreferredGpu;
|
||||
Graphics.AntiAliasing.Value = cff.AntiAliasing;
|
||||
Graphics.ScalingFilter.Value = cff.ScalingFilter;
|
||||
Graphics.ScalingFilterLevel.Value = cff.ScalingFilterLevel;
|
||||
Graphics.VSyncMode.Value = cff.VSyncMode;
|
||||
Graphics.EnableCustomVSyncInterval.Value = cff.EnableCustomVSyncInterval;
|
||||
Graphics.CustomVSyncInterval.Value = cff.CustomVSyncInterval;
|
||||
Graphics.EnableShaderCache.Value = cff.EnableShaderCache;
|
||||
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;
|
||||
System.SystemTimeOffset.Value = shouldLoadFromFile ? cff.SystemTimeOffset : System.SystemTimeOffset.Value; // Get from global config only
|
||||
System.MatchSystemTime.Value = shouldLoadFromFile ? cff.MatchSystemTime : System.MatchSystemTime.Value; // Get from global config only
|
||||
System.EnableDockedMode.Value = cff.DockedMode;
|
||||
System.EnablePtc.Value = cff.EnablePtc;
|
||||
System.EnableLowPowerPtc.Value = cff.EnableLowPowerPtc;
|
||||
System.EnableInternetAccess.Value = cff.EnableInternetAccess;
|
||||
System.EnableFsIntegrityChecks.Value = cff.EnableFsIntegrityChecks;
|
||||
System.FsGlobalAccessLogMode.Value = cff.FsGlobalAccessLogMode;
|
||||
System.AudioBackend.Value = cff.AudioBackend;
|
||||
System.AudioVolume.Value = cff.AudioVolume;
|
||||
System.MemoryManagerMode.Value = cff.MemoryManagerMode;
|
||||
System.DramSize.Value = cff.DramSize;
|
||||
System.IgnoreMissingServices.Value = cff.IgnoreMissingServices;
|
||||
System.IgnoreControllerApplet.Value = cff.IgnoreApplet;
|
||||
System.UseHypervisor.Value = cff.UseHypervisor;
|
||||
|
||||
UI.GuiColumns.FavColumn.Value = shouldLoadFromFile ? cff.GuiColumns.FavColumn : UI.GuiColumns.FavColumn.Value;
|
||||
UI.GuiColumns.IconColumn.Value = shouldLoadFromFile ? cff.GuiColumns.IconColumn : UI.GuiColumns.IconColumn.Value;
|
||||
UI.GuiColumns.AppColumn.Value = shouldLoadFromFile ? cff.GuiColumns.AppColumn : UI.GuiColumns.AppColumn.Value;
|
||||
UI.GuiColumns.DevColumn.Value = shouldLoadFromFile ? cff.GuiColumns.DevColumn : UI.GuiColumns.DevColumn.Value;
|
||||
UI.GuiColumns.VersionColumn.Value = shouldLoadFromFile ? cff.GuiColumns.VersionColumn : UI.GuiColumns.VersionColumn.Value;
|
||||
UI.GuiColumns.TimePlayedColumn.Value = shouldLoadFromFile ? cff.GuiColumns.TimePlayedColumn : UI.GuiColumns.TimePlayedColumn.Value;
|
||||
UI.GuiColumns.LastPlayedColumn.Value = shouldLoadFromFile ? cff.GuiColumns.LastPlayedColumn : UI.GuiColumns.LastPlayedColumn.Value;
|
||||
UI.GuiColumns.FileExtColumn.Value = shouldLoadFromFile ? cff.GuiColumns.FileExtColumn : UI.GuiColumns.FileExtColumn.Value;
|
||||
UI.GuiColumns.FileSizeColumn.Value = shouldLoadFromFile ? cff.GuiColumns.FileSizeColumn : UI.GuiColumns.FileSizeColumn.Value;
|
||||
UI.GuiColumns.PathColumn.Value = shouldLoadFromFile ? cff.GuiColumns.PathColumn : UI.GuiColumns.PathColumn.Value;
|
||||
UI.ColumnSort.SortColumnId.Value = shouldLoadFromFile ? cff.ColumnSort.SortColumnId : UI.ColumnSort.SortColumnId.Value;
|
||||
UI.ColumnSort.SortAscending.Value = shouldLoadFromFile ? cff.ColumnSort.SortAscending : UI.ColumnSort.SortAscending.Value;
|
||||
UI.GameDirs.Value = shouldLoadFromFile ? cff.GameDirs : UI.GameDirs.Value;
|
||||
UI.AutoloadDirs.Value = shouldLoadFromFile ? (cff.AutoloadDirs ?? []) : UI.AutoloadDirs.Value;
|
||||
UI.ShownFileTypes.NSP.Value = shouldLoadFromFile ? cff.ShownFileTypes.NSP : UI.ShownFileTypes.NSP.Value;
|
||||
UI.ShownFileTypes.PFS0.Value = shouldLoadFromFile ? cff.ShownFileTypes.PFS0 : UI.ShownFileTypes.PFS0.Value;
|
||||
UI.ShownFileTypes.XCI.Value = shouldLoadFromFile ? cff.ShownFileTypes.XCI : UI.ShownFileTypes.XCI.Value;
|
||||
UI.ShownFileTypes.NCA.Value = shouldLoadFromFile ? cff.ShownFileTypes.NCA : UI.ShownFileTypes.NCA.Value;
|
||||
UI.ShownFileTypes.NRO.Value = shouldLoadFromFile ? cff.ShownFileTypes.NRO : UI.ShownFileTypes.NRO.Value;
|
||||
UI.ShownFileTypes.NSO.Value = shouldLoadFromFile ? cff.ShownFileTypes.NSO : UI.ShownFileTypes.NSO.Value;
|
||||
UI.LanguageCode.Value = shouldLoadFromFile ? cff.LanguageCode : UI.LanguageCode.Value;
|
||||
UI.BaseStyle.Value = shouldLoadFromFile ? cff.BaseStyle : UI.BaseStyle.Value;
|
||||
UI.GameListViewMode.Value = shouldLoadFromFile ? cff.GameListViewMode : UI.GameListViewMode.Value;
|
||||
UI.ShowNames.Value = shouldLoadFromFile ? cff.ShowNames : UI.ShowNames.Value;
|
||||
UI.IsAscendingOrder.Value = shouldLoadFromFile ? cff.IsAscendingOrder : UI.IsAscendingOrder.Value;
|
||||
UI.GridSize.Value = shouldLoadFromFile ? cff.GridSize : UI.GridSize.Value;
|
||||
UI.ApplicationSort.Value = shouldLoadFromFile ? cff.ApplicationSort : UI.ApplicationSort.Value;
|
||||
UI.StartFullscreen.Value = shouldLoadFromFile ? cff.StartFullscreen : UI.StartFullscreen.Value;
|
||||
UI.StartNoUI.Value = shouldLoadFromFile ? cff.StartNoUI : UI.StartNoUI.Value;
|
||||
UI.ShowConsole.Value = shouldLoadFromFile ? cff.ShowConsole : UI.ShowConsole.Value;
|
||||
UI.WindowStartup.WindowSizeWidth.Value = shouldLoadFromFile ? cff.WindowStartup.WindowSizeWidth : UI.WindowStartup.WindowSizeWidth.Value;
|
||||
UI.WindowStartup.WindowSizeHeight.Value = shouldLoadFromFile ? cff.WindowStartup.WindowSizeHeight : UI.WindowStartup.WindowSizeHeight.Value;
|
||||
UI.WindowStartup.WindowPositionX.Value = shouldLoadFromFile ? cff.WindowStartup.WindowPositionX : UI.WindowStartup.WindowPositionX.Value;
|
||||
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.Hotkeys.Value = shouldLoadFromFile ? cff.Hotkeys : Hid.Hotkeys.Value; // Get from global config only
|
||||
Hid.InputConfig.Value = cff.InputConfig ?? [];
|
||||
Hid.RainbowSpeed.Value = cff.RainbowSpeed;
|
||||
|
||||
Multiplayer.LanInterfaceId.Value = cff.MultiplayerLanInterfaceId;
|
||||
Multiplayer.Mode.Value = cff.MultiplayerMode;
|
||||
Multiplayer.DisableP2p.Value = cff.MultiplayerDisableP2p;
|
||||
Multiplayer.LdnPassphrase.Value = cff.MultiplayerLdnPassphrase;
|
||||
Multiplayer.LdnServer.Value = cff.LdnServer;
|
||||
|
||||
{
|
||||
Hacks.ShowDirtyHacks.Value = cff.ShowDirtyHacks;
|
||||
|
||||
DirtyHacks hacks = new (cff.DirtyHacks ?? []);
|
||||
|
||||
Hacks.Xc2MenuSoftlockFix.Value = hacks.IsEnabled(DirtyHack.Xc2MenuSoftlockFix);
|
||||
|
||||
Hacks.EnableShaderTranslationDelay.Value = hacks.IsEnabled(DirtyHack.ShaderTranslationDelay);
|
||||
Hacks.ShaderTranslationDelay.Value = hacks[DirtyHack.ShaderTranslationDelay].CoerceAtLeast(0);
|
||||
}
|
||||
|
||||
if (configurationFileUpdated)
|
||||
{
|
||||
ToFileFormat().SaveConfig(configurationFilePath);
|
||||
|
||||
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),
|
||||
(3, static cff => cff.SystemTimeZone = "UTC"),
|
||||
(4, static cff => cff.MaxAnisotropy = -1),
|
||||
(5, static cff => cff.SystemTimeOffset = 0),
|
||||
(8, static cff => cff.EnablePtc = true),
|
||||
(9, static cff =>
|
||||
{
|
||||
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),
|
||||
(16, static cff => cff.EnableShaderCache = true),
|
||||
(17, static cff => cff.StartFullscreen = false),
|
||||
(18, static cff => cff.AspectRatio = AspectRatio.Fixed16x9),
|
||||
// 19 -> LDN2
|
||||
(20, static cff => cff.ShowConfirmExit = true),
|
||||
(21, static cff =>
|
||||
{
|
||||
// Initialize network config.
|
||||
|
||||
cff.MultiplayerMode = MultiplayerMode.Disabled;
|
||||
cff.MultiplayerLanInterfaceId = "0";
|
||||
}),
|
||||
(22, static cff => cff.HideCursor = HideCursorMode.Never),
|
||||
(24, static cff =>
|
||||
{
|
||||
cff.InputConfig =
|
||||
[
|
||||
new StandardKeyboardInputConfig
|
||||
{
|
||||
Version = InputConfig.CurrentVersion,
|
||||
Backend = InputBackendType.WindowKeyboard,
|
||||
Id = "0",
|
||||
PlayerIndex = PlayerIndex.Player1,
|
||||
ControllerType = ControllerType.ProController,
|
||||
LeftJoycon = new LeftJoyconCommonConfig<Key>
|
||||
{
|
||||
DpadUp = Key.Up,
|
||||
DpadDown = Key.Down,
|
||||
DpadLeft = Key.Left,
|
||||
DpadRight = Key.Right,
|
||||
ButtonMinus = Key.Minus,
|
||||
ButtonL = Key.E,
|
||||
ButtonZl = Key.Q,
|
||||
ButtonSl = Key.Unbound,
|
||||
ButtonSr = Key.Unbound,
|
||||
},
|
||||
LeftJoyconStick = new JoyconConfigKeyboardStick<Key>
|
||||
{
|
||||
StickUp = Key.W,
|
||||
StickDown = Key.S,
|
||||
StickLeft = Key.A,
|
||||
StickRight = Key.D,
|
||||
StickButton = Key.F,
|
||||
},
|
||||
RightJoycon = new RightJoyconCommonConfig<Key>
|
||||
{
|
||||
ButtonA = Key.Z,
|
||||
ButtonB = Key.X,
|
||||
ButtonX = Key.C,
|
||||
ButtonY = Key.V,
|
||||
ButtonPlus = Key.Plus,
|
||||
ButtonR = Key.U,
|
||||
ButtonZr = Key.O,
|
||||
ButtonSl = Key.Unbound,
|
||||
ButtonSr = Key.Unbound,
|
||||
},
|
||||
RightJoyconStick = new JoyconConfigKeyboardStick<Key>
|
||||
{
|
||||
StickUp = Key.I,
|
||||
StickDown = Key.K,
|
||||
StickLeft = Key.J,
|
||||
StickRight = Key.L,
|
||||
StickButton = Key.H,
|
||||
},
|
||||
}
|
||||
];
|
||||
}),
|
||||
(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
|
||||
}),
|
||||
(30, static cff =>
|
||||
{
|
||||
foreach (StandardControllerInputConfig config in cff.InputConfig.OfType<StandardControllerInputConfig>())
|
||||
{
|
||||
config.Rumble = new RumbleConfigController
|
||||
{
|
||||
EnableRumble = false, StrongRumble = 1f, WeakRumble = 1f,
|
||||
};
|
||||
}
|
||||
}),
|
||||
(31, static cff => cff.BackendThreading = BackendThreading.Auto),
|
||||
(32, static cff => cff.Hotkeys = new KeyboardHotkeys
|
||||
{
|
||||
ToggleVSyncMode = cff.Hotkeys.ToggleVSyncMode,
|
||||
Screenshot = cff.Hotkeys.Screenshot,
|
||||
ShowUI = cff.Hotkeys.ShowUI,
|
||||
Pause = Key.F5,
|
||||
}),
|
||||
(33, static cff =>
|
||||
{
|
||||
cff.Hotkeys = new KeyboardHotkeys
|
||||
{
|
||||
ToggleVSyncMode = cff.Hotkeys.ToggleVSyncMode,
|
||||
Screenshot = cff.Hotkeys.Screenshot,
|
||||
ShowUI = cff.Hotkeys.ShowUI,
|
||||
Pause = cff.Hotkeys.Pause,
|
||||
ToggleMute = Key.F2,
|
||||
};
|
||||
|
||||
cff.AudioVolume = 1;
|
||||
}),
|
||||
(34, static cff => cff.EnableInternetAccess = false),
|
||||
(35, static cff =>
|
||||
{
|
||||
foreach (StandardControllerInputConfig config in cff.InputConfig
|
||||
.OfType<StandardControllerInputConfig>())
|
||||
{
|
||||
config.RangeLeft = 1.0f;
|
||||
config.RangeRight = 1.0f;
|
||||
}
|
||||
}),
|
||||
|
||||
(36, static cff => cff.LoggingEnableTrace = false),
|
||||
(37, static cff => cff.ShowConsole = true),
|
||||
(38, static cff =>
|
||||
{
|
||||
cff.BaseStyle = "Dark";
|
||||
cff.GameListViewMode = 0;
|
||||
cff.ShowNames = true;
|
||||
cff.GridSize = 2;
|
||||
cff.LanguageCode = "en_US";
|
||||
}),
|
||||
(39,
|
||||
static cff => cff.Hotkeys = new KeyboardHotkeys
|
||||
{
|
||||
ToggleVSyncMode = cff.Hotkeys.ToggleVSyncMode,
|
||||
Screenshot = cff.Hotkeys.Screenshot,
|
||||
ShowUI = cff.Hotkeys.ShowUI,
|
||||
Pause = cff.Hotkeys.Pause,
|
||||
ToggleMute = cff.Hotkeys.ToggleMute,
|
||||
ResScaleUp = Key.Unbound,
|
||||
ResScaleDown = Key.Unbound
|
||||
}),
|
||||
(40, static cff => cff.GraphicsBackend = GraphicsBackend.OpenGl),
|
||||
(41,
|
||||
static cff => cff.Hotkeys = new KeyboardHotkeys
|
||||
{
|
||||
ToggleVSyncMode = cff.Hotkeys.ToggleVSyncMode,
|
||||
Screenshot = cff.Hotkeys.Screenshot,
|
||||
ShowUI = cff.Hotkeys.ShowUI,
|
||||
Pause = cff.Hotkeys.Pause,
|
||||
ToggleMute = cff.Hotkeys.ToggleMute,
|
||||
ResScaleUp = cff.Hotkeys.ResScaleUp,
|
||||
ResScaleDown = cff.Hotkeys.ResScaleDown,
|
||||
VolumeUp = Key.Unbound,
|
||||
VolumeDown = Key.Unbound
|
||||
}),
|
||||
(42, static cff => cff.EnableMacroHLE = true),
|
||||
(43, static cff => cff.UseHypervisor = true),
|
||||
(44, static cff =>
|
||||
{
|
||||
cff.AntiAliasing = AntiAliasing.None;
|
||||
cff.ScalingFilter = ScalingFilter.Bilinear;
|
||||
cff.ScalingFilterLevel = 80;
|
||||
}),
|
||||
(45,
|
||||
static cff => cff.ShownFileTypes = new ShownFileTypes
|
||||
{
|
||||
NSP = true,
|
||||
PFS0 = true,
|
||||
XCI = true,
|
||||
NCA = true,
|
||||
NRO = true,
|
||||
NSO = true
|
||||
}),
|
||||
(46, static cff => cff.UseHypervisor = OperatingSystem.IsMacOS()),
|
||||
(47,
|
||||
static cff => cff.WindowStartup = new WindowStartup
|
||||
{
|
||||
WindowPositionX = 0,
|
||||
WindowPositionY = 0,
|
||||
WindowSizeHeight = 760,
|
||||
WindowSizeWidth = 1280,
|
||||
WindowMaximized = false
|
||||
}),
|
||||
(48, static cff => cff.EnableColorSpacePassthrough = false),
|
||||
(49, static _ =>
|
||||
{
|
||||
if (OperatingSystem.IsMacOS())
|
||||
{
|
||||
AppDataManager.FixMacOSConfigurationFolders();
|
||||
}
|
||||
}),
|
||||
(50, static cff => cff.EnableHardwareAcceleration = true),
|
||||
(51, static cff => cff.RememberWindowState = true),
|
||||
(52, static cff => cff.AutoloadDirs = []),
|
||||
(53, static cff => cff.EnableLowPowerPtc = false),
|
||||
(54, static cff => cff.DramSize = MemoryConfiguration.MemoryConfiguration4GiB),
|
||||
(55, static cff => cff.IgnoreApplet = false),
|
||||
(56, static cff => cff.ShowTitleBar = !OperatingSystem.IsWindows()),
|
||||
(57, static cff =>
|
||||
{
|
||||
cff.VSyncMode = VSyncMode.Switch;
|
||||
cff.EnableCustomVSyncInterval = false;
|
||||
|
||||
cff.Hotkeys = new KeyboardHotkeys
|
||||
{
|
||||
ToggleVSyncMode = Key.F1,
|
||||
Screenshot = cff.Hotkeys.Screenshot,
|
||||
ShowUI = cff.Hotkeys.ShowUI,
|
||||
Pause = cff.Hotkeys.Pause,
|
||||
ToggleMute = cff.Hotkeys.ToggleMute,
|
||||
ResScaleUp = cff.Hotkeys.ResScaleUp,
|
||||
ResScaleDown = cff.Hotkeys.ResScaleDown,
|
||||
VolumeUp = cff.Hotkeys.VolumeUp,
|
||||
VolumeDown = cff.Hotkeys.VolumeDown,
|
||||
CustomVSyncIntervalIncrement = Key.Unbound,
|
||||
CustomVSyncIntervalDecrement = Key.Unbound,
|
||||
};
|
||||
|
||||
cff.CustomVSyncInterval = 120;
|
||||
}),
|
||||
// 58 migration accidentally got skipped, but it worked with no issues somehow lol
|
||||
(59, static cff =>
|
||||
{
|
||||
cff.ShowDirtyHacks = false;
|
||||
cff.DirtyHacks = [];
|
||||
|
||||
// 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 =>
|
||||
{
|
||||
foreach (StandardControllerInputConfig config in cff.InputConfig.OfType<StandardControllerInputConfig>())
|
||||
{
|
||||
config.Led = new LedConfigController
|
||||
{
|
||||
EnableLed = false,
|
||||
TurnOffLed = false,
|
||||
UseRainbow = false,
|
||||
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),
|
||||
(65, static cff => cff.UpdateCheckerType = cff.CheckUpdatesOnStart ? UpdaterType.PromptAtStartup : UpdaterType.Off),
|
||||
(66, static cff => cff.DisableInputWhenOutOfFocus = false),
|
||||
(67, static cff => cff.FocusLostActionType = cff.DisableInputWhenOutOfFocus ? FocusLostType.BlockInput : FocusLostType.DoNothing)
|
||||
);
|
||||
}
|
||||
}
|
873
src/Ryujinx/Systems/Configuration/ConfigurationState.Model.cs
Normal file
873
src/Ryujinx/Systems/Configuration/ConfigurationState.Model.cs
Normal file
|
@ -0,0 +1,873 @@
|
|||
using ARMeilleure;
|
||||
using Gommon;
|
||||
using LibHac.Tools.FsSystem;
|
||||
using Ryujinx.Ava.Systems.Configuration.System;
|
||||
using Ryujinx.Ava.Systems.Configuration.UI;
|
||||
using Ryujinx.Common;
|
||||
using Ryujinx.Common.Configuration;
|
||||
using Ryujinx.Common.Configuration.Hid;
|
||||
using Ryujinx.Common.Configuration.Multiplayer;
|
||||
using Ryujinx.Common.Helper;
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.Common.Utilities;
|
||||
using Ryujinx.HLE;
|
||||
using Ryujinx.HLE.HOS.SystemState;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using RyuLogger = Ryujinx.Common.Logging.Logger;
|
||||
|
||||
namespace Ryujinx.Ava.Systems.Configuration
|
||||
{
|
||||
public partial class ConfigurationState
|
||||
{
|
||||
/// <summary>
|
||||
/// UI configuration section
|
||||
/// </summary>
|
||||
public class UISection
|
||||
{
|
||||
public class Columns
|
||||
{
|
||||
public ReactiveObject<bool> FavColumn { get; private set; }
|
||||
public ReactiveObject<bool> IconColumn { get; private set; }
|
||||
public ReactiveObject<bool> AppColumn { get; private set; }
|
||||
public ReactiveObject<bool> DevColumn { get; private set; }
|
||||
public ReactiveObject<bool> VersionColumn { get; private set; }
|
||||
public ReactiveObject<bool> LdnInfoColumn { get; private set; }
|
||||
public ReactiveObject<bool> TimePlayedColumn { get; private set; }
|
||||
public ReactiveObject<bool> LastPlayedColumn { get; private set; }
|
||||
public ReactiveObject<bool> FileExtColumn { get; private set; }
|
||||
public ReactiveObject<bool> FileSizeColumn { get; private set; }
|
||||
public ReactiveObject<bool> PathColumn { get; private set; }
|
||||
|
||||
public Columns()
|
||||
{
|
||||
FavColumn = new ReactiveObject<bool>();
|
||||
IconColumn = new ReactiveObject<bool>();
|
||||
AppColumn = new ReactiveObject<bool>();
|
||||
DevColumn = new ReactiveObject<bool>();
|
||||
VersionColumn = new ReactiveObject<bool>();
|
||||
LdnInfoColumn = new ReactiveObject<bool>();
|
||||
TimePlayedColumn = new ReactiveObject<bool>();
|
||||
LastPlayedColumn = new ReactiveObject<bool>();
|
||||
FileExtColumn = new ReactiveObject<bool>();
|
||||
FileSizeColumn = new ReactiveObject<bool>();
|
||||
PathColumn = new ReactiveObject<bool>();
|
||||
}
|
||||
}
|
||||
|
||||
public class ColumnSortSettings
|
||||
{
|
||||
public ReactiveObject<int> SortColumnId { get; private set; }
|
||||
public ReactiveObject<bool> SortAscending { get; private set; }
|
||||
|
||||
public ColumnSortSettings()
|
||||
{
|
||||
SortColumnId = new ReactiveObject<int>();
|
||||
SortAscending = new ReactiveObject<bool>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to toggle which file types are shown in the UI
|
||||
/// </summary>
|
||||
public class ShownFileTypeSettings
|
||||
{
|
||||
public ReactiveObject<bool> NSP { get; private set; }
|
||||
public ReactiveObject<bool> PFS0 { get; private set; }
|
||||
public ReactiveObject<bool> XCI { get; private set; }
|
||||
public ReactiveObject<bool> NCA { get; private set; }
|
||||
public ReactiveObject<bool> NRO { get; private set; }
|
||||
public ReactiveObject<bool> NSO { get; private set; }
|
||||
|
||||
public ShownFileTypeSettings()
|
||||
{
|
||||
NSP = new ReactiveObject<bool>();
|
||||
PFS0 = new ReactiveObject<bool>();
|
||||
XCI = new ReactiveObject<bool>();
|
||||
NCA = new ReactiveObject<bool>();
|
||||
NRO = new ReactiveObject<bool>();
|
||||
NSO = new ReactiveObject<bool>();
|
||||
}
|
||||
}
|
||||
|
||||
// <summary>
|
||||
/// Determines main window start-up position, size and state
|
||||
///<summary>
|
||||
public class WindowStartupSettings
|
||||
{
|
||||
public ReactiveObject<int> WindowSizeWidth { get; private set; }
|
||||
public ReactiveObject<int> WindowSizeHeight { get; private set; }
|
||||
public ReactiveObject<int> WindowPositionX { get; private set; }
|
||||
public ReactiveObject<int> WindowPositionY { get; private set; }
|
||||
public ReactiveObject<bool> WindowMaximized { get; private set; }
|
||||
|
||||
public WindowStartupSettings()
|
||||
{
|
||||
WindowSizeWidth = new ReactiveObject<int>();
|
||||
WindowSizeHeight = new ReactiveObject<int>();
|
||||
WindowPositionX = new ReactiveObject<int>();
|
||||
WindowPositionY = new ReactiveObject<int>();
|
||||
WindowMaximized = new ReactiveObject<bool>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to toggle columns in the GUI
|
||||
/// </summary>
|
||||
public Columns GuiColumns { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Used to configure column sort settings in the GUI
|
||||
/// </summary>
|
||||
public ColumnSortSettings ColumnSort { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// A list of directories containing games to be used to load games into the games list
|
||||
/// </summary>
|
||||
public ReactiveObject<List<string>> GameDirs { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// A list of directories containing DLC/updates the user wants to autoload during library refreshes
|
||||
/// </summary>
|
||||
public ReactiveObject<List<string>> AutoloadDirs { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// A list of file types to be hidden in the games List
|
||||
/// </summary>
|
||||
public ShownFileTypeSettings ShownFileTypes { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines main window start-up position, size and state
|
||||
/// </summary>
|
||||
public WindowStartupSettings WindowStartup { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Language Code for the UI
|
||||
/// </summary>
|
||||
public ReactiveObject<string> LanguageCode { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Selects the base style
|
||||
/// </summary>
|
||||
public ReactiveObject<string> BaseStyle { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Start games in fullscreen mode
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> StartFullscreen { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Start games with UI hidden
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> StartNoUI { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Hide / Show Console Window
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> ShowConsole { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// View Mode of the Game list
|
||||
/// </summary>
|
||||
public ReactiveObject<int> GameListViewMode { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Show application name in Grid Mode
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> ShowNames { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets App Icon Size in Grid Mode
|
||||
/// </summary>
|
||||
public ReactiveObject<int> GridSize { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sorts Apps in Grid Mode
|
||||
/// </summary>
|
||||
public ReactiveObject<int> ApplicationSort { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets if Grid is ordered in Ascending Order
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> IsAscendingOrder { get; private set; }
|
||||
|
||||
public UISection()
|
||||
{
|
||||
GuiColumns = new Columns();
|
||||
ColumnSort = new ColumnSortSettings();
|
||||
GameDirs = new ReactiveObject<List<string>>();
|
||||
AutoloadDirs = new ReactiveObject<List<string>>();
|
||||
ShownFileTypes = new ShownFileTypeSettings();
|
||||
WindowStartup = new WindowStartupSettings();
|
||||
BaseStyle = new ReactiveObject<string>();
|
||||
StartFullscreen = new ReactiveObject<bool>();
|
||||
StartNoUI = new ReactiveObject<bool>();
|
||||
GameListViewMode = new ReactiveObject<int>();
|
||||
ShowNames = new ReactiveObject<bool>();
|
||||
GridSize = new ReactiveObject<int>();
|
||||
ApplicationSort = new ReactiveObject<int>();
|
||||
IsAscendingOrder = new ReactiveObject<bool>();
|
||||
LanguageCode = new ReactiveObject<string>();
|
||||
ShowConsole = new ReactiveObject<bool>();
|
||||
ShowConsole.Event += static (_, e) => ConsoleHelper.SetConsoleWindowState(e.NewValue);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logger configuration section
|
||||
/// </summary>
|
||||
public class LoggerSection
|
||||
{
|
||||
/// <summary>
|
||||
/// Enables printing debug log messages
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> EnableDebug { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables printing stub log messages
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> EnableStub { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables printing info log messages
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> EnableInfo { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables printing warning log messages
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> EnableWarn { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables printing error log messages
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> EnableError { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables printing trace log messages
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> EnableTrace { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables printing guest log messages
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> EnableGuest { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables printing FS access log messages
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> EnableFsAccessLog { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables log messages from Avalonia
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> EnableAvaloniaLog { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Controls which log messages are written to the log targets
|
||||
/// </summary>
|
||||
public ReactiveObject<LogClass[]> FilteredClasses { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables logging to a file on disk
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> EnableFileLog { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Controls which OpenGL log messages are recorded in the log
|
||||
/// </summary>
|
||||
public ReactiveObject<GraphicsDebugLevel> GraphicsDebugLevel { get; private set; }
|
||||
|
||||
public LoggerSection()
|
||||
{
|
||||
EnableDebug = new ReactiveObject<bool>();
|
||||
EnableDebug.LogChangesToValue(nameof(EnableDebug));
|
||||
EnableStub = new ReactiveObject<bool>();
|
||||
EnableInfo = new ReactiveObject<bool>();
|
||||
EnableWarn = new ReactiveObject<bool>();
|
||||
EnableError = new ReactiveObject<bool>();
|
||||
EnableTrace = new ReactiveObject<bool>();
|
||||
EnableGuest = new ReactiveObject<bool>();
|
||||
EnableFsAccessLog = new ReactiveObject<bool>();
|
||||
EnableAvaloniaLog = new ReactiveObject<bool>();
|
||||
FilteredClasses = new ReactiveObject<LogClass[]>();
|
||||
EnableFileLog = new ReactiveObject<bool>();
|
||||
EnableFileLog.LogChangesToValue(nameof(EnableFileLog));
|
||||
GraphicsDebugLevel = new ReactiveObject<GraphicsDebugLevel>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// System configuration section
|
||||
/// </summary>
|
||||
public class SystemSection
|
||||
{
|
||||
/// <summary>
|
||||
/// Change System Language
|
||||
/// </summary>
|
||||
public ReactiveObject<Language> Language { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Change System Region
|
||||
/// </summary>
|
||||
public ReactiveObject<Region> Region { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Change System TimeZone
|
||||
/// </summary>
|
||||
public ReactiveObject<string> TimeZone { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 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>
|
||||
public ReactiveObject<bool> MatchSystemTime { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables Docked Mode
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> EnableDockedMode { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables persistent profiled translation cache
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> EnablePtc { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables low-power persistent profiled translation cache loading
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> EnableLowPowerPtc { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables guest Internet access
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> EnableInternetAccess { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables integrity checks on Game content files
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> EnableFsIntegrityChecks { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables FS access log output to the console. Possible modes are 0-3
|
||||
/// </summary>
|
||||
public ReactiveObject<int> FsGlobalAccessLogMode { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The selected audio backend
|
||||
/// </summary>
|
||||
public ReactiveObject<AudioBackend> AudioBackend { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The audio backend volume
|
||||
/// </summary>
|
||||
public ReactiveObject<float> AudioVolume { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The selected memory manager mode
|
||||
/// </summary>
|
||||
public ReactiveObject<MemoryManagerMode> MemoryManagerMode { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Defines the amount of RAM available on the emulated system, and how it is distributed
|
||||
/// </summary>
|
||||
public ReactiveObject<MemoryConfiguration> DramSize { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enable or disable ignoring missing services
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> IgnoreMissingServices { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Ignore Controller Applet
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> IgnoreControllerApplet { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Uses Hypervisor over JIT if available
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> UseHypervisor { get; private set; }
|
||||
|
||||
public SystemSection()
|
||||
{
|
||||
Language = new ReactiveObject<Language>();
|
||||
Language.LogChangesToValue(nameof(Language));
|
||||
Region = new ReactiveObject<Region>();
|
||||
Region.LogChangesToValue(nameof(Region));
|
||||
TimeZone = new ReactiveObject<string>();
|
||||
TimeZone.LogChangesToValue(nameof(TimeZone));
|
||||
SystemTimeOffset = new ReactiveObject<long>();
|
||||
SystemTimeOffset.LogChangesToValue(nameof(SystemTimeOffset));
|
||||
MatchSystemTime = new ReactiveObject<bool>();
|
||||
MatchSystemTime.LogChangesToValue(nameof(MatchSystemTime));
|
||||
EnableDockedMode = new ReactiveObject<bool>();
|
||||
EnableDockedMode.LogChangesToValue(nameof(EnableDockedMode));
|
||||
EnablePtc = new ReactiveObject<bool>();
|
||||
EnablePtc.LogChangesToValue(nameof(EnablePtc));
|
||||
EnableLowPowerPtc = new ReactiveObject<bool>();
|
||||
EnableLowPowerPtc.LogChangesToValue(nameof(EnableLowPowerPtc));
|
||||
EnableLowPowerPtc.Event += (_, evnt)
|
||||
=> Optimizations.LowPower = evnt.NewValue;
|
||||
EnableInternetAccess = new ReactiveObject<bool>();
|
||||
EnableInternetAccess.LogChangesToValue(nameof(EnableInternetAccess));
|
||||
EnableFsIntegrityChecks = new ReactiveObject<bool>();
|
||||
EnableFsIntegrityChecks.LogChangesToValue(nameof(EnableFsIntegrityChecks));
|
||||
FsGlobalAccessLogMode = new ReactiveObject<int>();
|
||||
FsGlobalAccessLogMode.LogChangesToValue(nameof(FsGlobalAccessLogMode));
|
||||
AudioBackend = new ReactiveObject<AudioBackend>();
|
||||
AudioBackend.LogChangesToValue(nameof(AudioBackend));
|
||||
MemoryManagerMode = new ReactiveObject<MemoryManagerMode>();
|
||||
MemoryManagerMode.LogChangesToValue(nameof(MemoryManagerMode));
|
||||
DramSize = new ReactiveObject<MemoryConfiguration>();
|
||||
DramSize.LogChangesToValue(nameof(DramSize));
|
||||
IgnoreMissingServices = new ReactiveObject<bool>();
|
||||
IgnoreMissingServices.LogChangesToValue(nameof(IgnoreMissingServices));
|
||||
IgnoreControllerApplet = new ReactiveObject<bool>();
|
||||
IgnoreControllerApplet.LogChangesToValue(nameof(IgnoreControllerApplet));
|
||||
AudioVolume = new ReactiveObject<float>();
|
||||
AudioVolume.LogChangesToValue(nameof(AudioVolume));
|
||||
UseHypervisor = new ReactiveObject<bool>();
|
||||
UseHypervisor.LogChangesToValue(nameof(UseHypervisor));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hid configuration section
|
||||
/// </summary>
|
||||
public class HidSection
|
||||
{
|
||||
/// <summary>
|
||||
/// Enable or disable keyboard support (Independent from controllers binding)
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> EnableKeyboard { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 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>
|
||||
public ReactiveObject<bool> DisableInputWhenOutOfFocus { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Hotkey Keyboard Bindings
|
||||
/// </summary>
|
||||
public ReactiveObject<KeyboardHotkeys> Hotkeys { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Input device configuration.
|
||||
/// NOTE: This ReactiveObject won't issue an event when the List has elements added or removed.
|
||||
/// 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>
|
||||
public ReactiveObject<float> RainbowSpeed { get; }
|
||||
|
||||
public HidSection()
|
||||
{
|
||||
EnableKeyboard = new ReactiveObject<bool>();
|
||||
EnableMouse = new ReactiveObject<bool>();
|
||||
DisableInputWhenOutOfFocus = new ReactiveObject<bool>();
|
||||
Hotkeys = new ReactiveObject<KeyboardHotkeys>();
|
||||
InputConfig = new ReactiveObject<List<InputConfig>>();
|
||||
RainbowSpeed = new ReactiveObject<float>();
|
||||
RainbowSpeed.Event += (_, args) => Rainbow.Speed = args.NewValue;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Graphics configuration section
|
||||
/// </summary>
|
||||
public class GraphicsSection
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether or not backend threading is enabled. The "Auto" setting will determine whether threading should be enabled at runtime.
|
||||
/// </summary>
|
||||
public ReactiveObject<BackendThreading> BackendThreading { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Max Anisotropy. Values range from 0 - 16. Set to -1 to let the game decide.
|
||||
/// </summary>
|
||||
public ReactiveObject<float> MaxAnisotropy { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Aspect Ratio applied to the renderer window.
|
||||
/// </summary>
|
||||
public ReactiveObject<AspectRatio> AspectRatio { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Resolution Scale. An integer scale applied to applicable render targets. Values 1-4, or -1 to use a custom floating point scale instead.
|
||||
/// </summary>
|
||||
public ReactiveObject<int> ResScale { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Custom Resolution Scale. A custom floating point scale applied to applicable render targets. Only active when Resolution Scale is -1.
|
||||
/// </summary>
|
||||
public ReactiveObject<float> ResScaleCustom { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Dumps shaders in this local directory
|
||||
/// </summary>
|
||||
public ReactiveObject<string> ShadersDumpPath { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Toggles the present interval mode. Options are Switch (60Hz), Unbounded (previously Vsync off), and Custom, if enabled.
|
||||
/// </summary>
|
||||
public ReactiveObject<VSyncMode> VSyncMode { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables the custom present interval mode.
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> EnableCustomVSyncInterval { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Changes the custom present interval.
|
||||
/// </summary>
|
||||
public ReactiveObject<int> CustomVSyncInterval { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables Shader cache
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> EnableShaderCache { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables texture recompression
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> EnableTextureRecompression { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables Macro high-level emulation
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> EnableMacroHLE { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables color space passthrough, if available.
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> EnableColorSpacePassthrough { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Graphics backend
|
||||
/// </summary>
|
||||
public ReactiveObject<GraphicsBackend> GraphicsBackend { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Applies anti-aliasing to the renderer.
|
||||
/// </summary>
|
||||
public ReactiveObject<AntiAliasing> AntiAliasing { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets the framebuffer upscaling type.
|
||||
/// </summary>
|
||||
public ReactiveObject<ScalingFilter> ScalingFilter { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets the framebuffer upscaling level.
|
||||
/// </summary>
|
||||
public ReactiveObject<int> ScalingFilterLevel { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preferred GPU
|
||||
/// </summary>
|
||||
public ReactiveObject<string> PreferredGpu { get; private set; }
|
||||
|
||||
public GraphicsSection()
|
||||
{
|
||||
BackendThreading = new ReactiveObject<BackendThreading>();
|
||||
BackendThreading.LogChangesToValue(nameof(BackendThreading));
|
||||
ResScale = new ReactiveObject<int>();
|
||||
ResScale.LogChangesToValue(nameof(ResScale));
|
||||
ResScaleCustom = new ReactiveObject<float>();
|
||||
ResScaleCustom.LogChangesToValue(nameof(ResScaleCustom));
|
||||
MaxAnisotropy = new ReactiveObject<float>();
|
||||
MaxAnisotropy.LogChangesToValue(nameof(MaxAnisotropy));
|
||||
AspectRatio = new ReactiveObject<AspectRatio>();
|
||||
AspectRatio.LogChangesToValue(nameof(AspectRatio));
|
||||
ShadersDumpPath = new ReactiveObject<string>();
|
||||
VSyncMode = new ReactiveObject<VSyncMode>();
|
||||
VSyncMode.LogChangesToValue(nameof(VSyncMode));
|
||||
EnableCustomVSyncInterval = new ReactiveObject<bool>();
|
||||
EnableCustomVSyncInterval.LogChangesToValue(nameof(EnableCustomVSyncInterval));
|
||||
CustomVSyncInterval = new ReactiveObject<int>();
|
||||
CustomVSyncInterval.LogChangesToValue(nameof(CustomVSyncInterval));
|
||||
EnableShaderCache = new ReactiveObject<bool>();
|
||||
EnableShaderCache.LogChangesToValue(nameof(EnableShaderCache));
|
||||
EnableTextureRecompression = new ReactiveObject<bool>();
|
||||
EnableTextureRecompression.LogChangesToValue(nameof(EnableTextureRecompression));
|
||||
GraphicsBackend = new ReactiveObject<GraphicsBackend>();
|
||||
GraphicsBackend.LogChangesToValue(nameof(GraphicsBackend));
|
||||
PreferredGpu = new ReactiveObject<string>();
|
||||
PreferredGpu.LogChangesToValue(nameof(PreferredGpu));
|
||||
EnableMacroHLE = new ReactiveObject<bool>();
|
||||
EnableMacroHLE.LogChangesToValue(nameof(EnableMacroHLE));
|
||||
EnableColorSpacePassthrough = new ReactiveObject<bool>();
|
||||
EnableColorSpacePassthrough.LogChangesToValue(nameof(EnableColorSpacePassthrough));
|
||||
AntiAliasing = new ReactiveObject<AntiAliasing>();
|
||||
AntiAliasing.LogChangesToValue(nameof(AntiAliasing));
|
||||
ScalingFilter = new ReactiveObject<ScalingFilter>();
|
||||
ScalingFilter.LogChangesToValue(nameof(ScalingFilter));
|
||||
ScalingFilterLevel = new ReactiveObject<int>();
|
||||
ScalingFilterLevel.LogChangesToValue(nameof(ScalingFilterLevel));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Multiplayer configuration section
|
||||
/// </summary>
|
||||
public class MultiplayerSection
|
||||
{
|
||||
/// <summary>
|
||||
/// GUID for the network interface used by LAN (or 0 for default)
|
||||
/// </summary>
|
||||
public ReactiveObject<string> LanInterfaceId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Multiplayer Mode
|
||||
/// </summary>
|
||||
public ReactiveObject<MultiplayerMode> Mode { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Disable P2P
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> DisableP2p { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// LDN PassPhrase
|
||||
/// </summary>
|
||||
public ReactiveObject<string> LdnPassphrase { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// LDN Server
|
||||
/// </summary>
|
||||
public ReactiveObject<string> LdnServer { get; private set; }
|
||||
|
||||
public string GetLdnServer()
|
||||
{
|
||||
string ldnServer = LdnServer;
|
||||
return string.IsNullOrEmpty(ldnServer)
|
||||
? SharedConstants.DefaultLanPlayHost
|
||||
: ldnServer;
|
||||
}
|
||||
|
||||
public MultiplayerSection()
|
||||
{
|
||||
LanInterfaceId = new ReactiveObject<string>();
|
||||
Mode = new ReactiveObject<MultiplayerMode>();
|
||||
Mode.LogChangesToValue(nameof(MultiplayerMode));
|
||||
DisableP2p = new ReactiveObject<bool>();
|
||||
DisableP2p.LogChangesToValue(nameof(DisableP2p));
|
||||
LdnPassphrase = new ReactiveObject<string>();
|
||||
LdnPassphrase.LogChangesToValue(nameof(LdnPassphrase));
|
||||
LdnServer = new ReactiveObject<string>();
|
||||
LdnServer.LogChangesToValue(nameof(LdnServer));
|
||||
}
|
||||
}
|
||||
|
||||
public class HacksSection
|
||||
{
|
||||
/// <summary>
|
||||
/// 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> EnableShaderTranslationDelay { get; private set; }
|
||||
|
||||
public ReactiveObject<int> ShaderTranslationDelay { get; private set; }
|
||||
|
||||
public HacksSection()
|
||||
{
|
||||
ShowDirtyHacks = new ReactiveObject<bool>();
|
||||
Xc2MenuSoftlockFix = new ReactiveObject<bool>();
|
||||
Xc2MenuSoftlockFix.Event += HackChanged;
|
||||
EnableShaderTranslationDelay = new ReactiveObject<bool>();
|
||||
EnableShaderTranslationDelay.Event += HackChanged;
|
||||
ShaderTranslationDelay = new ReactiveObject<int>();
|
||||
}
|
||||
|
||||
private void HackChanged(object sender, ReactiveEventArgs<bool> rxe)
|
||||
{
|
||||
if (!ShowDirtyHacks)
|
||||
return;
|
||||
|
||||
string newHacks = EnabledHacks.Select(x => x.Hack)
|
||||
.JoinToString(", ");
|
||||
|
||||
if (newHacks != _lastHackCollection)
|
||||
{
|
||||
RyuLogger.Info?.Print(LogClass.Configuration,
|
||||
$"EnabledDirtyHacks set to: [{newHacks}]", "LogValueChange");
|
||||
|
||||
_lastHackCollection = newHacks;
|
||||
}
|
||||
}
|
||||
|
||||
private static string _lastHackCollection;
|
||||
|
||||
public EnabledDirtyHack[] EnabledHacks
|
||||
{
|
||||
get
|
||||
{
|
||||
List<EnabledDirtyHack> enabledHacks = [];
|
||||
|
||||
if (Xc2MenuSoftlockFix)
|
||||
Apply(DirtyHack.Xc2MenuSoftlockFix);
|
||||
|
||||
if (EnableShaderTranslationDelay)
|
||||
Apply(DirtyHack.ShaderTranslationDelay, ShaderTranslationDelay);
|
||||
|
||||
return enabledHacks.ToArray();
|
||||
|
||||
void Apply(DirtyHack hack, int value = 0)
|
||||
{
|
||||
enabledHacks.Add(new EnabledDirtyHack(hack, value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The default configuration instance
|
||||
/// </summary>
|
||||
public static ConfigurationState Instance { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The UI section
|
||||
/// </summary>
|
||||
public UISection UI { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The Logger section
|
||||
/// </summary>
|
||||
public LoggerSection Logger { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The System section
|
||||
/// </summary>
|
||||
public SystemSection System { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The Graphics section
|
||||
/// </summary>
|
||||
public GraphicsSection Graphics { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The Hid section
|
||||
/// </summary>
|
||||
public HidSection Hid { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The Multiplayer section
|
||||
/// </summary>
|
||||
public MultiplayerSection Multiplayer { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The Dirty Hacks section
|
||||
/// </summary>
|
||||
public HacksSection Hacks { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables Discord Rich Presence
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> EnableDiscordIntegration { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Checks for updates when Ryujinx starts when enabled
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> CheckUpdatesOnStart { 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>
|
||||
public ReactiveObject<FocusLostType> FocusLostActionType { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Show "Confirm Exit" Dialog
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> ShowConfirmExit { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables save window size, position and state on close.
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> RememberWindowState { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables the redesigned title bar
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> ShowTitleBar { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables hardware-accelerated rendering for Avalonia
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> EnableHardwareAcceleration { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Hide Cursor on Idle
|
||||
/// </summary>
|
||||
public ReactiveObject<HideCursorMode> HideCursor { get; private set; }
|
||||
|
||||
private ConfigurationState()
|
||||
{
|
||||
UI = new UISection();
|
||||
Logger = new LoggerSection();
|
||||
System = new SystemSection();
|
||||
Graphics = new GraphicsSection();
|
||||
Hid = new HidSection();
|
||||
Multiplayer = new MultiplayerSection();
|
||||
Hacks = new HacksSection();
|
||||
EnableDiscordIntegration = new ReactiveObject<bool>();
|
||||
CheckUpdatesOnStart = new ReactiveObject<bool>();
|
||||
UpdateCheckerType = new ReactiveObject<UpdaterType>();
|
||||
FocusLostActionType = new ReactiveObject<FocusLostType>();
|
||||
ShowConfirmExit = new ReactiveObject<bool>();
|
||||
RememberWindowState = new ReactiveObject<bool>();
|
||||
ShowTitleBar = new ReactiveObject<bool>();
|
||||
EnableHardwareAcceleration = new ReactiveObject<bool>();
|
||||
HideCursor = new ReactiveObject<HideCursorMode>();
|
||||
}
|
||||
|
||||
public HleConfiguration CreateHleConfiguration() =>
|
||||
new(
|
||||
System.DramSize,
|
||||
(SystemLanguage)System.Language.Value,
|
||||
(RegionCode)System.Region.Value,
|
||||
Graphics.VSyncMode,
|
||||
System.EnableDockedMode,
|
||||
System.EnablePtc,
|
||||
System.EnableInternetAccess,
|
||||
System.EnableFsIntegrityChecks
|
||||
? IntegrityCheckLevel.ErrorOnInvalid
|
||||
: IntegrityCheckLevel.None,
|
||||
System.FsGlobalAccessLogMode,
|
||||
System.MatchSystemTime
|
||||
? 0
|
||||
: System.SystemTimeOffset,
|
||||
System.TimeZone,
|
||||
System.MemoryManagerMode,
|
||||
System.IgnoreMissingServices,
|
||||
Graphics.AspectRatio,
|
||||
System.AudioVolume,
|
||||
System.UseHypervisor,
|
||||
Multiplayer.LanInterfaceId,
|
||||
Multiplayer.Mode,
|
||||
Multiplayer.DisableP2p,
|
||||
Multiplayer.LdnPassphrase,
|
||||
Instance.Multiplayer.GetLdnServer(),
|
||||
Instance.Graphics.CustomVSyncInterval,
|
||||
Instance.Hacks.ShowDirtyHacks ? Instance.Hacks.EnabledHacks : null);
|
||||
}
|
||||
}
|
331
src/Ryujinx/Systems/Configuration/ConfigurationState.cs
Normal file
331
src/Ryujinx/Systems/Configuration/ConfigurationState.cs
Normal file
|
@ -0,0 +1,331 @@
|
|||
using Ryujinx.Ava.Systems.Configuration.System;
|
||||
using Ryujinx.Ava.Systems.Configuration.UI;
|
||||
using Ryujinx.Common.Configuration;
|
||||
using Ryujinx.Common.Configuration.Hid;
|
||||
using Ryujinx.Common.Configuration.Hid.Keyboard;
|
||||
using Ryujinx.Common.Configuration.Multiplayer;
|
||||
using Ryujinx.Graphics.Vulkan;
|
||||
using Ryujinx.HLE;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace Ryujinx.Ava.Systems.Configuration
|
||||
{
|
||||
public partial class ConfigurationState
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
if (Instance != null)
|
||||
{
|
||||
throw new InvalidOperationException("Configuration is already initialized");
|
||||
}
|
||||
|
||||
Instance = new ConfigurationState();
|
||||
}
|
||||
|
||||
public ConfigurationFileFormat ToFileFormat()
|
||||
{
|
||||
ConfigurationFileFormat configurationFile = new()
|
||||
{
|
||||
Version = ConfigurationFileFormat.CurrentVersion,
|
||||
BackendThreading = Graphics.BackendThreading,
|
||||
EnableFileLog = Logger.EnableFileLog,
|
||||
ResScale = Graphics.ResScale,
|
||||
ResScaleCustom = Graphics.ResScaleCustom,
|
||||
MaxAnisotropy = Graphics.MaxAnisotropy,
|
||||
AspectRatio = Graphics.AspectRatio,
|
||||
AntiAliasing = Graphics.AntiAliasing,
|
||||
ScalingFilter = Graphics.ScalingFilter,
|
||||
ScalingFilterLevel = Graphics.ScalingFilterLevel,
|
||||
GraphicsShadersDumpPath = Graphics.ShadersDumpPath,
|
||||
LoggingEnableDebug = Logger.EnableDebug,
|
||||
LoggingEnableStub = Logger.EnableStub,
|
||||
LoggingEnableInfo = Logger.EnableInfo,
|
||||
LoggingEnableWarn = Logger.EnableWarn,
|
||||
LoggingEnableError = Logger.EnableError,
|
||||
LoggingEnableTrace = Logger.EnableTrace,
|
||||
LoggingEnableGuest = Logger.EnableGuest,
|
||||
LoggingEnableFsAccessLog = Logger.EnableFsAccessLog,
|
||||
LoggingEnableAvalonia = Logger.EnableAvaloniaLog,
|
||||
LoggingFilteredClasses = Logger.FilteredClasses,
|
||||
LoggingGraphicsDebugLevel = Logger.GraphicsDebugLevel,
|
||||
SystemLanguage = System.Language,
|
||||
SystemRegion = System.Region,
|
||||
SystemTimeZone = System.TimeZone,
|
||||
SystemTimeOffset = System.SystemTimeOffset,
|
||||
MatchSystemTime = System.MatchSystemTime,
|
||||
DockedMode = System.EnableDockedMode,
|
||||
EnableDiscordIntegration = EnableDiscordIntegration,
|
||||
CheckUpdatesOnStart = CheckUpdatesOnStart,
|
||||
UpdateCheckerType = UpdateCheckerType,
|
||||
FocusLostActionType = FocusLostActionType,
|
||||
ShowConfirmExit = ShowConfirmExit,
|
||||
RememberWindowState = RememberWindowState,
|
||||
ShowTitleBar = ShowTitleBar,
|
||||
EnableHardwareAcceleration = EnableHardwareAcceleration,
|
||||
HideCursor = HideCursor,
|
||||
VSyncMode = Graphics.VSyncMode,
|
||||
EnableCustomVSyncInterval = Graphics.EnableCustomVSyncInterval,
|
||||
CustomVSyncInterval = Graphics.CustomVSyncInterval,
|
||||
EnableShaderCache = Graphics.EnableShaderCache,
|
||||
EnableTextureRecompression = Graphics.EnableTextureRecompression,
|
||||
EnableMacroHLE = Graphics.EnableMacroHLE,
|
||||
EnableColorSpacePassthrough = Graphics.EnableColorSpacePassthrough,
|
||||
EnablePtc = System.EnablePtc,
|
||||
EnableLowPowerPtc = System.EnableLowPowerPtc,
|
||||
EnableInternetAccess = System.EnableInternetAccess,
|
||||
EnableFsIntegrityChecks = System.EnableFsIntegrityChecks,
|
||||
FsGlobalAccessLogMode = System.FsGlobalAccessLogMode,
|
||||
AudioBackend = System.AudioBackend,
|
||||
AudioVolume = System.AudioVolume,
|
||||
MemoryManagerMode = System.MemoryManagerMode,
|
||||
DramSize = System.DramSize,
|
||||
IgnoreMissingServices = System.IgnoreMissingServices,
|
||||
IgnoreApplet = System.IgnoreControllerApplet,
|
||||
UseHypervisor = System.UseHypervisor,
|
||||
GuiColumns = new GuiColumns
|
||||
{
|
||||
FavColumn = UI.GuiColumns.FavColumn,
|
||||
IconColumn = UI.GuiColumns.IconColumn,
|
||||
AppColumn = UI.GuiColumns.AppColumn,
|
||||
DevColumn = UI.GuiColumns.DevColumn,
|
||||
VersionColumn = UI.GuiColumns.VersionColumn,
|
||||
LdnInfoColumn = UI.GuiColumns.LdnInfoColumn,
|
||||
TimePlayedColumn = UI.GuiColumns.TimePlayedColumn,
|
||||
LastPlayedColumn = UI.GuiColumns.LastPlayedColumn,
|
||||
FileExtColumn = UI.GuiColumns.FileExtColumn,
|
||||
FileSizeColumn = UI.GuiColumns.FileSizeColumn,
|
||||
PathColumn = UI.GuiColumns.PathColumn,
|
||||
},
|
||||
ColumnSort = new ColumnSort
|
||||
{
|
||||
SortColumnId = UI.ColumnSort.SortColumnId,
|
||||
SortAscending = UI.ColumnSort.SortAscending,
|
||||
},
|
||||
GameDirs = UI.GameDirs,
|
||||
AutoloadDirs = UI.AutoloadDirs,
|
||||
ShownFileTypes = new ShownFileTypes
|
||||
{
|
||||
NSP = UI.ShownFileTypes.NSP,
|
||||
PFS0 = UI.ShownFileTypes.PFS0,
|
||||
XCI = UI.ShownFileTypes.XCI,
|
||||
NCA = UI.ShownFileTypes.NCA,
|
||||
NRO = UI.ShownFileTypes.NRO,
|
||||
NSO = UI.ShownFileTypes.NSO,
|
||||
},
|
||||
WindowStartup = new WindowStartup
|
||||
{
|
||||
WindowSizeWidth = UI.WindowStartup.WindowSizeWidth,
|
||||
WindowSizeHeight = UI.WindowStartup.WindowSizeHeight,
|
||||
WindowPositionX = UI.WindowStartup.WindowPositionX,
|
||||
WindowPositionY = UI.WindowStartup.WindowPositionY,
|
||||
WindowMaximized = UI.WindowStartup.WindowMaximized,
|
||||
},
|
||||
LanguageCode = UI.LanguageCode,
|
||||
BaseStyle = UI.BaseStyle,
|
||||
GameListViewMode = UI.GameListViewMode,
|
||||
ShowNames = UI.ShowNames,
|
||||
GridSize = UI.GridSize,
|
||||
ApplicationSort = UI.ApplicationSort,
|
||||
IsAscendingOrder = UI.IsAscendingOrder,
|
||||
StartFullscreen = UI.StartFullscreen,
|
||||
StartNoUI = UI.StartNoUI,
|
||||
ShowConsole = UI.ShowConsole,
|
||||
EnableKeyboard = Hid.EnableKeyboard,
|
||||
EnableMouse = Hid.EnableMouse,
|
||||
DisableInputWhenOutOfFocus = Hid.DisableInputWhenOutOfFocus,
|
||||
Hotkeys = Hid.Hotkeys,
|
||||
InputConfig = Hid.InputConfig,
|
||||
RainbowSpeed = Hid.RainbowSpeed,
|
||||
GraphicsBackend = Graphics.GraphicsBackend,
|
||||
PreferredGpu = Graphics.PreferredGpu,
|
||||
MultiplayerLanInterfaceId = Multiplayer.LanInterfaceId,
|
||||
MultiplayerMode = Multiplayer.Mode,
|
||||
MultiplayerDisableP2p = Multiplayer.DisableP2p,
|
||||
MultiplayerLdnPassphrase = Multiplayer.LdnPassphrase,
|
||||
LdnServer = Multiplayer.LdnServer,
|
||||
ShowDirtyHacks = Hacks.ShowDirtyHacks,
|
||||
DirtyHacks = Hacks.EnabledHacks.Select(it => it.Pack()).ToArray(),
|
||||
};
|
||||
|
||||
return configurationFile;
|
||||
}
|
||||
|
||||
public void LoadDefault()
|
||||
{
|
||||
Logger.EnableFileLog.Value = true;
|
||||
Graphics.BackendThreading.Value = BackendThreading.Auto;
|
||||
Graphics.ResScale.Value = 1;
|
||||
Graphics.ResScaleCustom.Value = 1.0f;
|
||||
Graphics.MaxAnisotropy.Value = -1.0f;
|
||||
Graphics.AspectRatio.Value = AspectRatio.Fixed16x9;
|
||||
Graphics.GraphicsBackend.Value = DefaultGraphicsBackend();
|
||||
Graphics.PreferredGpu.Value = string.Empty;
|
||||
Graphics.ShadersDumpPath.Value = string.Empty;
|
||||
Logger.EnableDebug.Value = false;
|
||||
Logger.EnableStub.Value = true;
|
||||
Logger.EnableInfo.Value = true;
|
||||
Logger.EnableWarn.Value = true;
|
||||
Logger.EnableError.Value = true;
|
||||
Logger.EnableTrace.Value = false;
|
||||
Logger.EnableGuest.Value = true;
|
||||
Logger.EnableFsAccessLog.Value = false;
|
||||
Logger.EnableAvaloniaLog.Value = false;
|
||||
Logger.FilteredClasses.Value = [];
|
||||
Logger.GraphicsDebugLevel.Value = GraphicsDebugLevel.None;
|
||||
System.Language.Value = Language.AmericanEnglish;
|
||||
System.Region.Value = Region.USA;
|
||||
System.TimeZone.Value = "UTC";
|
||||
System.SystemTimeOffset.Value = 0;
|
||||
System.EnableDockedMode.Value = true;
|
||||
EnableDiscordIntegration.Value = true;
|
||||
UpdateCheckerType.Value = UpdaterType.PromptAtStartup;
|
||||
FocusLostActionType.Value = FocusLostType.DoNothing;
|
||||
ShowConfirmExit.Value = true;
|
||||
RememberWindowState.Value = true;
|
||||
ShowTitleBar.Value = !OperatingSystem.IsWindows();
|
||||
EnableHardwareAcceleration.Value = true;
|
||||
HideCursor.Value = HideCursorMode.OnIdle;
|
||||
Graphics.VSyncMode.Value = VSyncMode.Switch;
|
||||
Graphics.CustomVSyncInterval.Value = 120;
|
||||
Graphics.EnableCustomVSyncInterval.Value = false;
|
||||
Graphics.EnableShaderCache.Value = true;
|
||||
Graphics.EnableTextureRecompression.Value = false;
|
||||
Graphics.EnableMacroHLE.Value = true;
|
||||
Graphics.EnableColorSpacePassthrough.Value = false;
|
||||
Graphics.AntiAliasing.Value = AntiAliasing.None;
|
||||
Graphics.ScalingFilter.Value = ScalingFilter.Bilinear;
|
||||
Graphics.ScalingFilterLevel.Value = 80;
|
||||
System.EnablePtc.Value = true;
|
||||
System.EnableInternetAccess.Value = false;
|
||||
System.EnableFsIntegrityChecks.Value = true;
|
||||
System.FsGlobalAccessLogMode.Value = 0;
|
||||
System.AudioBackend.Value = AudioBackend.SDL2;
|
||||
System.AudioVolume.Value = 1;
|
||||
System.MemoryManagerMode.Value = MemoryManagerMode.HostMappedUnsafe;
|
||||
System.DramSize.Value = MemoryConfiguration.MemoryConfiguration4GiB;
|
||||
System.IgnoreMissingServices.Value = false;
|
||||
System.IgnoreControllerApplet.Value = false;
|
||||
System.UseHypervisor.Value = true;
|
||||
Multiplayer.LanInterfaceId.Value = "0";
|
||||
Multiplayer.Mode.Value = MultiplayerMode.Disabled;
|
||||
Multiplayer.DisableP2p.Value = false;
|
||||
Multiplayer.LdnPassphrase.Value = string.Empty;
|
||||
Multiplayer.LdnServer.Value = string.Empty;
|
||||
UI.GuiColumns.FavColumn.Value = true;
|
||||
UI.GuiColumns.IconColumn.Value = true;
|
||||
UI.GuiColumns.AppColumn.Value = true;
|
||||
UI.GuiColumns.DevColumn.Value = true;
|
||||
UI.GuiColumns.VersionColumn.Value = true;
|
||||
UI.GuiColumns.TimePlayedColumn.Value = true;
|
||||
UI.GuiColumns.LastPlayedColumn.Value = true;
|
||||
UI.GuiColumns.FileExtColumn.Value = true;
|
||||
UI.GuiColumns.FileSizeColumn.Value = true;
|
||||
UI.GuiColumns.PathColumn.Value = true;
|
||||
UI.ColumnSort.SortColumnId.Value = 0;
|
||||
UI.ColumnSort.SortAscending.Value = false;
|
||||
UI.GameDirs.Value = [];
|
||||
UI.AutoloadDirs.Value = [];
|
||||
UI.ShownFileTypes.NSP.Value = true;
|
||||
UI.ShownFileTypes.PFS0.Value = true;
|
||||
UI.ShownFileTypes.XCI.Value = true;
|
||||
UI.ShownFileTypes.NCA.Value = true;
|
||||
UI.ShownFileTypes.NRO.Value = true;
|
||||
UI.ShownFileTypes.NSO.Value = true;
|
||||
UI.LanguageCode.Value = "en_US";
|
||||
UI.BaseStyle.Value = "Dark";
|
||||
UI.GameListViewMode.Value = 0;
|
||||
UI.ShowNames.Value = true;
|
||||
UI.GridSize.Value = 2;
|
||||
UI.ApplicationSort.Value = 0;
|
||||
UI.IsAscendingOrder.Value = true;
|
||||
UI.StartFullscreen.Value = false;
|
||||
UI.StartNoUI.Value = false;
|
||||
UI.ShowConsole.Value = true;
|
||||
UI.WindowStartup.WindowSizeWidth.Value = 1280;
|
||||
UI.WindowStartup.WindowSizeHeight.Value = 760;
|
||||
UI.WindowStartup.WindowPositionX.Value = 0;
|
||||
UI.WindowStartup.WindowPositionY.Value = 0;
|
||||
UI.WindowStartup.WindowMaximized.Value = false;
|
||||
Hid.EnableKeyboard.Value = false;
|
||||
Hid.EnableMouse.Value = false;
|
||||
Hid.DisableInputWhenOutOfFocus.Value = false;
|
||||
Hid.Hotkeys.Value = new KeyboardHotkeys
|
||||
{
|
||||
ToggleVSyncMode = Key.F1,
|
||||
ToggleMute = Key.F2,
|
||||
Screenshot = Key.F8,
|
||||
ShowUI = Key.F4,
|
||||
Pause = Key.F5,
|
||||
ResScaleUp = Key.Unbound,
|
||||
ResScaleDown = Key.Unbound,
|
||||
VolumeUp = Key.Unbound,
|
||||
VolumeDown = Key.Unbound,
|
||||
};
|
||||
Hid.RainbowSpeed.Value = 1f;
|
||||
Hid.InputConfig.Value =
|
||||
[
|
||||
new StandardKeyboardInputConfig
|
||||
{
|
||||
Version = InputConfig.CurrentVersion,
|
||||
Backend = InputBackendType.WindowKeyboard,
|
||||
Id = "0",
|
||||
PlayerIndex = PlayerIndex.Player1,
|
||||
ControllerType = ControllerType.ProController,
|
||||
LeftJoycon = new LeftJoyconCommonConfig<Key>
|
||||
{
|
||||
DpadUp = Key.Up,
|
||||
DpadDown = Key.Down,
|
||||
DpadLeft = Key.Left,
|
||||
DpadRight = Key.Right,
|
||||
ButtonMinus = Key.Minus,
|
||||
ButtonL = Key.E,
|
||||
ButtonZl = Key.Q,
|
||||
ButtonSl = Key.Unbound,
|
||||
ButtonSr = Key.Unbound,
|
||||
},
|
||||
LeftJoyconStick = new JoyconConfigKeyboardStick<Key>
|
||||
{
|
||||
StickUp = Key.W,
|
||||
StickDown = Key.S,
|
||||
StickLeft = Key.A,
|
||||
StickRight = Key.D,
|
||||
StickButton = Key.F,
|
||||
},
|
||||
RightJoycon = new RightJoyconCommonConfig<Key>
|
||||
{
|
||||
ButtonA = Key.Z,
|
||||
ButtonB = Key.X,
|
||||
ButtonX = Key.C,
|
||||
ButtonY = Key.V,
|
||||
ButtonPlus = Key.Plus,
|
||||
ButtonR = Key.U,
|
||||
ButtonZr = Key.O,
|
||||
ButtonSl = Key.Unbound,
|
||||
ButtonSr = Key.Unbound,
|
||||
},
|
||||
RightJoyconStick = new JoyconConfigKeyboardStick<Key>
|
||||
{
|
||||
StickUp = Key.I,
|
||||
StickDown = Key.K,
|
||||
StickLeft = Key.J,
|
||||
StickRight = Key.L,
|
||||
StickButton = Key.H,
|
||||
},
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
private static GraphicsBackend DefaultGraphicsBackend()
|
||||
{
|
||||
// Any system running macOS or returning any amount of valid Vulkan devices should default to Vulkan.
|
||||
// Checks for if the Vulkan version and featureset is compatible should be performed within VulkanRenderer.
|
||||
if (OperatingSystem.IsMacOS() || VulkanRenderer.GetPhysicalDevices().Length > 0)
|
||||
{
|
||||
return GraphicsBackend.Vulkan;
|
||||
}
|
||||
|
||||
return GraphicsBackend.OpenGl;
|
||||
}
|
||||
}
|
||||
}
|
36
src/Ryujinx/Systems/Configuration/FileTypes.cs
Normal file
36
src/Ryujinx/Systems/Configuration/FileTypes.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
|
||||
using static Ryujinx.Ava.Systems.Configuration.ConfigurationState.UISection;
|
||||
|
||||
namespace Ryujinx.Ava.Systems.Configuration
|
||||
{
|
||||
public enum FileTypes
|
||||
{
|
||||
NSP,
|
||||
PFS0,
|
||||
XCI,
|
||||
NCA,
|
||||
NRO,
|
||||
NSO
|
||||
}
|
||||
|
||||
public static class FileTypesExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the current <see cref="ConfigurationState.UISection.ShownFileTypeSettings"/> value for the correlating FileType name.
|
||||
/// </summary>
|
||||
/// <param name="type">The name of the <see cref="ConfigurationState.UISection.ShownFileTypeSettings"/> parameter to get the value of.</param>
|
||||
/// <param name="config">The config instance to get the value from.</param>
|
||||
/// <returns>The current value of the setting. Value is <see langword="true"/> if the file type is to be shown on the games list, <see langword="false"/> otherwise.</returns>
|
||||
public static bool GetConfigValue(this FileTypes type, ConfigurationState.UISection.ShownFileTypeSettings config) => type switch
|
||||
{
|
||||
FileTypes.NSP => config.NSP.Value,
|
||||
FileTypes.PFS0 => config.PFS0.Value,
|
||||
FileTypes.XCI => config.XCI.Value,
|
||||
FileTypes.NCA => config.NCA.Value,
|
||||
FileTypes.NRO => config.NRO.Value,
|
||||
FileTypes.NSO => config.NSO.Value,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(type), type, null),
|
||||
};
|
||||
}
|
||||
}
|
78
src/Ryujinx/Systems/Configuration/LoggerModule.cs
Normal file
78
src/Ryujinx/Systems/Configuration/LoggerModule.cs
Normal file
|
@ -0,0 +1,78 @@
|
|||
using Ryujinx.Common.Configuration;
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.Common.Logging.Targets;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Ryujinx.Ava.Systems.Configuration
|
||||
{
|
||||
public static class LoggerModule
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
ConfigurationState.Instance.Logger.EnableDebug.Event +=
|
||||
(_, e) => Logger.SetEnable(LogLevel.Debug, e.NewValue);
|
||||
ConfigurationState.Instance.Logger.EnableStub.Event +=
|
||||
(_, e) => Logger.SetEnable(LogLevel.Stub, e.NewValue);
|
||||
ConfigurationState.Instance.Logger.EnableInfo.Event +=
|
||||
(_, e) => Logger.SetEnable(LogLevel.Info, e.NewValue);
|
||||
ConfigurationState.Instance.Logger.EnableWarn.Event +=
|
||||
(_, e) => Logger.SetEnable(LogLevel.Warning, e.NewValue);
|
||||
ConfigurationState.Instance.Logger.EnableError.Event +=
|
||||
(_, e) => Logger.SetEnable(LogLevel.Error, e.NewValue);
|
||||
ConfigurationState.Instance.Logger.EnableTrace.Event +=
|
||||
(_, e) => Logger.SetEnable(LogLevel.Trace, e.NewValue);
|
||||
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;
|
||||
|
||||
foreach (LogClass logClass in Enum.GetValues<LogClass>())
|
||||
{
|
||||
Logger.SetEnable(logClass, noFilter);
|
||||
}
|
||||
|
||||
foreach (LogClass logClass in e.NewValue)
|
||||
{
|
||||
Logger.SetEnable(logClass, true);
|
||||
}
|
||||
};
|
||||
|
||||
ConfigurationState.Instance.Logger.EnableFileLog.Event += (_, e) =>
|
||||
{
|
||||
if (e.NewValue)
|
||||
{
|
||||
string logDir = AppDataManager.LogsDirPath;
|
||||
FileStream logFile = null;
|
||||
|
||||
if (!string.IsNullOrEmpty(logDir))
|
||||
{
|
||||
logFile = FileLogTarget.PrepareLogFile(logDir);
|
||||
}
|
||||
|
||||
if (logFile == null)
|
||||
{
|
||||
Logger.Error?.Print(LogClass.Application,
|
||||
"No writable log directory available. Make sure either the Logs directory, Application Data, or the Ryujinx directory is writable.");
|
||||
Logger.RemoveTarget("file");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Logger.AddTarget(new AsyncLogTargetWrapper(
|
||||
new FileLogTarget("file", logFile),
|
||||
1000
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.RemoveTarget("file");
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
28
src/Ryujinx/Systems/Configuration/System/Language.cs
Normal file
28
src/Ryujinx/Systems/Configuration/System/Language.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
using Ryujinx.Common.Utilities;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Ryujinx.Ava.Systems.Configuration.System
|
||||
{
|
||||
[JsonConverter(typeof(TypedStringEnumConverter<Language>))]
|
||||
public enum Language
|
||||
{
|
||||
Japanese,
|
||||
AmericanEnglish,
|
||||
French,
|
||||
German,
|
||||
Italian,
|
||||
Spanish,
|
||||
Chinese,
|
||||
Korean,
|
||||
Dutch,
|
||||
Portuguese,
|
||||
Russian,
|
||||
Taiwanese,
|
||||
BritishEnglish,
|
||||
CanadianFrench,
|
||||
LatinAmericanSpanish,
|
||||
SimplifiedChinese,
|
||||
TraditionalChinese,
|
||||
BrazilianPortuguese,
|
||||
}
|
||||
}
|
17
src/Ryujinx/Systems/Configuration/System/Region.cs
Normal file
17
src/Ryujinx/Systems/Configuration/System/Region.cs
Normal file
|
@ -0,0 +1,17 @@
|
|||
using Ryujinx.Common.Utilities;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Ryujinx.Ava.Systems.Configuration.System
|
||||
{
|
||||
[JsonConverter(typeof(TypedStringEnumConverter<Region>))]
|
||||
public enum Region
|
||||
{
|
||||
Japan,
|
||||
USA,
|
||||
Europe,
|
||||
Australia,
|
||||
China,
|
||||
Korea,
|
||||
Taiwan,
|
||||
}
|
||||
}
|
8
src/Ryujinx/Systems/Configuration/UI/ColumnSort.cs
Normal file
8
src/Ryujinx/Systems/Configuration/UI/ColumnSort.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
namespace Ryujinx.Ava.Systems.Configuration.UI
|
||||
{
|
||||
public struct ColumnSort
|
||||
{
|
||||
public int SortColumnId { get; set; }
|
||||
public bool SortAscending { get; set; }
|
||||
}
|
||||
}
|
15
src/Ryujinx/Systems/Configuration/UI/FocusLostType.cs
Normal file
15
src/Ryujinx/Systems/Configuration/UI/FocusLostType.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
using Ryujinx.Common.Utilities;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Ryujinx.Ava.Systems.Configuration.UI
|
||||
{
|
||||
[JsonConverter(typeof(TypedStringEnumConverter<FocusLostType>))]
|
||||
public enum FocusLostType
|
||||
{
|
||||
DoNothing,
|
||||
BlockInput,
|
||||
MuteAudio,
|
||||
BlockInputAndMuteAudio,
|
||||
PauseEmulation
|
||||
}
|
||||
}
|
17
src/Ryujinx/Systems/Configuration/UI/GuiColumns.cs
Normal file
17
src/Ryujinx/Systems/Configuration/UI/GuiColumns.cs
Normal file
|
@ -0,0 +1,17 @@
|
|||
namespace Ryujinx.Ava.Systems.Configuration.UI
|
||||
{
|
||||
public struct GuiColumns
|
||||
{
|
||||
public bool FavColumn { get; set; }
|
||||
public bool IconColumn { get; set; }
|
||||
public bool AppColumn { get; set; }
|
||||
public bool DevColumn { get; set; }
|
||||
public bool VersionColumn { get; set; }
|
||||
public bool LdnInfoColumn { get; set; }
|
||||
public bool TimePlayedColumn { get; set; }
|
||||
public bool LastPlayedColumn { get; set; }
|
||||
public bool FileExtColumn { get; set; }
|
||||
public bool FileSizeColumn { get; set; }
|
||||
public bool PathColumn { get; set; }
|
||||
}
|
||||
}
|
12
src/Ryujinx/Systems/Configuration/UI/ShownFileTypes.cs
Normal file
12
src/Ryujinx/Systems/Configuration/UI/ShownFileTypes.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
namespace Ryujinx.Ava.Systems.Configuration.UI
|
||||
{
|
||||
public struct ShownFileTypes
|
||||
{
|
||||
public bool NSP { get; set; }
|
||||
public bool PFS0 { get; set; }
|
||||
public bool XCI { get; set; }
|
||||
public bool NCA { get; set; }
|
||||
public bool NRO { get; set; }
|
||||
public bool NSO { get; set; }
|
||||
}
|
||||
}
|
13
src/Ryujinx/Systems/Configuration/UI/UpdaterType.cs
Normal file
13
src/Ryujinx/Systems/Configuration/UI/UpdaterType.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
using Ryujinx.Common.Utilities;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Ryujinx.Ava.Systems.Configuration.UI
|
||||
{
|
||||
[JsonConverter(typeof(TypedStringEnumConverter<UpdaterType>))]
|
||||
public enum UpdaterType
|
||||
{
|
||||
Off,
|
||||
PromptAtStartup,
|
||||
CheckInBackground
|
||||
}
|
||||
}
|
11
src/Ryujinx/Systems/Configuration/UI/WindowStartup.cs
Normal file
11
src/Ryujinx/Systems/Configuration/UI/WindowStartup.cs
Normal file
|
@ -0,0 +1,11 @@
|
|||
namespace Ryujinx.Ava.Systems.Configuration.UI
|
||||
{
|
||||
public struct WindowStartup
|
||||
{
|
||||
public int WindowSizeWidth { get; set; }
|
||||
public int WindowSizeHeight { get; set; }
|
||||
public int WindowPositionX { get; set; }
|
||||
public int WindowPositionY { get; set; }
|
||||
public bool WindowMaximized { get; set; }
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue