| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421 |
- using Ryujinx.Common;
- using Ryujinx.Common.Configuration;
- using Ryujinx.Common.Configuration.Hid;
- using Ryujinx.Common.Configuration.Hid.Controller;
- using Ryujinx.Common.Configuration.Hid.Keyboard;
- using Ryujinx.Common.Logging;
- using Ryujinx.Ui.Common.Configuration.System;
- using Ryujinx.Ui.Common.Configuration.Ui;
- using Ryujinx.Ui.Common.Helper;
- using System;
- using System.Collections.Generic;
- using System.Text.Json.Nodes;
- namespace Ryujinx.Ui.Common.Configuration
- {
- public 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> 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>();
- 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>
- /// 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 file types to be hidden in the games List
- /// </summary>
- public ShownFileTypeSettings ShownFileTypes { get; private set; }
- /// <summary>
- /// Language Code for the UI
- /// </summary>
- public ReactiveObject<string> LanguageCode { get; private set; }
- /// <summary>
- /// Enable or disable custom themes in the GUI
- /// </summary>
- public ReactiveObject<bool> EnableCustomTheme { get; private set; }
- /// <summary>
- /// Path to custom GUI theme
- /// </summary>
- public ReactiveObject<string> CustomThemePath { 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>
- /// 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>>();
- ShownFileTypes = new ShownFileTypeSettings();
- EnableCustomTheme = new ReactiveObject<bool>();
- CustomThemePath = new ReactiveObject<string>();
- BaseStyle = new ReactiveObject<string>();
- StartFullscreen = 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 (s, 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>
- /// 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>();
- 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>();
- FilteredClasses = new ReactiveObject<LogClass[]>();
- EnableFileLog = new ReactiveObject<bool>();
- EnableFileLog.Event += static (sender, e) => LogValueChange(sender, e, 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>
- /// Enables or disables Docked Mode
- /// </summary>
- public ReactiveObject<bool> EnableDockedMode { get; private set; }
- /// <summary>
- /// Enables or disables profiled translation cache persistency
- /// </summary>
- public ReactiveObject<bool> EnablePtc { 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<bool> ExpandRam { get; private set; }
- /// <summary>
- /// Enable or disable ignoring missing services
- /// </summary>
- public ReactiveObject<bool> IgnoreMissingServices { get; private set; }
- /// <summary>
- /// Uses Hypervisor over JIT if available
- /// </summary>
- public ReactiveObject<bool> UseHypervisor { get; private set; }
- public SystemSection()
- {
- Language = new ReactiveObject<Language>();
- Region = new ReactiveObject<Region>();
- TimeZone = new ReactiveObject<string>();
- SystemTimeOffset = new ReactiveObject<long>();
- EnableDockedMode = new ReactiveObject<bool>();
- EnableDockedMode.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnableDockedMode));
- EnablePtc = new ReactiveObject<bool>();
- EnablePtc.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnablePtc));
- EnableInternetAccess = new ReactiveObject<bool>();
- EnableInternetAccess.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnableInternetAccess));
- EnableFsIntegrityChecks = new ReactiveObject<bool>();
- EnableFsIntegrityChecks.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnableFsIntegrityChecks));
- FsGlobalAccessLogMode = new ReactiveObject<int>();
- FsGlobalAccessLogMode.Event += static (sender, e) => LogValueChange(sender, e, nameof(FsGlobalAccessLogMode));
- AudioBackend = new ReactiveObject<AudioBackend>();
- AudioBackend.Event += static (sender, e) => LogValueChange(sender, e, nameof(AudioBackend));
- MemoryManagerMode = new ReactiveObject<MemoryManagerMode>();
- MemoryManagerMode.Event += static (sender, e) => LogValueChange(sender, e, nameof(MemoryManagerMode));
- ExpandRam = new ReactiveObject<bool>();
- ExpandRam.Event += static (sender, e) => LogValueChange(sender, e, nameof(ExpandRam));
- IgnoreMissingServices = new ReactiveObject<bool>();
- IgnoreMissingServices.Event += static (sender, e) => LogValueChange(sender, e, nameof(IgnoreMissingServices));
- AudioVolume = new ReactiveObject<float>();
- AudioVolume.Event += static (sender, e) => LogValueChange(sender, e, nameof(AudioVolume));
- UseHypervisor = new ReactiveObject<bool>();
- UseHypervisor.Event += static (sender, e) => LogValueChange(sender, e, 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>
- /// 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; }
- public HidSection()
- {
- EnableKeyboard = new ReactiveObject<bool>();
- EnableMouse = new ReactiveObject<bool>();
- Hotkeys = new ReactiveObject<KeyboardHotkeys>();
- InputConfig = new ReactiveObject<List<InputConfig>>();
- }
- }
- /// <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>
- /// Enables or disables Vertical Sync
- /// </summary>
- public ReactiveObject<bool> EnableVsync { 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>
- /// 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.Event += static (sender, e) => LogValueChange(sender, e, nameof(BackendThreading));
- ResScale = new ReactiveObject<int>();
- ResScale.Event += static (sender, e) => LogValueChange(sender, e, nameof(ResScale));
- ResScaleCustom = new ReactiveObject<float>();
- ResScaleCustom.Event += static (sender, e) => LogValueChange(sender, e, nameof(ResScaleCustom));
- MaxAnisotropy = new ReactiveObject<float>();
- MaxAnisotropy.Event += static (sender, e) => LogValueChange(sender, e, nameof(MaxAnisotropy));
- AspectRatio = new ReactiveObject<AspectRatio>();
- AspectRatio.Event += static (sender, e) => LogValueChange(sender, e, nameof(AspectRatio));
- ShadersDumpPath = new ReactiveObject<string>();
- EnableVsync = new ReactiveObject<bool>();
- EnableVsync.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnableVsync));
- EnableShaderCache = new ReactiveObject<bool>();
- EnableShaderCache.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnableShaderCache));
- EnableTextureRecompression = new ReactiveObject<bool>();
- EnableTextureRecompression.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnableTextureRecompression));
- GraphicsBackend = new ReactiveObject<GraphicsBackend>();
- GraphicsBackend.Event += static (sender, e) => LogValueChange(sender, e, nameof(GraphicsBackend));
- PreferredGpu = new ReactiveObject<string>();
- PreferredGpu.Event += static (sender, e) => LogValueChange(sender, e, nameof(PreferredGpu));
- EnableMacroHLE = new ReactiveObject<bool>();
- EnableMacroHLE.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnableMacroHLE));
- AntiAliasing = new ReactiveObject<AntiAliasing>();
- AntiAliasing.Event += static (sender, e) => LogValueChange(sender, e, nameof(AntiAliasing));
- ScalingFilter = new ReactiveObject<ScalingFilter>();
- ScalingFilter.Event += static (sender, e) => LogValueChange(sender, e, nameof(ScalingFilter));
- ScalingFilterLevel = new ReactiveObject<int>();
- ScalingFilterLevel.Event += static (sender, e) => LogValueChange(sender, e, nameof(ScalingFilterLevel));
- }
- }
- /// <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>
- /// 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>
- /// Show "Confirm Exit" Dialog
- /// </summary>
- public ReactiveObject<bool> ShowConfirmExit { get; private set; }
- /// <summary>
- /// Hide Cursor on Idle
- /// </summary>
- public ReactiveObject<bool> HideCursorOnIdle { get; private set; }
- private ConfigurationState()
- {
- Ui = new UiSection();
- Logger = new LoggerSection();
- System = new SystemSection();
- Graphics = new GraphicsSection();
- Hid = new HidSection();
- EnableDiscordIntegration = new ReactiveObject<bool>();
- CheckUpdatesOnStart = new ReactiveObject<bool>();
- ShowConfirmExit = new ReactiveObject<bool>();
- HideCursorOnIdle = new ReactiveObject<bool>();
- }
- public ConfigurationFileFormat ToFileFormat()
- {
- ConfigurationFileFormat configurationFile = new ConfigurationFileFormat
- {
- 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,
- LoggingFilteredClasses = Logger.FilteredClasses,
- LoggingGraphicsDebugLevel = Logger.GraphicsDebugLevel,
- SystemLanguage = System.Language,
- SystemRegion = System.Region,
- SystemTimeZone = System.TimeZone,
- SystemTimeOffset = System.SystemTimeOffset,
- DockedMode = System.EnableDockedMode,
- EnableDiscordIntegration = EnableDiscordIntegration,
- CheckUpdatesOnStart = CheckUpdatesOnStart,
- ShowConfirmExit = ShowConfirmExit,
- HideCursorOnIdle = HideCursorOnIdle,
- EnableVsync = Graphics.EnableVsync,
- EnableShaderCache = Graphics.EnableShaderCache,
- EnableTextureRecompression = Graphics.EnableTextureRecompression,
- EnableMacroHLE = Graphics.EnableMacroHLE,
- EnablePtc = System.EnablePtc,
- EnableInternetAccess = System.EnableInternetAccess,
- EnableFsIntegrityChecks = System.EnableFsIntegrityChecks,
- FsGlobalAccessLogMode = System.FsGlobalAccessLogMode,
- AudioBackend = System.AudioBackend,
- AudioVolume = System.AudioVolume,
- MemoryManagerMode = System.MemoryManagerMode,
- ExpandRam = System.ExpandRam,
- IgnoreMissingServices = System.IgnoreMissingServices,
- 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,
- 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,
- 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,
- },
- LanguageCode = Ui.LanguageCode,
- EnableCustomTheme = Ui.EnableCustomTheme,
- CustomThemePath = Ui.CustomThemePath,
- BaseStyle = Ui.BaseStyle,
- GameListViewMode = Ui.GameListViewMode,
- ShowNames = Ui.ShowNames,
- GridSize = Ui.GridSize,
- ApplicationSort = Ui.ApplicationSort,
- IsAscendingOrder = Ui.IsAscendingOrder,
- StartFullscreen = Ui.StartFullscreen,
- ShowConsole = Ui.ShowConsole,
- EnableKeyboard = Hid.EnableKeyboard,
- EnableMouse = Hid.EnableMouse,
- Hotkeys = Hid.Hotkeys,
- KeyboardConfig = new List<JsonObject>(),
- ControllerConfig = new List<JsonObject>(),
- InputConfig = Hid.InputConfig,
- GraphicsBackend = Graphics.GraphicsBackend,
- PreferredGpu = Graphics.PreferredGpu
- };
- 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 = OperatingSystem.IsMacOS() ? GraphicsBackend.Vulkan : GraphicsBackend.OpenGl;
- Graphics.PreferredGpu.Value = "";
- Graphics.ShadersDumpPath.Value = "";
- 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.FilteredClasses.Value = Array.Empty<LogClass>();
- 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;
- CheckUpdatesOnStart.Value = true;
- ShowConfirmExit.Value = true;
- HideCursorOnIdle.Value = false;
- Graphics.EnableVsync.Value = true;
- Graphics.EnableShaderCache.Value = true;
- Graphics.EnableTextureRecompression.Value = false;
- Graphics.EnableMacroHLE.Value = true;
- 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.ExpandRam.Value = false;
- System.IgnoreMissingServices.Value = false;
- System.UseHypervisor.Value = true;
- 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 = new List<string>();
- 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.EnableCustomTheme.Value = true;
- Ui.LanguageCode.Value = "en_US";
- Ui.CustomThemePath.Value = "";
- 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.ShowConsole.Value = true;
- Hid.EnableKeyboard.Value = false;
- Hid.EnableMouse.Value = false;
- Hid.Hotkeys.Value = new KeyboardHotkeys
- {
- ToggleVsync = 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.InputConfig.Value = new List<InputConfig>
- {
- new StandardKeyboardInputConfig
- {
- Version = InputConfig.CurrentVersion,
- Backend = InputBackendType.WindowKeyboard,
- Id = "0",
- PlayerIndex = PlayerIndex.Player1,
- ControllerType = ControllerType.JoyconPair,
- 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,
- }
- }
- };
- }
- public ConfigurationLoadResult Load(ConfigurationFileFormat configurationFileFormat, string configurationFilePath)
- {
- bool configurationFileUpdated = false;
- if (configurationFileFormat.Version < 0 || configurationFileFormat.Version > ConfigurationFileFormat.CurrentVersion)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Unsupported configuration version {configurationFileFormat.Version}, loading default.");
- LoadDefault();
- return ConfigurationLoadResult.NotLoaded;
- }
- ConfigurationLoadResult result = ConfigurationLoadResult.Success;
- if (configurationFileFormat.Version < 2)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 2.");
- configurationFileFormat.SystemRegion = Region.USA;
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 3)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 3.");
- configurationFileFormat.SystemTimeZone = "UTC";
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 4)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 4.");
- configurationFileFormat.MaxAnisotropy = -1;
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 5)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 5.");
- configurationFileFormat.SystemTimeOffset = 0;
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 8)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 8.");
- configurationFileFormat.EnablePtc = true;
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 9)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 9.");
- configurationFileFormat.ColumnSort = new ColumnSort
- {
- SortColumnId = 0,
- SortAscending = false
- };
- configurationFileFormat.Hotkeys = new KeyboardHotkeys
- {
- ToggleVsync = Key.F1
- };
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 10)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 10.");
- configurationFileFormat.AudioBackend = AudioBackend.OpenAl;
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 11)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 11.");
- configurationFileFormat.ResScale = 1;
- configurationFileFormat.ResScaleCustom = 1.0f;
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 12)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 12.");
- configurationFileFormat.LoggingGraphicsDebugLevel = GraphicsDebugLevel.None;
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 14)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 14.");
- configurationFileFormat.CheckUpdatesOnStart = true;
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 16)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 16.");
- configurationFileFormat.EnableShaderCache = true;
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 17)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 17.");
- configurationFileFormat.StartFullscreen = false;
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 18)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 18.");
- configurationFileFormat.AspectRatio = AspectRatio.Fixed16x9;
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 20)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 20.");
- configurationFileFormat.ShowConfirmExit = true;
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 22)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 22.");
- configurationFileFormat.HideCursorOnIdle = false;
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 24)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 24.");
- configurationFileFormat.InputConfig = new List<InputConfig>
- {
- new StandardKeyboardInputConfig
- {
- Version = InputConfig.CurrentVersion,
- Backend = InputBackendType.WindowKeyboard,
- Id = "0",
- PlayerIndex = PlayerIndex.Player1,
- ControllerType = ControllerType.JoyconPair,
- 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,
- }
- }
- };
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 25)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 25.");
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 26)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 26.");
- configurationFileFormat.MemoryManagerMode = MemoryManagerMode.HostMappedUnsafe;
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 27)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 27.");
- configurationFileFormat.EnableMouse = false;
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 28)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 28.");
- configurationFileFormat.Hotkeys = new KeyboardHotkeys
- {
- ToggleVsync = Key.F1,
- Screenshot = Key.F8
- };
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 29)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 29.");
- configurationFileFormat.Hotkeys = new KeyboardHotkeys
- {
- ToggleVsync = Key.F1,
- Screenshot = Key.F8,
- ShowUi = Key.F4
- };
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 30)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 30.");
- foreach(InputConfig config in configurationFileFormat.InputConfig)
- {
- if (config is StandardControllerInputConfig controllerConfig)
- {
- controllerConfig.Rumble = new RumbleConfigController
- {
- EnableRumble = false,
- StrongRumble = 1f,
- WeakRumble = 1f
- };
- }
- }
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 31)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 31.");
- configurationFileFormat.BackendThreading = BackendThreading.Auto;
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 32)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 32.");
- configurationFileFormat.Hotkeys = new KeyboardHotkeys
- {
- ToggleVsync = configurationFileFormat.Hotkeys.ToggleVsync,
- Screenshot = configurationFileFormat.Hotkeys.Screenshot,
- ShowUi = configurationFileFormat.Hotkeys.ShowUi,
- Pause = Key.F5
- };
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 33)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 33.");
- configurationFileFormat.Hotkeys = new KeyboardHotkeys
- {
- ToggleVsync = configurationFileFormat.Hotkeys.ToggleVsync,
- Screenshot = configurationFileFormat.Hotkeys.Screenshot,
- ShowUi = configurationFileFormat.Hotkeys.ShowUi,
- Pause = configurationFileFormat.Hotkeys.Pause,
- ToggleMute = Key.F2
- };
- configurationFileFormat.AudioVolume = 1;
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 34)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 34.");
- configurationFileFormat.EnableInternetAccess = false;
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 35)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 35.");
- foreach (InputConfig config in configurationFileFormat.InputConfig)
- {
- if (config is StandardControllerInputConfig controllerConfig)
- {
- controllerConfig.RangeLeft = 1.0f;
- controllerConfig.RangeRight = 1.0f;
- }
- }
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 36)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 36.");
- configurationFileFormat.LoggingEnableTrace = false;
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 37)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 37.");
- configurationFileFormat.ShowConsole = true;
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 38)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 38.");
- configurationFileFormat.BaseStyle = "Dark";
- configurationFileFormat.GameListViewMode = 0;
- configurationFileFormat.ShowNames = true;
- configurationFileFormat.GridSize = 2;
- configurationFileFormat.LanguageCode = "en_US";
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 39)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 39.");
- configurationFileFormat.Hotkeys = new KeyboardHotkeys
- {
- ToggleVsync = configurationFileFormat.Hotkeys.ToggleVsync,
- Screenshot = configurationFileFormat.Hotkeys.Screenshot,
- ShowUi = configurationFileFormat.Hotkeys.ShowUi,
- Pause = configurationFileFormat.Hotkeys.Pause,
- ToggleMute = configurationFileFormat.Hotkeys.ToggleMute,
- ResScaleUp = Key.Unbound,
- ResScaleDown = Key.Unbound
- };
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 40)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 40.");
- configurationFileFormat.GraphicsBackend = GraphicsBackend.OpenGl;
- result |= ConfigurationLoadResult.MigratedFromPreVulkan;
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 41)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 41.");
- configurationFileFormat.Hotkeys = new KeyboardHotkeys
- {
- ToggleVsync = configurationFileFormat.Hotkeys.ToggleVsync,
- Screenshot = configurationFileFormat.Hotkeys.Screenshot,
- ShowUi = configurationFileFormat.Hotkeys.ShowUi,
- Pause = configurationFileFormat.Hotkeys.Pause,
- ToggleMute = configurationFileFormat.Hotkeys.ToggleMute,
- ResScaleUp = configurationFileFormat.Hotkeys.ResScaleUp,
- ResScaleDown = configurationFileFormat.Hotkeys.ResScaleDown,
- VolumeUp = Key.Unbound,
- VolumeDown = Key.Unbound
- };
- }
- if (configurationFileFormat.Version < 42)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 42.");
- configurationFileFormat.EnableMacroHLE = true;
- }
- if (configurationFileFormat.Version < 43)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 43.");
- configurationFileFormat.UseHypervisor = true;
- }
- if (configurationFileFormat.Version < 44)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 44.");
- configurationFileFormat.AntiAliasing = AntiAliasing.None;
- configurationFileFormat.ScalingFilter = ScalingFilter.Bilinear;
- configurationFileFormat.ScalingFilterLevel = 80;
- configurationFileUpdated = true;
- }
- if (configurationFileFormat.Version < 45)
- {
- Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 45.");
- configurationFileFormat.ShownFileTypes = new ShownFileTypes
- {
- NSP = true,
- PFS0 = true,
- XCI = true,
- NCA = true,
- NRO = true,
- NSO = true
- };
- configurationFileUpdated = true;
- }
- Logger.EnableFileLog.Value = configurationFileFormat.EnableFileLog;
- Graphics.ResScale.Value = configurationFileFormat.ResScale;
- Graphics.ResScaleCustom.Value = configurationFileFormat.ResScaleCustom;
- Graphics.MaxAnisotropy.Value = configurationFileFormat.MaxAnisotropy;
- Graphics.AspectRatio.Value = configurationFileFormat.AspectRatio;
- Graphics.ShadersDumpPath.Value = configurationFileFormat.GraphicsShadersDumpPath;
- Graphics.BackendThreading.Value = configurationFileFormat.BackendThreading;
- Graphics.GraphicsBackend.Value = configurationFileFormat.GraphicsBackend;
- Graphics.PreferredGpu.Value = configurationFileFormat.PreferredGpu;
- Graphics.AntiAliasing.Value = configurationFileFormat.AntiAliasing;
- Graphics.ScalingFilter.Value = configurationFileFormat.ScalingFilter;
- Graphics.ScalingFilterLevel.Value = configurationFileFormat.ScalingFilterLevel;
- Logger.EnableDebug.Value = configurationFileFormat.LoggingEnableDebug;
- Logger.EnableStub.Value = configurationFileFormat.LoggingEnableStub;
- Logger.EnableInfo.Value = configurationFileFormat.LoggingEnableInfo;
- Logger.EnableWarn.Value = configurationFileFormat.LoggingEnableWarn;
- Logger.EnableError.Value = configurationFileFormat.LoggingEnableError;
- Logger.EnableTrace.Value = configurationFileFormat.LoggingEnableTrace;
- Logger.EnableGuest.Value = configurationFileFormat.LoggingEnableGuest;
- Logger.EnableFsAccessLog.Value = configurationFileFormat.LoggingEnableFsAccessLog;
- Logger.FilteredClasses.Value = configurationFileFormat.LoggingFilteredClasses;
- Logger.GraphicsDebugLevel.Value = configurationFileFormat.LoggingGraphicsDebugLevel;
- System.Language.Value = configurationFileFormat.SystemLanguage;
- System.Region.Value = configurationFileFormat.SystemRegion;
- System.TimeZone.Value = configurationFileFormat.SystemTimeZone;
- System.SystemTimeOffset.Value = configurationFileFormat.SystemTimeOffset;
- System.EnableDockedMode.Value = configurationFileFormat.DockedMode;
- EnableDiscordIntegration.Value = configurationFileFormat.EnableDiscordIntegration;
- CheckUpdatesOnStart.Value = configurationFileFormat.CheckUpdatesOnStart;
- ShowConfirmExit.Value = configurationFileFormat.ShowConfirmExit;
- HideCursorOnIdle.Value = configurationFileFormat.HideCursorOnIdle;
- Graphics.EnableVsync.Value = configurationFileFormat.EnableVsync;
- Graphics.EnableShaderCache.Value = configurationFileFormat.EnableShaderCache;
- Graphics.EnableTextureRecompression.Value = configurationFileFormat.EnableTextureRecompression;
- Graphics.EnableMacroHLE.Value = configurationFileFormat.EnableMacroHLE;
- System.EnablePtc.Value = configurationFileFormat.EnablePtc;
- System.EnableInternetAccess.Value = configurationFileFormat.EnableInternetAccess;
- System.EnableFsIntegrityChecks.Value = configurationFileFormat.EnableFsIntegrityChecks;
- System.FsGlobalAccessLogMode.Value = configurationFileFormat.FsGlobalAccessLogMode;
- System.AudioBackend.Value = configurationFileFormat.AudioBackend;
- System.AudioVolume.Value = configurationFileFormat.AudioVolume;
- System.MemoryManagerMode.Value = configurationFileFormat.MemoryManagerMode;
- System.ExpandRam.Value = configurationFileFormat.ExpandRam;
- System.IgnoreMissingServices.Value = configurationFileFormat.IgnoreMissingServices;
- System.UseHypervisor.Value = configurationFileFormat.UseHypervisor;
- Ui.GuiColumns.FavColumn.Value = configurationFileFormat.GuiColumns.FavColumn;
- Ui.GuiColumns.IconColumn.Value = configurationFileFormat.GuiColumns.IconColumn;
- Ui.GuiColumns.AppColumn.Value = configurationFileFormat.GuiColumns.AppColumn;
- Ui.GuiColumns.DevColumn.Value = configurationFileFormat.GuiColumns.DevColumn;
- Ui.GuiColumns.VersionColumn.Value = configurationFileFormat.GuiColumns.VersionColumn;
- Ui.GuiColumns.TimePlayedColumn.Value = configurationFileFormat.GuiColumns.TimePlayedColumn;
- Ui.GuiColumns.LastPlayedColumn.Value = configurationFileFormat.GuiColumns.LastPlayedColumn;
- Ui.GuiColumns.FileExtColumn.Value = configurationFileFormat.GuiColumns.FileExtColumn;
- Ui.GuiColumns.FileSizeColumn.Value = configurationFileFormat.GuiColumns.FileSizeColumn;
- Ui.GuiColumns.PathColumn.Value = configurationFileFormat.GuiColumns.PathColumn;
- Ui.ColumnSort.SortColumnId.Value = configurationFileFormat.ColumnSort.SortColumnId;
- Ui.ColumnSort.SortAscending.Value = configurationFileFormat.ColumnSort.SortAscending;
- Ui.GameDirs.Value = configurationFileFormat.GameDirs;
- Ui.ShownFileTypes.NSP.Value = configurationFileFormat.ShownFileTypes.NSP;
- Ui.ShownFileTypes.PFS0.Value = configurationFileFormat.ShownFileTypes.PFS0;
- Ui.ShownFileTypes.XCI.Value = configurationFileFormat.ShownFileTypes.XCI;
- Ui.ShownFileTypes.NCA.Value = configurationFileFormat.ShownFileTypes.NCA;
- Ui.ShownFileTypes.NRO.Value = configurationFileFormat.ShownFileTypes.NRO;
- Ui.ShownFileTypes.NSO.Value = configurationFileFormat.ShownFileTypes.NSO;
- Ui.EnableCustomTheme.Value = configurationFileFormat.EnableCustomTheme;
- Ui.LanguageCode.Value = configurationFileFormat.LanguageCode;
- Ui.CustomThemePath.Value = configurationFileFormat.CustomThemePath;
- Ui.BaseStyle.Value = configurationFileFormat.BaseStyle;
- Ui.GameListViewMode.Value = configurationFileFormat.GameListViewMode;
- Ui.ShowNames.Value = configurationFileFormat.ShowNames;
- Ui.IsAscendingOrder.Value = configurationFileFormat.IsAscendingOrder;
- Ui.GridSize.Value = configurationFileFormat.GridSize;
- Ui.ApplicationSort.Value = configurationFileFormat.ApplicationSort;
- Ui.StartFullscreen.Value = configurationFileFormat.StartFullscreen;
- Ui.ShowConsole.Value = configurationFileFormat.ShowConsole;
- Hid.EnableKeyboard.Value = configurationFileFormat.EnableKeyboard;
- Hid.EnableMouse.Value = configurationFileFormat.EnableMouse;
- Hid.Hotkeys.Value = configurationFileFormat.Hotkeys;
- Hid.InputConfig.Value = configurationFileFormat.InputConfig;
- if (Hid.InputConfig.Value == null)
- {
- Hid.InputConfig.Value = new List<InputConfig>();
- }
- if (configurationFileUpdated)
- {
- ToFileFormat().SaveConfig(configurationFilePath);
- Ryujinx.Common.Logging.Logger.Notice.Print(LogClass.Application, $"Configuration file updated to version {ConfigurationFileFormat.CurrentVersion}");
- }
- return result;
- }
- private static void LogValueChange<T>(object sender, ReactiveEventArgs<T> eventArgs, string valueName)
- {
- Ryujinx.Common.Logging.Logger.Info?.Print(LogClass.Configuration, $"{valueName} set to: {eventArgs.NewValue}");
- }
- public static void Initialize()
- {
- if (Instance != null)
- {
- throw new InvalidOperationException("Configuration is already initialized");
- }
- Instance = new ConfigurationState();
- }
- }
- }
|