From 4ef17f66c42d028677c19245abef9c4d22d45891 Mon Sep 17 00:00:00 2001 From: Thog Date: Thu, 12 Dec 2019 01:35:24 +0100 Subject: [PATCH] Address last issues --- .../Configuration/ConfigurationState.cs | 14 +++---- .../Configuration/Hid/ControllerInputId.cs | 2 +- .../Configuration/Hid/ControllerType.cs | 2 +- Ryujinx.Common/Logging/Logger.cs | 2 +- .../Logging/Targets/AsyncLogTargetWrapper.cs | 2 +- .../Logging/Targets/ConsoleLogTarget.cs | 2 +- .../Logging/Targets/FileLogTarget.cs | 2 +- Ryujinx.Common/Logging/Targets/ILogTarget.cs | 2 +- .../Logging/Targets/JsonLogTarget.cs | 2 +- Ryujinx.Common/ReactiveObject.cs | 8 ++-- Ryujinx.HLE/Switch.cs | 2 +- .../Configuration/DiscordIntegrationModule.cs | 6 ++- Ryujinx/Program.cs | 2 +- Ryujinx/Ui/MainWindow.cs | 41 +++++++++---------- Ryujinx/Ui/SwitchSettings.cs | 4 -- 15 files changed, 45 insertions(+), 48 deletions(-) diff --git a/Ryujinx.Common/Configuration/ConfigurationState.cs b/Ryujinx.Common/Configuration/ConfigurationState.cs index 0ce9ba1e3b..050b497385 100644 --- a/Ryujinx.Common/Configuration/ConfigurationState.cs +++ b/Ryujinx.Common/Configuration/ConfigurationState.cs @@ -311,13 +311,13 @@ namespace Ryujinx.Configuration ControllerType = Hid.ControllerType, 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, + 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, diff --git a/Ryujinx.Common/Configuration/Hid/ControllerInputId.cs b/Ryujinx.Common/Configuration/Hid/ControllerInputId.cs index 3cb5d9f6d5..8969b6a4b8 100644 --- a/Ryujinx.Common/Configuration/Hid/ControllerInputId.cs +++ b/Ryujinx.Common/Configuration/Hid/ControllerInputId.cs @@ -40,6 +40,6 @@ Hat2Up, Hat2Down, Hat2Left, - Hat2Right, + Hat2Right } } diff --git a/Ryujinx.Common/Configuration/Hid/ControllerType.cs b/Ryujinx.Common/Configuration/Hid/ControllerType.cs index 4bbb04c7b0..b0613b2d66 100644 --- a/Ryujinx.Common/Configuration/Hid/ControllerType.cs +++ b/Ryujinx.Common/Configuration/Hid/ControllerType.cs @@ -6,6 +6,6 @@ Handheld, NpadPair, NpadLeft, - NpadRight, + NpadRight } } diff --git a/Ryujinx.Common/Logging/Logger.cs b/Ryujinx.Common/Logging/Logger.cs index 15995b0e1e..83af97b122 100644 --- a/Ryujinx.Common/Logging/Logger.cs +++ b/Ryujinx.Common/Logging/Logger.cs @@ -38,7 +38,7 @@ namespace Ryujinx.Common.Logging m_Time = Stopwatch.StartNew(); - // logger should log to console by default + // Logger should log to console by default AddTarget(new AsyncLogTargetWrapper( new ConsoleLogTarget("console"), 1000, diff --git a/Ryujinx.Common/Logging/Targets/AsyncLogTargetWrapper.cs b/Ryujinx.Common/Logging/Targets/AsyncLogTargetWrapper.cs index cab3f8c18e..c946b67880 100644 --- a/Ryujinx.Common/Logging/Targets/AsyncLogTargetWrapper.cs +++ b/Ryujinx.Common/Logging/Targets/AsyncLogTargetWrapper.cs @@ -27,7 +27,7 @@ namespace Ryujinx.Common.Logging private readonly int _overflowTimeout; - string ILogTarget.Name { get => _target.Name; set => throw new NotImplementedException(); } + string ILogTarget.Name { get => _target.Name; } public AsyncLogTargetWrapper(ILogTarget target) : this(target, -1, AsyncLogTargetOverflowAction.Block) diff --git a/Ryujinx.Common/Logging/Targets/ConsoleLogTarget.cs b/Ryujinx.Common/Logging/Targets/ConsoleLogTarget.cs index 9c669ccea7..ff5c6f5acb 100644 --- a/Ryujinx.Common/Logging/Targets/ConsoleLogTarget.cs +++ b/Ryujinx.Common/Logging/Targets/ConsoleLogTarget.cs @@ -11,7 +11,7 @@ namespace Ryujinx.Common.Logging private readonly string _name; - string ILogTarget.Name { get => _name; set => throw new NotImplementedException(); } + string ILogTarget.Name { get => _name; } static ConsoleLogTarget() { diff --git a/Ryujinx.Common/Logging/Targets/FileLogTarget.cs b/Ryujinx.Common/Logging/Targets/FileLogTarget.cs index 3a3d2e19b1..4db5f7bce5 100644 --- a/Ryujinx.Common/Logging/Targets/FileLogTarget.cs +++ b/Ryujinx.Common/Logging/Targets/FileLogTarget.cs @@ -12,7 +12,7 @@ namespace Ryujinx.Common.Logging private readonly ILogFormatter _formatter; private readonly string _name; - string ILogTarget.Name { get => _name; set => throw new NotImplementedException(); } + string ILogTarget.Name { get => _name; } public FileLogTarget(string path, string name) : this(path, name, FileShare.Read, FileMode.Append) diff --git a/Ryujinx.Common/Logging/Targets/ILogTarget.cs b/Ryujinx.Common/Logging/Targets/ILogTarget.cs index 2f9a77f2ab..d4d26a936d 100644 --- a/Ryujinx.Common/Logging/Targets/ILogTarget.cs +++ b/Ryujinx.Common/Logging/Targets/ILogTarget.cs @@ -6,6 +6,6 @@ namespace Ryujinx.Common.Logging { void Log(object sender, LogEventArgs args); - string Name { get; protected set; } + string Name { get; } } } diff --git a/Ryujinx.Common/Logging/Targets/JsonLogTarget.cs b/Ryujinx.Common/Logging/Targets/JsonLogTarget.cs index 3d88a0a6dd..3729b18d13 100644 --- a/Ryujinx.Common/Logging/Targets/JsonLogTarget.cs +++ b/Ryujinx.Common/Logging/Targets/JsonLogTarget.cs @@ -10,7 +10,7 @@ namespace Ryujinx.Common.Logging private bool _leaveOpen; private string _name; - string ILogTarget.Name { get => _name; set => throw new NotImplementedException(); } + string ILogTarget.Name { get => _name; } public JsonLogTarget(Stream stream, string name) { diff --git a/Ryujinx.Common/ReactiveObject.cs b/Ryujinx.Common/ReactiveObject.cs index 8a22ac3627..be30e9b2c5 100644 --- a/Ryujinx.Common/ReactiveObject.cs +++ b/Ryujinx.Common/ReactiveObject.cs @@ -14,7 +14,7 @@ namespace Ryujinx.Common { get { - _readerWriterLock.AcquireReaderLock(int.MaxValue); + _readerWriterLock.AcquireReaderLock(Timeout.Infinite); T value = _value; _readerWriterLock.ReleaseReaderLock(); @@ -22,7 +22,7 @@ namespace Ryujinx.Common } set { - _readerWriterLock.AcquireWriterLock(int.MaxValue); + _readerWriterLock.AcquireWriterLock(Timeout.Infinite); T oldValue = _value; @@ -45,8 +45,8 @@ namespace Ryujinx.Common public class ReactiveEventArgs { - public T OldValue { get; private set; } - public T NewValue { get; private set; } + public T OldValue { get; } + public T NewValue { get; } public ReactiveEventArgs(T oldValue, T newValue) { diff --git a/Ryujinx.HLE/Switch.cs b/Ryujinx.HLE/Switch.cs index 45b06bc649..a4d07f6ac1 100644 --- a/Ryujinx.HLE/Switch.cs +++ b/Ryujinx.HLE/Switch.cs @@ -70,7 +70,7 @@ namespace Ryujinx.HLE EnableDeviceVsync = ConfigurationState.Instance.Graphics.EnableVsync; - // TODO: Make this relodable and implement Docking/UnDocking logic. + // TODO: Make this reloadable and implement Docking/Undocking logic. System.State.DockedMode = ConfigurationState.Instance.System.EnableDockedMode; if (ConfigurationState.Instance.System.EnableMulticoreScheduling) diff --git a/Ryujinx/Configuration/DiscordIntegrationModule.cs b/Ryujinx/Configuration/DiscordIntegrationModule.cs index 6ca8b44404..5eb9c1f77d 100644 --- a/Ryujinx/Configuration/DiscordIntegrationModule.cs +++ b/Ryujinx/Configuration/DiscordIntegrationModule.cs @@ -10,6 +10,8 @@ namespace Ryujinx.Configuration { private static DiscordRpcClient DiscordClient; + private static string LARGE_DESCRIPTION = "Ryujinx is a Nintendo Switch emulator."; + public static RichPresence DiscordPresence { get; private set; } public static void Initialize() @@ -19,7 +21,7 @@ namespace Ryujinx.Configuration Assets = new Assets { LargeImageKey = "ryujinx", - LargeImageText = "Ryujinx is an emulator for the Nintendo Switch" + LargeImageText = LARGE_DESCRIPTION }, Details = "Main Menu", State = "Idling", @@ -81,7 +83,7 @@ namespace Ryujinx.Configuration DiscordPresence.State = state; DiscordPresence.Assets.LargeImageText = titleName; DiscordPresence.Assets.SmallImageKey = "ryujinx"; - DiscordPresence.Assets.SmallImageText = "Ryujinx is a Nintendo Switch emulator"; + DiscordPresence.Assets.SmallImageText = LARGE_DESCRIPTION; DiscordPresence.Timestamps = new Timestamps(DateTime.UtcNow); DiscordClient?.SetPresence(DiscordPresence); diff --git a/Ryujinx/Program.cs b/Ryujinx/Program.cs index e292a4a7f3..98b8d692d6 100644 --- a/Ryujinx/Program.cs +++ b/Ryujinx/Program.cs @@ -30,7 +30,7 @@ namespace Ryujinx string configurationPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json"); - // Now load the configuration as the other subsystem are now registered + // Now load the configuration as the other subsystems are now registered if (File.Exists(configurationPath)) { ConfigurationFileFormat configurationFileFormat = ConfigurationFileFormat.Load(configurationPath); diff --git a/Ryujinx/Ui/MainWindow.cs b/Ryujinx/Ui/MainWindow.cs index c28846f85e..e0bd849479 100644 --- a/Ryujinx/Ui/MainWindow.cs +++ b/Ryujinx/Ui/MainWindow.cs @@ -160,28 +160,28 @@ namespace Ryujinx.Ui CellRendererToggle favToggle = new CellRendererToggle(); favToggle.Toggled += FavToggle_Toggled; - 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); } + 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 (ConfigurationState.Instance.Ui.GuiColumns.FavColumn) _favColumn.SortColumnId = 0; @@ -230,7 +230,7 @@ namespace Ryujinx.Ui { Logger.RestartTime(); - // TODO: move this somewhere else + reloadable? + // TODO: Move this somewhere else + reloadable? GraphicsConfig.ShadersDumpPath = ConfigurationState.Instance.Graphics.ShadersDumpPath; if (Directory.Exists(path)) @@ -346,7 +346,6 @@ namespace Ryujinx.Ui } } - private static void End() { if (_ending) diff --git a/Ryujinx/Ui/SwitchSettings.cs b/Ryujinx/Ui/SwitchSettings.cs index 5e2f642ee4..5c56cf7ea1 100644 --- a/Ryujinx/Ui/SwitchSettings.cs +++ b/Ryujinx/Ui/SwitchSettings.cs @@ -1,14 +1,10 @@ using Gtk; -using Ryujinx.HLE.HOS.SystemState; -using Ryujinx.HLE.Input; -using Ryujinx.Ui.Input; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; using Ryujinx.Configuration; -using Ryujinx.Common.Logging; using Ryujinx.Configuration.System; using Ryujinx.Configuration.Hid;