Rewrite the configuration system (#831)
The configuration system was quite fragile and too dependent on everything, this fix #812 . The changes: The file configuration is now entirely independent from the internal configuration state. The file configuration is versioned (current version is 1). Every configuration elements are now reactive properties that the emulator can register on to handle initialization and configuration changes. The configuration system is now in Ryujinx.Common to be accessible on every projects. Discord integration is now independent from the UI and can be reloaded. The primary controller is now configurable at runtime (NOTE: the UI currently doesn't have any options to configure real controller). The logger is entirely reloadable. You can now hotplug your controller when the emulator is running. The logger now takes name for every LogTarget to make them removable at runtime. The logger now always add the default "console" target to avoid loosing early init logs. The configuration system now generates a default file configuration if it's missing or too new. General system stability improvements to enhance the user's experience
This commit is contained in:
parent
e5858e2c7d
commit
01a4c80ed5
34 changed files with 1625 additions and 707 deletions
|
@ -1,22 +1,22 @@
|
|||
using DiscordRPC;
|
||||
using Gtk;
|
||||
using JsonPrettyPrinterPlus;
|
||||
using Ryujinx.Audio;
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.Graphics.Gal.OpenGL;
|
||||
using Ryujinx.Graphics.Gal;
|
||||
using Ryujinx.HLE.FileSystem;
|
||||
using Ryujinx.Graphics.Gal.OpenGL;
|
||||
using Ryujinx.Profiler;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using Ryujinx.Configuration;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Utf8Json;
|
||||
using JsonPrettyPrinterPlus;
|
||||
using Utf8Json.Resolvers;
|
||||
using Ryujinx.HLE.FileSystem;
|
||||
|
||||
|
||||
using GUI = Gtk.Builder.ObjectAttribute;
|
||||
|
||||
|
@ -50,12 +50,6 @@ namespace Ryujinx.Ui
|
|||
|
||||
private static TreeView _treeView;
|
||||
|
||||
public static bool DiscordIntegrationEnabled { get; set; }
|
||||
|
||||
public static DiscordRpcClient DiscordClient;
|
||||
|
||||
public static RichPresence DiscordPresence;
|
||||
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable IDE0044
|
||||
[GUI] Window _mainWin;
|
||||
|
@ -91,60 +85,39 @@ namespace Ryujinx.Ui
|
|||
|
||||
_audioOut = InitializeAudioEngine();
|
||||
|
||||
_device = new HLE.Switch(_renderer, _audioOut);
|
||||
// TODO: Initialization and dispose of HLE.Switch when starting/stoping emulation.
|
||||
_device = InitializeSwitchInstance();
|
||||
|
||||
_treeView = _gameTable;
|
||||
|
||||
Configuration.Load(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json"));
|
||||
Configuration.InitialConfigure(_device);
|
||||
|
||||
ApplyTheme();
|
||||
|
||||
if (DiscordIntegrationEnabled)
|
||||
{
|
||||
DiscordClient = new DiscordRpcClient("568815339807309834");
|
||||
DiscordPresence = new RichPresence
|
||||
{
|
||||
Assets = new Assets
|
||||
{
|
||||
LargeImageKey = "ryujinx",
|
||||
LargeImageText = "Ryujinx is an emulator for the Nintendo Switch"
|
||||
},
|
||||
Details = "Main Menu",
|
||||
State = "Idling",
|
||||
Timestamps = new Timestamps(DateTime.UtcNow)
|
||||
};
|
||||
|
||||
DiscordClient.Initialize();
|
||||
DiscordClient.SetPresence(DiscordPresence);
|
||||
}
|
||||
|
||||
_mainWin.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.Icon.png");
|
||||
_stopEmulation.Sensitive = false;
|
||||
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns.FavColumn) { _favToggle.Active = true; }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns.IconColumn) { _iconToggle.Active = true; }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns.AppColumn) { _appToggle.Active = true; }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns.DevColumn) { _developerToggle.Active = true; }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns.VersionColumn) { _versionToggle.Active = true; }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns.TimePlayedColumn) { _timePlayedToggle.Active = true; }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns.LastPlayedColumn) { _lastPlayedToggle.Active = true; }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns.FileExtColumn) { _fileExtToggle.Active = true; }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns.FileSizeColumn) { _fileSizeToggle.Active = true; }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns.PathColumn) { _pathToggle.Active = true; }
|
||||
if (ConfigurationState.Instance.Ui.GuiColumns.FavColumn) _favToggle.Active = true;
|
||||
if (ConfigurationState.Instance.Ui.GuiColumns.IconColumn) _iconToggle.Active = true;
|
||||
if (ConfigurationState.Instance.Ui.GuiColumns.AppColumn) _appToggle.Active = true;
|
||||
if (ConfigurationState.Instance.Ui.GuiColumns.DevColumn) _developerToggle.Active = true;
|
||||
if (ConfigurationState.Instance.Ui.GuiColumns.VersionColumn) _versionToggle.Active = true;
|
||||
if (ConfigurationState.Instance.Ui.GuiColumns.TimePlayedColumn) _timePlayedToggle.Active = true;
|
||||
if (ConfigurationState.Instance.Ui.GuiColumns.LastPlayedColumn) _lastPlayedToggle.Active = true;
|
||||
if (ConfigurationState.Instance.Ui.GuiColumns.FileExtColumn) _fileExtToggle.Active = true;
|
||||
if (ConfigurationState.Instance.Ui.GuiColumns.FileSizeColumn) _fileSizeToggle.Active = true;
|
||||
if (ConfigurationState.Instance.Ui.GuiColumns.PathColumn) _pathToggle.Active = true;
|
||||
|
||||
_gameTable.Model = _tableStore = new ListStore(
|
||||
typeof(bool),
|
||||
typeof(Gdk.Pixbuf),
|
||||
typeof(string),
|
||||
typeof(string),
|
||||
typeof(string),
|
||||
typeof(string),
|
||||
typeof(string),
|
||||
typeof(string),
|
||||
typeof(string),
|
||||
typeof(bool),
|
||||
typeof(Gdk.Pixbuf),
|
||||
typeof(string),
|
||||
typeof(string),
|
||||
typeof(string),
|
||||
typeof(string),
|
||||
typeof(string),
|
||||
typeof(string),
|
||||
typeof(string),
|
||||
typeof(string));
|
||||
|
||||
|
||||
_tableStore.SetSortFunc(5, TimePlayedSort);
|
||||
_tableStore.SetSortFunc(6, LastPlayedSort);
|
||||
_tableStore.SetSortFunc(8, FileSizeSort);
|
||||
|
@ -158,22 +131,22 @@ namespace Ryujinx.Ui
|
|||
|
||||
internal static void ApplyTheme()
|
||||
{
|
||||
if (!SwitchSettings.SwitchConfig.EnableCustomTheme)
|
||||
if (!ConfigurationState.Instance.Ui.EnableCustomTheme)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (File.Exists(SwitchSettings.SwitchConfig.CustomThemePath) && (System.IO.Path.GetExtension(SwitchSettings.SwitchConfig.CustomThemePath) == ".css"))
|
||||
if (File.Exists(ConfigurationState.Instance.Ui.CustomThemePath) && (System.IO.Path.GetExtension(ConfigurationState.Instance.Ui.CustomThemePath) == ".css"))
|
||||
{
|
||||
CssProvider cssProvider = new CssProvider();
|
||||
|
||||
cssProvider.LoadFromPath(SwitchSettings.SwitchConfig.CustomThemePath);
|
||||
cssProvider.LoadFromPath(ConfigurationState.Instance.Ui.CustomThemePath);
|
||||
|
||||
StyleContext.AddProviderForScreen(Gdk.Screen.Default, cssProvider, 800);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.PrintWarning(LogClass.Application, $"The \"custom_theme_path\" section in \"Config.json\" contains an invalid path: \"{SwitchSettings.SwitchConfig.CustomThemePath}\".");
|
||||
Logger.PrintWarning(LogClass.Application, $"The \"custom_theme_path\" section in \"Config.json\" contains an invalid path: \"{ConfigurationState.Instance.Ui.CustomThemePath}\".");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,39 +160,48 @@ namespace Ryujinx.Ui
|
|||
CellRendererToggle favToggle = new CellRendererToggle();
|
||||
favToggle.Toggled += FavToggle_Toggled;
|
||||
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns.FavColumn) { _gameTable.AppendColumn("Fav", favToggle, "active", 0); }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns.IconColumn) { _gameTable.AppendColumn("Icon", new CellRendererPixbuf(), "pixbuf", 1); }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns.AppColumn) { _gameTable.AppendColumn("Application", new CellRendererText(), "text", 2); }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns.DevColumn) { _gameTable.AppendColumn("Developer", new CellRendererText(), "text", 3); }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns.VersionColumn) { _gameTable.AppendColumn("Version", new CellRendererText(), "text", 4); }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns.TimePlayedColumn) { _gameTable.AppendColumn("Time Played", new CellRendererText(), "text", 5); }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns.LastPlayedColumn) { _gameTable.AppendColumn("Last Played", new CellRendererText(), "text", 6); }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns.FileExtColumn) { _gameTable.AppendColumn("File Ext", new CellRendererText(), "text", 7); }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns.FileSizeColumn) { _gameTable.AppendColumn("File Size", new CellRendererText(), "text", 8); }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns.PathColumn) { _gameTable.AppendColumn("Path", new CellRendererText(), "text", 9); }
|
||||
if (ConfigurationState.Instance.Ui.GuiColumns.FavColumn) _gameTable.AppendColumn("Fav", favToggle, "active", 0);
|
||||
if (ConfigurationState.Instance.Ui.GuiColumns.IconColumn) _gameTable.AppendColumn("Icon", new CellRendererPixbuf(), "pixbuf", 1);
|
||||
if (ConfigurationState.Instance.Ui.GuiColumns.AppColumn) _gameTable.AppendColumn("Application", new CellRendererText(), "text", 2);
|
||||
if (ConfigurationState.Instance.Ui.GuiColumns.DevColumn) _gameTable.AppendColumn("Developer", new CellRendererText(), "text", 3);
|
||||
if (ConfigurationState.Instance.Ui.GuiColumns.VersionColumn) _gameTable.AppendColumn("Version", new CellRendererText(), "text", 4);
|
||||
if (ConfigurationState.Instance.Ui.GuiColumns.TimePlayedColumn) _gameTable.AppendColumn("Time Played", new CellRendererText(), "text", 5);
|
||||
if (ConfigurationState.Instance.Ui.GuiColumns.LastPlayedColumn) _gameTable.AppendColumn("Last Played", new CellRendererText(), "text", 6);
|
||||
if (ConfigurationState.Instance.Ui.GuiColumns.FileExtColumn) _gameTable.AppendColumn("File Ext", new CellRendererText(), "text", 7);
|
||||
if (ConfigurationState.Instance.Ui.GuiColumns.FileSizeColumn) _gameTable.AppendColumn("File Size", new CellRendererText(), "text", 8);
|
||||
if (ConfigurationState.Instance.Ui.GuiColumns.PathColumn) _gameTable.AppendColumn("Path", new CellRendererText(), "text", 9);
|
||||
|
||||
foreach (TreeViewColumn column in _gameTable.Columns)
|
||||
{
|
||||
if (column.Title == "Fav") { _favColumn = column; }
|
||||
else if (column.Title == "Application") { _appColumn = column; }
|
||||
else if (column.Title == "Developer") { _devColumn = column; }
|
||||
else if (column.Title == "Version") { _versionColumn = column; }
|
||||
else if (column.Title == "Time Played") { _timePlayedColumn = column; }
|
||||
else if (column.Title == "Last Played") { _lastPlayedColumn = column; }
|
||||
else if (column.Title == "File Ext") { _fileExtColumn = column; }
|
||||
else if (column.Title == "File Size") { _fileSizeColumn = column; }
|
||||
else if (column.Title == "Path") { _pathColumn = column; }
|
||||
if (column.Title == "Fav") _favColumn = column;
|
||||
else if (column.Title == "Application") _appColumn = column;
|
||||
else if (column.Title == "Developer") _devColumn = column;
|
||||
else if (column.Title == "Version") _versionColumn = column;
|
||||
else if (column.Title == "Time Played") _timePlayedColumn = column;
|
||||
else if (column.Title == "Last Played") _lastPlayedColumn = column;
|
||||
else if (column.Title == "File Ext") _fileExtColumn = column;
|
||||
else if (column.Title == "File Size") _fileSizeColumn = column;
|
||||
else if (column.Title == "Path") _pathColumn = column;
|
||||
}
|
||||
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns.FavColumn) { _favColumn.SortColumnId = 0; }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns.IconColumn) { _appColumn.SortColumnId = 2; }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns.AppColumn) { _devColumn.SortColumnId = 3; }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns.DevColumn) { _versionColumn.SortColumnId = 4; }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns.TimePlayedColumn) { _timePlayedColumn.SortColumnId = 5; }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns.LastPlayedColumn) { _lastPlayedColumn.SortColumnId = 6; }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns.FileExtColumn) { _fileExtColumn.SortColumnId = 7; }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns.FileSizeColumn) { _fileSizeColumn.SortColumnId = 8; }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns.PathColumn) { _pathColumn.SortColumnId = 9; }
|
||||
if (ConfigurationState.Instance.Ui.GuiColumns.FavColumn) _favColumn.SortColumnId = 0;
|
||||
if (ConfigurationState.Instance.Ui.GuiColumns.AppColumn) _appColumn.SortColumnId = 2;
|
||||
if (ConfigurationState.Instance.Ui.GuiColumns.DevColumn) _devColumn.SortColumnId = 3;
|
||||
if (ConfigurationState.Instance.Ui.GuiColumns.VersionColumn) _versionColumn.SortColumnId = 4;
|
||||
if (ConfigurationState.Instance.Ui.GuiColumns.TimePlayedColumn) _timePlayedColumn.SortColumnId = 5;
|
||||
if (ConfigurationState.Instance.Ui.GuiColumns.LastPlayedColumn) _lastPlayedColumn.SortColumnId = 6;
|
||||
if (ConfigurationState.Instance.Ui.GuiColumns.FileExtColumn) _fileExtColumn.SortColumnId = 7;
|
||||
if (ConfigurationState.Instance.Ui.GuiColumns.FileSizeColumn) _fileSizeColumn.SortColumnId = 8;
|
||||
if (ConfigurationState.Instance.Ui.GuiColumns.PathColumn) _pathColumn.SortColumnId = 9;
|
||||
}
|
||||
|
||||
private HLE.Switch InitializeSwitchInstance()
|
||||
{
|
||||
HLE.Switch instance = new HLE.Switch(_renderer, _audioOut);
|
||||
|
||||
instance.Initialize();
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
internal static async Task UpdateGameTable()
|
||||
|
@ -233,7 +215,7 @@ namespace Ryujinx.Ui
|
|||
|
||||
_tableStore.Clear();
|
||||
|
||||
await Task.Run(() => ApplicationLibrary.LoadApplications(SwitchSettings.SwitchConfig.GameDirs, _device.System.KeySet, _device.System.State.DesiredTitleLanguage));
|
||||
await Task.Run(() => ApplicationLibrary.LoadApplications(ConfigurationState.Instance.Ui.GameDirs, _device.System.KeySet, _device.System.State.DesiredTitleLanguage));
|
||||
|
||||
_updatingGameTable = false;
|
||||
}
|
||||
|
@ -248,6 +230,9 @@ namespace Ryujinx.Ui
|
|||
{
|
||||
Logger.RestartTime();
|
||||
|
||||
// TODO: Move this somewhere else + reloadable?
|
||||
GraphicsConfig.ShadersDumpPath = ConfigurationState.Instance.Graphics.ShadersDumpPath;
|
||||
|
||||
if (Directory.Exists(path))
|
||||
{
|
||||
string[] romFsFiles = Directory.GetFiles(path, "*.istorage");
|
||||
|
@ -313,40 +298,7 @@ namespace Ryujinx.Ui
|
|||
_gameLoaded = true;
|
||||
_stopEmulation.Sensitive = true;
|
||||
|
||||
if (DiscordIntegrationEnabled)
|
||||
{
|
||||
if (File.ReadAllLines(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "RPsupported.dat")).Contains(_device.System.TitleId))
|
||||
{
|
||||
DiscordPresence.Assets.LargeImageKey = _device.System.TitleId;
|
||||
}
|
||||
|
||||
string state = _device.System.TitleId;
|
||||
|
||||
if (state == null)
|
||||
{
|
||||
state = "Ryujinx";
|
||||
}
|
||||
else
|
||||
{
|
||||
state = state.ToUpper();
|
||||
}
|
||||
|
||||
string details = "Idling";
|
||||
|
||||
if (_device.System.TitleName != null)
|
||||
{
|
||||
details = $"Playing {_device.System.TitleName}";
|
||||
}
|
||||
|
||||
DiscordPresence.Details = details;
|
||||
DiscordPresence.State = state;
|
||||
DiscordPresence.Assets.LargeImageText = _device.System.TitleName;
|
||||
DiscordPresence.Assets.SmallImageKey = "ryujinx";
|
||||
DiscordPresence.Assets.SmallImageText = "Ryujinx is an emulator for the Nintendo Switch";
|
||||
DiscordPresence.Timestamps = new Timestamps(DateTime.UtcNow);
|
||||
|
||||
DiscordClient.SetPresence(DiscordPresence);
|
||||
}
|
||||
DiscordIntegrationModule.SwitchToPlayingState(_device.System.TitleId, _device.System.TitleName);
|
||||
|
||||
string metadataFolder = System.IO.Path.Combine(new VirtualFileSystem().GetBasePath(), "games", _device.System.TitleId, "gui");
|
||||
string metadataFile = System.IO.Path.Combine(metadataFolder, "metadata.json");
|
||||
|
@ -384,8 +336,8 @@ namespace Ryujinx.Ui
|
|||
|
||||
private static void CreateGameWindow()
|
||||
{
|
||||
Configuration.ConfigureHid(_device, SwitchSettings.SwitchConfig);
|
||||
|
||||
_device.Hid.InitializePrimaryController(ConfigurationState.Instance.Hid.ControllerType);
|
||||
|
||||
using (_screen = new GlScreen(_device, _renderer))
|
||||
{
|
||||
_screen.MainLoop();
|
||||
|
@ -444,7 +396,6 @@ namespace Ryujinx.Ui
|
|||
Profile.FinishProfiling();
|
||||
_device.Dispose();
|
||||
_audioOut.Dispose();
|
||||
DiscordClient?.Dispose();
|
||||
Logger.Shutdown();
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
@ -607,7 +558,7 @@ namespace Ryujinx.Ui
|
|||
|
||||
private void Settings_Pressed(object sender, EventArgs args)
|
||||
{
|
||||
SwitchSettings settingsWin = new SwitchSettings(_device);
|
||||
SwitchSettings settingsWin = new SwitchSettings();
|
||||
settingsWin.Show();
|
||||
}
|
||||
|
||||
|
@ -633,121 +584,81 @@ namespace Ryujinx.Ui
|
|||
|
||||
private void Fav_Toggled(object sender, EventArgs args)
|
||||
{
|
||||
GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns;
|
||||
|
||||
updatedColumns.FavColumn = _favToggle.Active;
|
||||
SwitchSettings.SwitchConfig.GuiColumns = updatedColumns;
|
||||
|
||||
Configuration.SaveConfig(SwitchSettings.SwitchConfig, System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json"));
|
||||
ConfigurationState.Instance.Ui.GuiColumns.FavColumn.Value = _favToggle.Active;
|
||||
|
||||
SaveConfig();
|
||||
UpdateColumns();
|
||||
}
|
||||
|
||||
private void Icon_Toggled(object sender, EventArgs args)
|
||||
{
|
||||
GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns;
|
||||
|
||||
updatedColumns.IconColumn = _iconToggle.Active;
|
||||
SwitchSettings.SwitchConfig.GuiColumns = updatedColumns;
|
||||
|
||||
Configuration.SaveConfig(SwitchSettings.SwitchConfig, System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json"));
|
||||
ConfigurationState.Instance.Ui.GuiColumns.IconColumn.Value = _iconToggle.Active;
|
||||
|
||||
SaveConfig();
|
||||
UpdateColumns();
|
||||
}
|
||||
|
||||
private void Title_Toggled(object sender, EventArgs args)
|
||||
{
|
||||
GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns;
|
||||
|
||||
updatedColumns.AppColumn = _appToggle.Active;
|
||||
SwitchSettings.SwitchConfig.GuiColumns = updatedColumns;
|
||||
|
||||
Configuration.SaveConfig(SwitchSettings.SwitchConfig, System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json"));
|
||||
ConfigurationState.Instance.Ui.GuiColumns.AppColumn.Value = _appToggle.Active;
|
||||
|
||||
SaveConfig();
|
||||
UpdateColumns();
|
||||
}
|
||||
|
||||
private void Developer_Toggled(object sender, EventArgs args)
|
||||
{
|
||||
GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns;
|
||||
|
||||
updatedColumns.DevColumn = _developerToggle.Active;
|
||||
SwitchSettings.SwitchConfig.GuiColumns = updatedColumns;
|
||||
|
||||
Configuration.SaveConfig(SwitchSettings.SwitchConfig, System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json"));
|
||||
ConfigurationState.Instance.Ui.GuiColumns.DevColumn.Value = _developerToggle.Active;
|
||||
|
||||
SaveConfig();
|
||||
UpdateColumns();
|
||||
}
|
||||
|
||||
private void Version_Toggled(object sender, EventArgs args)
|
||||
{
|
||||
GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns;
|
||||
|
||||
updatedColumns.VersionColumn = _versionToggle.Active;
|
||||
SwitchSettings.SwitchConfig.GuiColumns = updatedColumns;
|
||||
|
||||
Configuration.SaveConfig(SwitchSettings.SwitchConfig, System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json"));
|
||||
ConfigurationState.Instance.Ui.GuiColumns.VersionColumn.Value = _versionToggle.Active;
|
||||
|
||||
SaveConfig();
|
||||
UpdateColumns();
|
||||
}
|
||||
|
||||
private void TimePlayed_Toggled(object sender, EventArgs args)
|
||||
{
|
||||
GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns;
|
||||
|
||||
updatedColumns.TimePlayedColumn = _timePlayedToggle.Active;
|
||||
SwitchSettings.SwitchConfig.GuiColumns = updatedColumns;
|
||||
|
||||
Configuration.SaveConfig(SwitchSettings.SwitchConfig, System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json"));
|
||||
ConfigurationState.Instance.Ui.GuiColumns.TimePlayedColumn.Value = _timePlayedToggle.Active;
|
||||
|
||||
SaveConfig();
|
||||
UpdateColumns();
|
||||
}
|
||||
|
||||
private void LastPlayed_Toggled(object sender, EventArgs args)
|
||||
{
|
||||
GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns;
|
||||
|
||||
updatedColumns.LastPlayedColumn = _lastPlayedToggle.Active;
|
||||
SwitchSettings.SwitchConfig.GuiColumns = updatedColumns;
|
||||
|
||||
Configuration.SaveConfig(SwitchSettings.SwitchConfig, System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json"));
|
||||
ConfigurationState.Instance.Ui.GuiColumns.LastPlayedColumn.Value = _lastPlayedToggle.Active;
|
||||
|
||||
SaveConfig();
|
||||
UpdateColumns();
|
||||
}
|
||||
|
||||
private void FileExt_Toggled(object sender, EventArgs args)
|
||||
{
|
||||
GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns;
|
||||
|
||||
updatedColumns.FileExtColumn = _fileExtToggle.Active;
|
||||
SwitchSettings.SwitchConfig.GuiColumns = updatedColumns;
|
||||
|
||||
Configuration.SaveConfig(SwitchSettings.SwitchConfig, System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json"));
|
||||
ConfigurationState.Instance.Ui.GuiColumns.FileExtColumn.Value = _fileExtToggle.Active;
|
||||
|
||||
SaveConfig();
|
||||
UpdateColumns();
|
||||
}
|
||||
|
||||
private void FileSize_Toggled(object sender, EventArgs args)
|
||||
{
|
||||
GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns;
|
||||
|
||||
updatedColumns.FileSizeColumn = _fileSizeToggle.Active;
|
||||
SwitchSettings.SwitchConfig.GuiColumns = updatedColumns;
|
||||
|
||||
Configuration.SaveConfig(SwitchSettings.SwitchConfig, System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json"));
|
||||
ConfigurationState.Instance.Ui.GuiColumns.FileSizeColumn.Value = _fileSizeToggle.Active;
|
||||
|
||||
SaveConfig();
|
||||
UpdateColumns();
|
||||
}
|
||||
|
||||
private void Path_Toggled(object sender, EventArgs args)
|
||||
{
|
||||
GuiColumns updatedColumns = SwitchSettings.SwitchConfig.GuiColumns;
|
||||
|
||||
updatedColumns.PathColumn = _pathToggle.Active;
|
||||
SwitchSettings.SwitchConfig.GuiColumns = updatedColumns;
|
||||
|
||||
Configuration.SaveConfig(SwitchSettings.SwitchConfig, System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json"));
|
||||
ConfigurationState.Instance.Ui.GuiColumns.PathColumn.Value = _pathToggle.Active;
|
||||
|
||||
SaveConfig();
|
||||
UpdateColumns();
|
||||
}
|
||||
|
||||
|
@ -865,5 +776,10 @@ namespace Ryujinx.Ui
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static void SaveConfig()
|
||||
{
|
||||
ConfigurationState.Instance.ToFileFormat().SaveConfig(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue