diff --git a/Ryujinx/Configuration.cs b/Ryujinx/Configuration.cs
index 4a30476d72..c259f9e9d4 100644
--- a/Ryujinx/Configuration.cs
+++ b/Ryujinx/Configuration.cs
@@ -7,8 +7,8 @@ using Ryujinx.HLE;
using Ryujinx.HLE.HOS.SystemState;
using Ryujinx.HLE.HOS.Services;
using Ryujinx.HLE.Input;
-using Ryujinx.UI;
-using Ryujinx.UI.Input;
+using Ryujinx.Ui;
+using Ryujinx.Ui.Input;
using System;
using System.Collections.Generic;
using System.IO;
@@ -154,7 +154,7 @@ namespace Ryujinx
///
/// Controller control bindings
///
- public UI.Input.NpadController JoystickControls { get; private set; }
+ public Ui.Input.NpadController JoystickControls { get; private set; }
///
/// Loads a configuration file from disk
diff --git a/Ryujinx/Program.cs b/Ryujinx/Program.cs
index 50019f3410..96e9e8dec2 100644
--- a/Ryujinx/Program.cs
+++ b/Ryujinx/Program.cs
@@ -1,7 +1,7 @@
using Gtk;
using Ryujinx.Common.Logging;
using Ryujinx.Profiler;
-using Ryujinx.UI;
+using Ryujinx.Ui;
using System;
using System.IO;
@@ -28,7 +28,7 @@ namespace Ryujinx
string userProfilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".switch", "prod.keys");
if (!File.Exists(appDataPath) && !File.Exists(userProfilePath))
{
- MainWindow.CreateErrorDialog($"Key file was not found. Please refer to `KEYS.md` for more info");
+ GtkDialog.CreateErrorDialog($"Key file was not found. Please refer to `KEYS.md` for more info");
}
MainWindow mainWindow = new MainWindow();
diff --git a/Ryujinx/Ui/AboutInfo.cs b/Ryujinx/Ui/AboutInfo.cs
index ec8dd8471f..01e0d81b57 100644
--- a/Ryujinx/Ui/AboutInfo.cs
+++ b/Ryujinx/Ui/AboutInfo.cs
@@ -1,6 +1,6 @@
-namespace Ryujinx.UI
+namespace Ryujinx.Ui
{
- public struct AboutInfo
+ internal struct AboutInfo
{
public string InstallVersion;
public string InstallCommit;
diff --git a/Ryujinx/Ui/AboutWindow.cs b/Ryujinx/Ui/AboutWindow.cs
index ac2eb16783..b95342437b 100644
--- a/Ryujinx/Ui/AboutWindow.cs
+++ b/Ryujinx/Ui/AboutWindow.cs
@@ -9,7 +9,7 @@ using Utf8Json.Resolvers;
using GUI = Gtk.Builder.ObjectAttribute;
-namespace Ryujinx.UI
+namespace Ryujinx.Ui
{
public class AboutWindow : Window
{
diff --git a/Ryujinx/Ui/ApplicationAddedEventArgs.cs b/Ryujinx/Ui/ApplicationAddedEventArgs.cs
index 3a8e7d18aa..85a2f5a182 100644
--- a/Ryujinx/Ui/ApplicationAddedEventArgs.cs
+++ b/Ryujinx/Ui/ApplicationAddedEventArgs.cs
@@ -1,6 +1,6 @@
using System;
-namespace Ryujinx.UI
+namespace Ryujinx.Ui
{
public class ApplicationAddedEventArgs : EventArgs
{
diff --git a/Ryujinx/Ui/ApplicationData.cs b/Ryujinx/Ui/ApplicationData.cs
index 8950d09d3d..f43099c1c1 100644
--- a/Ryujinx/Ui/ApplicationData.cs
+++ b/Ryujinx/Ui/ApplicationData.cs
@@ -1,4 +1,4 @@
-namespace Ryujinx.UI
+namespace Ryujinx.Ui
{
public struct ApplicationData
{
diff --git a/Ryujinx/Ui/ApplicationLibrary.cs b/Ryujinx/Ui/ApplicationLibrary.cs
index e81c77e2d4..fecbf27b40 100644
--- a/Ryujinx/Ui/ApplicationLibrary.cs
+++ b/Ryujinx/Ui/ApplicationLibrary.cs
@@ -18,7 +18,7 @@ using Utf8Json.Resolvers;
using TitleLanguage = Ryujinx.HLE.HOS.SystemState.TitleLanguage;
-namespace Ryujinx.UI
+namespace Ryujinx.Ui
{
public class ApplicationLibrary
{
@@ -286,7 +286,7 @@ namespace Ryujinx.UI
applicationIcon = Read(assetOffset + iconOffset, (int)iconSize);
// Creates memory stream out of byte array which is the NACP
- using (MemoryStream stream = new MemoryStream(Read(assetOffset + (int) nacpOffset, (int) nacpSize)))
+ using (MemoryStream stream = new MemoryStream(Read(assetOffset + (int)nacpOffset, (int)nacpSize)))
{
// Creates NACP class from the memory stream
Nacp controlData = new Nacp(stream);
diff --git a/Ryujinx/Ui/ApplicationMetadata.cs b/Ryujinx/Ui/ApplicationMetadata.cs
index f0264c7096..adc2b9df97 100644
--- a/Ryujinx/Ui/ApplicationMetadata.cs
+++ b/Ryujinx/Ui/ApplicationMetadata.cs
@@ -1,6 +1,6 @@
-namespace Ryujinx.UI
+namespace Ryujinx.Ui
{
- public struct ApplicationMetadata
+ internal struct ApplicationMetadata
{
public bool Favorite { get; set; }
public double TimePlayed { get; set; }
diff --git a/Ryujinx/Ui/GLScreen.cs b/Ryujinx/Ui/GLScreen.cs
index eb7b2d66e6..c23a369294 100644
--- a/Ryujinx/Ui/GLScreen.cs
+++ b/Ryujinx/Ui/GLScreen.cs
@@ -10,7 +10,7 @@ using System.Threading;
using Stopwatch = System.Diagnostics.Stopwatch;
-namespace Ryujinx.UI
+namespace Ryujinx.Ui
{
public class GlScreen : GameWindow
{
diff --git a/Ryujinx/Ui/GtkDialog.cs b/Ryujinx/Ui/GtkDialog.cs
new file mode 100644
index 0000000000..7f6be8dc7a
--- /dev/null
+++ b/Ryujinx/Ui/GtkDialog.cs
@@ -0,0 +1,23 @@
+using Gtk;
+using System.Reflection;
+
+namespace Ryujinx.Ui
+{
+ internal class GtkDialog
+ {
+ internal static void CreateErrorDialog(string errorMessage)
+ {
+ MessageDialog errorDialog = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, null)
+ {
+ Title = "Ryujinx - Error",
+ Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.Icon.png"),
+ Text = "Ryujinx has encountered an error",
+ SecondaryText = errorMessage,
+ WindowPosition = WindowPosition.Center
+ };
+ errorDialog.SetSizeRequest(100, 20);
+ errorDialog.Run();
+ errorDialog.Dispose();
+ }
+ }
+}
diff --git a/Ryujinx/Ui/GuiColumns.cs b/Ryujinx/Ui/GuiColumns.cs
index 6957c68132..b86a273ea8 100644
--- a/Ryujinx/Ui/GuiColumns.cs
+++ b/Ryujinx/Ui/GuiColumns.cs
@@ -1,4 +1,4 @@
-namespace Ryujinx.UI
+namespace Ryujinx.Ui
{
public struct GuiColumns
{
diff --git a/Ryujinx/Ui/MainWindow.cs b/Ryujinx/Ui/MainWindow.cs
index 184d29e8b2..a24f3ed050 100644
--- a/Ryujinx/Ui/MainWindow.cs
+++ b/Ryujinx/Ui/MainWindow.cs
@@ -20,7 +20,7 @@ using Utf8Json.Resolvers;
using GUI = Gtk.Builder.ObjectAttribute;
-namespace Ryujinx.UI
+namespace Ryujinx.Ui
{
public class MainWindow : Window
{
@@ -133,7 +133,17 @@ namespace Ryujinx.UI
if (SwitchSettings.SwitchConfig.GuiColumns.FileSizeColumn) { _fileSizeToggle.Active = true; }
if (SwitchSettings.SwitchConfig.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(string));
+ _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(string));
_tableStore.SetSortFunc(5, TimePlayedSort);
_tableStore.SetSortFunc(6, LastPlayedSort);
@@ -146,21 +156,6 @@ namespace Ryujinx.UI
#pragma warning restore CS4014
}
- internal static void CreateErrorDialog(string errorMessage)
- {
- MessageDialog errorDialog = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, null)
- {
- Title = "Ryujinx - Error",
- Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.Icon.png"),
- Text = "Ryujinx has encountered an Error",
- SecondaryText = errorMessage,
- WindowPosition = WindowPosition.Center
- };
- errorDialog.SetSizeRequest(100, 20);
- errorDialog.Run();
- errorDialog.Dispose();
- }
-
internal static void ApplyTheme()
{
if (!SwitchSettings.SwitchConfig.EnableCustomTheme)
@@ -178,7 +173,7 @@ namespace Ryujinx.UI
}
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: \"{SwitchSettings.SwitchConfig.CustomThemePath}\".");
}
}
@@ -247,7 +242,7 @@ namespace Ryujinx.UI
{
if (_gameLoaded)
{
- CreateErrorDialog("A game has already been loaded. Please close the emulator and try again");
+ GtkDialog.CreateErrorDialog("A game has already been loaded. Please close the emulator and try again");
}
else
{
@@ -437,7 +432,10 @@ namespace Ryujinx.UI
appMetadata = JsonSerializer.Deserialize(stream, resolver);
}
- appMetadata.TimePlayed += Math.Round(DateTime.UtcNow.Subtract(DateTime.Parse(appMetadata.LastPlayed)).TotalSeconds, MidpointRounding.AwayFromZero);
+ DateTime lastPlayedDateTime = DateTime.Parse(appMetadata.LastPlayed);
+ double sessionTimePlayed = DateTime.UtcNow.Subtract(lastPlayedDateTime).TotalSeconds;
+
+ appMetadata.TimePlayed += Math.Round(sessionTimePlayed, MidpointRounding.AwayFromZero);
byte[] saveData = JsonSerializer.Serialize(appMetadata, resolver);
File.WriteAllText(metadataFile, Encoding.UTF8.GetString(saveData, 0, saveData.Length).PrettyPrintJson());
@@ -474,8 +472,19 @@ namespace Ryujinx.UI
//Events
private void Application_Added(object sender, ApplicationAddedEventArgs e)
{
- Application.Invoke(delegate {
- _tableStore.AppendValues(e.AppData.Favorite, new Gdk.Pixbuf(e.AppData.Icon, 75, 75), $"{e.AppData.TitleName}\n{e.AppData.TitleId.ToUpper()}", e.AppData.Developer, e.AppData.Version, e.AppData.TimePlayed, e.AppData.LastPlayed, e.AppData.FileExtension, e.AppData.FileSize, e.AppData.Path);
+ Application.Invoke(delegate
+ {
+ _tableStore.AppendValues(
+ e.AppData.Favorite,
+ new Gdk.Pixbuf(e.AppData.Icon, 75, 75),
+ $"{e.AppData.TitleName}\n{e.AppData.TitleId.ToUpper()}",
+ e.AppData.Developer,
+ e.AppData.Version,
+ e.AppData.TimePlayed,
+ e.AppData.LastPlayed,
+ e.AppData.FileExtension,
+ e.AppData.FileSize,
+ e.AppData.Path);
_progressLabel.Text = $"{e.NumAppsLoaded}/{e.NumAppsFound} Games Loaded";
_progressBar.Value = (float)e.NumAppsLoaded / e.NumAppsFound;
@@ -612,7 +621,7 @@ namespace Ryujinx.UI
}
catch(System.ComponentModel.Win32Exception)
{
- CreateErrorDialog("Update canceled by user or updater was not found");
+ GtkDialog.CreateErrorDialog("Update canceled by user or updater was not found");
}
}
diff --git a/Ryujinx/Ui/NpadController.cs b/Ryujinx/Ui/NpadController.cs
index 6f2d6b7c58..f72c407551 100644
--- a/Ryujinx/Ui/NpadController.cs
+++ b/Ryujinx/Ui/NpadController.cs
@@ -3,7 +3,7 @@ using OpenTK.Input;
using Ryujinx.HLE.Input;
using System;
-namespace Ryujinx.UI.Input
+namespace Ryujinx.Ui.Input
{
public enum ControllerInputId
{
diff --git a/Ryujinx/Ui/NpadKeyboard.cs b/Ryujinx/Ui/NpadKeyboard.cs
index ac739c0867..95fb222183 100644
--- a/Ryujinx/Ui/NpadKeyboard.cs
+++ b/Ryujinx/Ui/NpadKeyboard.cs
@@ -1,7 +1,7 @@
using OpenTK.Input;
using Ryujinx.HLE.Input;
-namespace Ryujinx.UI.Input
+namespace Ryujinx.Ui.Input
{
public struct NpadKeyboardLeft
{
diff --git a/Ryujinx/Ui/SwitchSettings.cs b/Ryujinx/Ui/SwitchSettings.cs
index fc9ca2d168..955c6b0b64 100644
--- a/Ryujinx/Ui/SwitchSettings.cs
+++ b/Ryujinx/Ui/SwitchSettings.cs
@@ -1,7 +1,7 @@
using Gtk;
using Ryujinx.HLE.HOS.SystemState;
using Ryujinx.HLE.Input;
-using Ryujinx.UI.Input;
+using Ryujinx.Ui.Input;
using System;
using System.Collections.Generic;
using System.IO;
@@ -10,7 +10,7 @@ using System.Reflection;
using GUI = Gtk.Builder.ObjectAttribute;
-namespace Ryujinx.UI
+namespace Ryujinx.Ui
{
public class SwitchSettings : Window
{
@@ -124,22 +124,22 @@ namespace Ryujinx.UI
_controller1Type.Changed += (sender, args) => Controller_Changed(sender, args, _controller1Type.ActiveId, _controller1Image);
//Setup Currents
- if (SwitchConfig.EnableFileLog) { _fileLogToggle.Click(); }
- if (SwitchConfig.LoggingEnableError) { _errorLogToggle.Click(); }
- if (SwitchConfig.LoggingEnableWarn) { _warningLogToggle.Click(); }
- if (SwitchConfig.LoggingEnableInfo) { _infoLogToggle.Click(); }
- if (SwitchConfig.LoggingEnableStub) { _stubLogToggle.Click(); }
- if (SwitchConfig.LoggingEnableDebug) { _debugLogToggle.Click(); }
- if (SwitchConfig.LoggingEnableGuest) { _guestLogToggle.Click(); }
- if (SwitchConfig.LoggingEnableFsAccessLog) { _fsAccessLogToggle.Click(); }
- if (SwitchConfig.DockedMode) { _dockedModeToggle.Click(); }
- if (SwitchConfig.EnableDiscordIntegration) { _discordToggle.Click(); }
- if (SwitchConfig.EnableVsync) { _vSyncToggle.Click(); }
- if (SwitchConfig.EnableMulticoreScheduling) { _multiSchedToggle.Click(); }
- if (SwitchConfig.EnableFsIntegrityChecks) { _fsicToggle.Click(); }
- if (SwitchConfig.IgnoreMissingServices) { _ignoreToggle.Click(); }
- if (SwitchConfig.EnableKeyboard) { _directKeyboardAccess.Click(); }
- if (SwitchConfig.EnableCustomTheme) { _custThemeToggle.Click(); }
+ if (SwitchConfig.EnableFileLog) _fileLogToggle.Click();
+ if (SwitchConfig.LoggingEnableError) _errorLogToggle.Click();
+ if (SwitchConfig.LoggingEnableWarn) _warningLogToggle.Click();
+ if (SwitchConfig.LoggingEnableInfo) _infoLogToggle.Click();
+ if (SwitchConfig.LoggingEnableStub) _stubLogToggle.Click();
+ if (SwitchConfig.LoggingEnableDebug) _debugLogToggle.Click();
+ if (SwitchConfig.LoggingEnableGuest) _guestLogToggle.Click();
+ if (SwitchConfig.LoggingEnableFsAccessLog) _fsAccessLogToggle.Click();
+ if (SwitchConfig.DockedMode) _dockedModeToggle.Click();
+ if (SwitchConfig.EnableDiscordIntegration) _discordToggle.Click();
+ if (SwitchConfig.EnableVsync) _vSyncToggle.Click();
+ if (SwitchConfig.EnableMulticoreScheduling) _multiSchedToggle.Click();
+ if (SwitchConfig.EnableFsIntegrityChecks) _fsicToggle.Click();
+ if (SwitchConfig.IgnoreMissingServices) _ignoreToggle.Click();
+ if (SwitchConfig.EnableKeyboard) _directKeyboardAccess.Click();
+ if (SwitchConfig.EnableCustomTheme) _custThemeToggle.Click();
_systemLanguageSelect.SetActiveId(SwitchConfig.SystemLanguage.ToString());
_controller1Type .SetActiveId(SwitchConfig.ControllerType.ToString());
diff --git a/Ryujinx/Ui/SwitchSettings.glade b/Ryujinx/Ui/SwitchSettings.glade
index 390267c7a3..cd00625c4c 100644
--- a/Ryujinx/Ui/SwitchSettings.glade
+++ b/Ryujinx/Ui/SwitchSettings.glade
@@ -629,7 +629,7 @@
- True
+ False
True
10
0