changes
- gdkchan's requested changes that have been marked resolved - made some structs internal as they aren't used outside of the GUI - renamed Ryujinx.UI to Ryujinx.Ui to fit naming convention and folder structure - fixed bug where controller type dropdown box is stretched
This commit is contained in:
parent
a0f22d4494
commit
46a97f6682
16 changed files with 92 additions and 60 deletions
|
@ -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
|
|||
/// <summary>
|
||||
/// Controller control bindings
|
||||
/// </summary>
|
||||
public UI.Input.NpadController JoystickControls { get; private set; }
|
||||
public Ui.Input.NpadController JoystickControls { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Loads a configuration file from disk
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace Ryujinx.UI
|
||||
namespace Ryujinx.Ui
|
||||
{
|
||||
public struct AboutInfo
|
||||
internal struct AboutInfo
|
||||
{
|
||||
public string InstallVersion;
|
||||
public string InstallCommit;
|
||||
|
|
|
@ -9,7 +9,7 @@ using Utf8Json.Resolvers;
|
|||
|
||||
using GUI = Gtk.Builder.ObjectAttribute;
|
||||
|
||||
namespace Ryujinx.UI
|
||||
namespace Ryujinx.Ui
|
||||
{
|
||||
public class AboutWindow : Window
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace Ryujinx.UI
|
||||
namespace Ryujinx.Ui
|
||||
{
|
||||
public class ApplicationAddedEventArgs : EventArgs
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace Ryujinx.UI
|
||||
namespace Ryujinx.Ui
|
||||
{
|
||||
public struct ApplicationData
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -10,7 +10,7 @@ using System.Threading;
|
|||
|
||||
using Stopwatch = System.Diagnostics.Stopwatch;
|
||||
|
||||
namespace Ryujinx.UI
|
||||
namespace Ryujinx.Ui
|
||||
{
|
||||
public class GlScreen : GameWindow
|
||||
{
|
||||
|
|
23
Ryujinx/Ui/GtkDialog.cs
Normal file
23
Ryujinx/Ui/GtkDialog.cs
Normal file
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
namespace Ryujinx.UI
|
||||
namespace Ryujinx.Ui
|
||||
{
|
||||
public struct GuiColumns
|
||||
{
|
||||
|
|
|
@ -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<ApplicationMetadata>(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");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ using OpenTK.Input;
|
|||
using Ryujinx.HLE.Input;
|
||||
using System;
|
||||
|
||||
namespace Ryujinx.UI.Input
|
||||
namespace Ryujinx.Ui.Input
|
||||
{
|
||||
public enum ControllerInputId
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using OpenTK.Input;
|
||||
using Ryujinx.HLE.Input;
|
||||
|
||||
namespace Ryujinx.UI.Input
|
||||
namespace Ryujinx.Ui.Input
|
||||
{
|
||||
public struct NpadKeyboardLeft
|
||||
{
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -629,7 +629,7 @@
|
|||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">10</property>
|
||||
<property name="position">0</property>
|
||||
|
|
Loading…
Add table
Reference in a new issue