all requested changes marked as resolved have been changed
This commit is contained in:
parent
607fd55624
commit
098f76a695
8 changed files with 194 additions and 169 deletions
|
@ -2,6 +2,7 @@
|
|||
using LibHac.Fs;
|
||||
using LibHac.Fs.NcaUtils;
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.HLE.FileSystem;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
@ -16,6 +17,10 @@ namespace Ryujinx.HLE
|
|||
private static Keyset KeySet;
|
||||
private static HOS.SystemState.TitleLanguage DesiredTitleLanguage;
|
||||
|
||||
private const double SecondsPerMinute = 60.0;
|
||||
private const double SecondsPerHour = SecondsPerMinute * 60;
|
||||
private const double SecondsPerDay = SecondsPerHour * 24;
|
||||
|
||||
public static byte[] RyujinxNspIcon { get; private set; }
|
||||
public static byte[] RyujinxXciIcon { get; private set; }
|
||||
public static byte[] RyujinxNcaIcon { get; private set; }
|
||||
|
@ -44,26 +49,11 @@ namespace Ryujinx.HLE
|
|||
DesiredTitleLanguage = desiredTitleLanguage;
|
||||
|
||||
// Loads the default application Icons
|
||||
using (Stream resourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Ryujinx.HLE.ryujinxNSPIcon.png"))
|
||||
{
|
||||
using (MemoryStream ms = new MemoryStream()) { resourceStream.CopyTo(ms); RyujinxNspIcon = ms.ToArray(); }
|
||||
}
|
||||
using (Stream resourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Ryujinx.HLE.ryujinxXCIIcon.png"))
|
||||
{
|
||||
using (MemoryStream ms = new MemoryStream()) { resourceStream.CopyTo(ms); RyujinxXciIcon = ms.ToArray(); }
|
||||
}
|
||||
using (Stream resourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Ryujinx.HLE.ryujinxNCAIcon.png"))
|
||||
{
|
||||
using (MemoryStream ms = new MemoryStream()) { resourceStream.CopyTo(ms); RyujinxNcaIcon = ms.ToArray(); }
|
||||
}
|
||||
using (Stream resourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Ryujinx.HLE.ryujinxNROIcon.png"))
|
||||
{
|
||||
using(MemoryStream ms = new MemoryStream()) { resourceStream.CopyTo(ms); RyujinxNroIcon = ms.ToArray(); }
|
||||
}
|
||||
using (Stream resourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Ryujinx.HLE.ryujinxNSOIcon.png"))
|
||||
{
|
||||
using (MemoryStream ms = new MemoryStream()) { resourceStream.CopyTo(ms); RyujinxNsoIcon = ms.ToArray(); }
|
||||
}
|
||||
RyujinxNspIcon = GetResourceBytes("Ryujinx.HLE.ryujinxNSPIcon.png");
|
||||
RyujinxXciIcon = GetResourceBytes("Ryujinx.HLE.ryujinxXCIIcon.png");
|
||||
RyujinxNcaIcon = GetResourceBytes("Ryujinx.HLE.ryujinxNCAIcon.png");
|
||||
RyujinxNroIcon = GetResourceBytes("Ryujinx.HLE.ryujinxNROIcon.png");
|
||||
RyujinxNsoIcon = GetResourceBytes("Ryujinx.HLE.ryujinxNSOIcon.png");
|
||||
|
||||
// Builds the applications list with paths to found applications
|
||||
List<string> applications = new List<string>();
|
||||
|
@ -297,6 +287,16 @@ namespace Ryujinx.HLE
|
|||
}
|
||||
}
|
||||
|
||||
private static byte[] GetResourceBytes(string resourceName)
|
||||
{
|
||||
Stream resourceStream = Assembly.GetCallingAssembly().GetManifestResourceStream(resourceName);
|
||||
byte[] resourceByteArray = new byte[resourceStream.Length];
|
||||
|
||||
resourceStream.Read(resourceByteArray);
|
||||
|
||||
return resourceByteArray;
|
||||
}
|
||||
|
||||
private static IFileSystem GetControlFs(PartitionFileSystem Pfs)
|
||||
{
|
||||
Nca controlNca = null;
|
||||
|
@ -331,8 +331,7 @@ namespace Ryujinx.HLE
|
|||
try
|
||||
{
|
||||
string[] playedData = new string[2];
|
||||
string appdataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
||||
string savePath = Path.Combine(appdataPath, "RyuFs", "nand", "user", "save", "0000000000000000", UserId, TitleId);
|
||||
string savePath = Path.Combine(VirtualFileSystem.UserNandPath, "save", "0000000000000000", UserId, TitleId);
|
||||
|
||||
if (File.Exists(Path.Combine(savePath, "TimePlayed.dat")) == false)
|
||||
{
|
||||
|
@ -345,17 +344,20 @@ namespace Ryujinx.HLE
|
|||
{
|
||||
float timePlayed = float.Parse(sr.ReadLine());
|
||||
|
||||
if (timePlayed <= 60.0) { playedData[0] = $"{timePlayed}s"; }
|
||||
else if (timePlayed <= 3600.0) { playedData[0] = $"{Math.Round(timePlayed / 60 , 2, MidpointRounding.AwayFromZero)} mins"; }
|
||||
else if (timePlayed <= 86400.0) { playedData[0] = $"{Math.Round(timePlayed / 3600 , 2, MidpointRounding.AwayFromZero)} hrs"; }
|
||||
else { playedData[0] = $"{Math.Round(timePlayed / 86400, 2, MidpointRounding.AwayFromZero)} days"; }
|
||||
if (timePlayed < SecondsPerMinute) { playedData[0] = $"{timePlayed}s"; }
|
||||
else if (timePlayed < SecondsPerHour) { playedData[0] = $"{Math.Round(timePlayed / SecondsPerMinute, 2, MidpointRounding.AwayFromZero)} mins"; }
|
||||
else if (timePlayed < SecondsPerDay) { playedData[0] = $"{Math.Round(timePlayed / SecondsPerHour , 2, MidpointRounding.AwayFromZero)} hrs"; }
|
||||
else { playedData[0] = $"{Math.Round(timePlayed / SecondsPerDay , 2, MidpointRounding.AwayFromZero)} days"; }
|
||||
}
|
||||
}
|
||||
|
||||
if (File.Exists(Path.Combine(savePath, "LastPlayed.dat")) == false)
|
||||
{
|
||||
Directory.CreateDirectory(savePath);
|
||||
using (FileStream file = File.OpenWrite(Path.Combine(savePath, "LastPlayed.dat"))) { file.Write(Encoding.ASCII.GetBytes("Never")); }
|
||||
using (FileStream file = File.OpenWrite(Path.Combine(savePath, "LastPlayed.dat")))
|
||||
{
|
||||
file.Write(Encoding.ASCII.GetBytes("Never"));
|
||||
}
|
||||
}
|
||||
using (FileStream fs = File.OpenRead(Path.Combine(savePath, "LastPlayed.dat")))
|
||||
{
|
||||
|
|
|
@ -5,7 +5,7 @@ using System.IO;
|
|||
|
||||
namespace Ryujinx.HLE.FileSystem
|
||||
{
|
||||
class VirtualFileSystem : IDisposable
|
||||
public class VirtualFileSystem : IDisposable
|
||||
{
|
||||
public const string BasePath = "RyuFs";
|
||||
public const string NandPath = "nand";
|
||||
|
@ -60,7 +60,7 @@ namespace Ryujinx.HLE.FileSystem
|
|||
|
||||
public string GetSystemPath() => MakeDirAndGetFullPath(SystemPath);
|
||||
|
||||
public string GetGameSavePath(SaveInfo save, ServiceCtx context)
|
||||
internal string GetGameSavePath(SaveInfo save, ServiceCtx context)
|
||||
{
|
||||
return MakeDirAndGetFullPath(SaveHelper.GetSavePath(save, context));
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@ namespace Ryujinx
|
|||
{
|
||||
Console.Title = "Ryujinx Console";
|
||||
|
||||
string systemPATH = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.Machine);
|
||||
Environment.SetEnvironmentVariable("Path", $"{Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "bin")};{systemPATH}");
|
||||
string systemPath = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.Machine);
|
||||
Environment.SetEnvironmentVariable("Path", $"{Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "bin")};{systemPath}");
|
||||
|
||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||
AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<EmbeddedResource Include="Ui\assets\GitHubLogo.png" />
|
||||
<EmbeddedResource Include="Ui\assets\JoyCon.png" />
|
||||
<EmbeddedResource Include="Ui\assets\PatreonLogo.png" />
|
||||
<EmbeddedResource Include="Ui\assets\ryujinxIcon.png" />
|
||||
<EmbeddedResource Include="Ui\assets\RyujinxIcon.png" />
|
||||
<EmbeddedResource Include="Ui\assets\TwitterLogo.png" />
|
||||
<EmbeddedResource Include="Ui\MainWindow.glade" />
|
||||
<EmbeddedResource Include="Ui\SwitchSettings.glade" />
|
||||
|
|
|
@ -6,6 +6,7 @@ using Ryujinx.Common.Logging;
|
|||
using Ryujinx.Graphics.Gal;
|
||||
using Ryujinx.Graphics.Gal.OpenGL;
|
||||
using Ryujinx.HLE;
|
||||
using Ryujinx.HLE.FileSystem;
|
||||
using Ryujinx.Profiler;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
@ -33,14 +34,14 @@ namespace Ryujinx.UI
|
|||
|
||||
private static Application _gtkapp;
|
||||
|
||||
private static ListStore _TableStore;
|
||||
private static ListStore _tableStore;
|
||||
|
||||
private static bool _GameLoaded = false;
|
||||
private static bool _gameLoaded = false;
|
||||
|
||||
#pragma warning disable 649
|
||||
[GUI] Window MainWin;
|
||||
[GUI] CheckMenuItem FullScreen;
|
||||
[GUI] MenuItem ReturnMain;
|
||||
[GUI] MenuItem StopEmulation;
|
||||
[GUI] MenuItem Nfc;
|
||||
[GUI] Box Box;
|
||||
[GUI] TreeView GameTable;
|
||||
|
@ -88,14 +89,14 @@ namespace Ryujinx.UI
|
|||
}
|
||||
|
||||
builder.Autoconnect(this);
|
||||
MainWin.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.ryujinxIcon.png");
|
||||
MainWin.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.RyujinxIcon.png");
|
||||
|
||||
if (args.Length == 1)
|
||||
{
|
||||
// Temporary code section start, remove this section when game is rendered to the GLArea in the GUI
|
||||
Box.Remove(GlScreen);
|
||||
Nfc.Sensitive = false;
|
||||
ReturnMain.Sensitive = false;
|
||||
Nfc.Sensitive = false;
|
||||
StopEmulation.Sensitive = false;
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns[0]) { GameTable.AppendColumn("Icon" , new CellRendererPixbuf(), "pixbuf", 0); }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns[1]) { GameTable.AppendColumn("Application", new CellRendererText() , "text" , 1); }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns[2]) { GameTable.AppendColumn("Developer" , new CellRendererText() , "text" , 2); }
|
||||
|
@ -105,8 +106,8 @@ namespace Ryujinx.UI
|
|||
if (SwitchSettings.SwitchConfig.GuiColumns[6]) { GameTable.AppendColumn("File Ext" , new CellRendererText() , "text" , 6); }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns[7]) { GameTable.AppendColumn("File Size" , new CellRendererText() , "text" , 7); }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns[8]) { GameTable.AppendColumn("Path" , new CellRendererText() , "text" , 8); }
|
||||
_TableStore = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string));
|
||||
GameTable.Model = _TableStore;
|
||||
_tableStore = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string));
|
||||
GameTable.Model = _tableStore;
|
||||
UpdateGameTable();
|
||||
// Temporary code section end
|
||||
|
||||
|
@ -116,8 +117,8 @@ namespace Ryujinx.UI
|
|||
{
|
||||
Box.Remove(GlScreen);
|
||||
|
||||
Nfc.Sensitive = false;
|
||||
ReturnMain.Sensitive = false;
|
||||
Nfc.Sensitive = false;
|
||||
StopEmulation.Sensitive = false;
|
||||
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns[0]) { GameTable.AppendColumn("Icon" , new CellRendererPixbuf(), "pixbuf", 0); }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns[1]) { GameTable.AppendColumn("Application", new CellRendererText() , "text" , 1); }
|
||||
|
@ -129,21 +130,32 @@ namespace Ryujinx.UI
|
|||
if (SwitchSettings.SwitchConfig.GuiColumns[7]) { GameTable.AppendColumn("File Size" , new CellRendererText() , "text" , 7); }
|
||||
if (SwitchSettings.SwitchConfig.GuiColumns[8]) { GameTable.AppendColumn("Path" , new CellRendererText() , "text" , 8); }
|
||||
|
||||
_TableStore = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string));
|
||||
GameTable.Model = _TableStore;
|
||||
_tableStore = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string));
|
||||
GameTable.Model = _tableStore;
|
||||
|
||||
UpdateGameTable();
|
||||
}
|
||||
}
|
||||
|
||||
public static void CreateErrorDialog(string errorMessage)
|
||||
{
|
||||
MessageDialog errorDialog = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, errorMessage);
|
||||
errorDialog.SetSizeRequest(100, 20);
|
||||
errorDialog.Title = "Ryujinx - Error";
|
||||
errorDialog.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.RyujinxIcon.png");
|
||||
errorDialog.WindowPosition = WindowPosition.Center;
|
||||
errorDialog.Run();
|
||||
errorDialog.Destroy();
|
||||
}
|
||||
|
||||
public static void UpdateGameTable()
|
||||
{
|
||||
_TableStore.Clear();
|
||||
_tableStore.Clear();
|
||||
ApplicationLibrary.Init(SwitchSettings.SwitchConfig.GameDirs, _device.System.KeySet, _device.System.State.DesiredTitleLanguage);
|
||||
|
||||
foreach (ApplicationLibrary.ApplicationData AppData in ApplicationLibrary.ApplicationLibraryData)
|
||||
{
|
||||
_TableStore.AppendValues(new Gdk.Pixbuf(AppData.Icon, 75, 75), $"{AppData.TitleName}\n{AppData.TitleId.ToUpper()}", AppData.Developer, AppData.Version, AppData.TimePlayed, AppData.LastPlayed, AppData.FileExt, AppData.FileSize, AppData.Path);
|
||||
_tableStore.AppendValues(new Gdk.Pixbuf(AppData.Icon, 75, 75), $"{AppData.TitleName}\n{AppData.TitleId.ToUpper()}", AppData.Developer, AppData.Version, AppData.TimePlayed, AppData.LastPlayed, AppData.FileExt, AppData.FileSize, AppData.Path);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -178,15 +190,9 @@ namespace Ryujinx.UI
|
|||
|
||||
private void LoadApplication(string path)
|
||||
{
|
||||
if (_GameLoaded)
|
||||
if (_gameLoaded)
|
||||
{
|
||||
MessageDialog errorDialog = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, "A game has already been loaded. Please close the emulator and try again");
|
||||
errorDialog.SetSizeRequest(100, 20);
|
||||
errorDialog.Title = "Ryujinx - Error";
|
||||
errorDialog.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.ryujinxIcon.png");
|
||||
errorDialog.WindowPosition = WindowPosition.Center;
|
||||
errorDialog.Run();
|
||||
errorDialog.Destroy();
|
||||
CreateErrorDialog("A game has already been loaded. Please close the emulator and try again");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -243,8 +249,8 @@ namespace Ryujinx.UI
|
|||
|
||||
new Thread(new ThreadStart(CreateGameWindow)).Start();
|
||||
|
||||
_GameLoaded = true;
|
||||
ReturnMain.Sensitive = true;
|
||||
_gameLoaded = true;
|
||||
StopEmulation.Sensitive = true;
|
||||
|
||||
if (DiscordIntegrationEnabled)
|
||||
{
|
||||
|
@ -265,8 +271,7 @@ namespace Ryujinx.UI
|
|||
string userId = "00000000000000000000000000000001";
|
||||
try
|
||||
{
|
||||
string appdataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
||||
string savePath = System.IO.Path.Combine(appdataPath, "RyuFs", "nand", "user", "save", "0000000000000000", userId, _device.System.TitleID);
|
||||
string savePath = System.IO.Path.Combine(VirtualFileSystem.UserNandPath, "save", "0000000000000000", userId, _device.System.TitleID);
|
||||
|
||||
if (File.Exists(System.IO.Path.Combine(savePath, "TimePlayed.dat")) == false)
|
||||
{
|
||||
|
@ -306,12 +311,11 @@ namespace Ryujinx.UI
|
|||
private static void End()
|
||||
{
|
||||
string userId = "00000000000000000000000000000001";
|
||||
if (_GameLoaded)
|
||||
if (_gameLoaded)
|
||||
{
|
||||
try
|
||||
{
|
||||
string appdataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
||||
string savePath = System.IO.Path.Combine(appdataPath, "RyuFs", "nand", "user", "save", "0000000000000000", userId, _device.System.TitleID);
|
||||
string savePath = System.IO.Path.Combine(VirtualFileSystem.UserNandPath, "save", "0000000000000000", userId, _device.System.TitleID);
|
||||
double currentPlayTime = 0;
|
||||
|
||||
using (FileStream fs = File.OpenRead(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
|
||||
|
@ -351,12 +355,32 @@ namespace Ryujinx.UI
|
|||
Logger.Shutdown();
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Picks an <see cref="IAalOutput"/> audio output renderer supported on this machine
|
||||
/// </summary>
|
||||
/// <returns>An <see cref="IAalOutput"/> supported by this machine</returns>
|
||||
private static IAalOutput InitializeAudioEngine()
|
||||
{
|
||||
if (SoundIoAudioOut.IsSupported)
|
||||
{
|
||||
return new SoundIoAudioOut();
|
||||
}
|
||||
else if (OpenALAudioOut.IsSupported)
|
||||
{
|
||||
return new OpenALAudioOut();
|
||||
}
|
||||
else
|
||||
{
|
||||
return new DummyAudioOut();
|
||||
}
|
||||
}
|
||||
|
||||
//Events
|
||||
private void Row_Activated(object o, RowActivatedArgs args)
|
||||
{
|
||||
_TableStore.GetIter(out TreeIter treeiter, new TreePath(args.Path.ToString()));
|
||||
string path = (string)_TableStore.GetValue(treeiter, 8);
|
||||
_tableStore.GetIter(out TreeIter treeiter, new TreePath(args.Path.ToString()));
|
||||
string path = (string)_tableStore.GetValue(treeiter, 8);
|
||||
|
||||
LoadApplication(path);
|
||||
}
|
||||
|
@ -406,7 +430,7 @@ namespace Ryujinx.UI
|
|||
|
||||
private void Window_Close(object o, DeleteEventArgs args) { End(); }
|
||||
|
||||
private void ReturnMain_Pressed(object o, EventArgs args)
|
||||
private void StopEmulation_Pressed(object o, EventArgs args)
|
||||
{
|
||||
// TODO: Write logic to kill running game
|
||||
}
|
||||
|
@ -445,25 +469,5 @@ namespace Ryujinx.UI
|
|||
_gtkapp.AddWindow(AboutWin);
|
||||
AboutWin.Show();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Picks an <see cref="IAalOutput"/> audio output renderer supported on this machine
|
||||
/// </summary>
|
||||
/// <returns>An <see cref="IAalOutput"/> supported by this machine</returns>
|
||||
private static IAalOutput InitializeAudioEngine()
|
||||
{
|
||||
if (SoundIoAudioOut.IsSupported)
|
||||
{
|
||||
return new SoundIoAudioOut();
|
||||
}
|
||||
else if (OpenALAudioOut.IsSupported)
|
||||
{
|
||||
return new OpenALAudioOut();
|
||||
}
|
||||
else
|
||||
{
|
||||
return new DummyAudioOut();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,12 +101,12 @@
|
|||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuItem" id="ReturnMain">
|
||||
<object class="GtkMenuItem" id="StopEmulation">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Return to Main Menu</property>
|
||||
<property name="label" translatable="yes">Stop Emulation</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="ReturnMain_Pressed" swapped="no"/>
|
||||
<signal name="activate" handler="StopEmulation_Pressed" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
|
|
@ -17,9 +17,9 @@ namespace Ryujinx.UI
|
|||
|
||||
internal HLE.Switch Device { get; set; }
|
||||
|
||||
private static ListStore _GameDirsBoxStore;
|
||||
private static ListStore _gameDirsBoxStore;
|
||||
|
||||
private static bool _ListeningForKeypress;
|
||||
private static bool _listeningForKeypress;
|
||||
|
||||
#pragma warning disable 649
|
||||
[GUI] Window SettingsWin;
|
||||
|
@ -40,7 +40,7 @@ namespace Ryujinx.UI
|
|||
[GUI] CheckButton FileLogToggle;
|
||||
[GUI] CheckButton GuestLogToggle;
|
||||
[GUI] CheckButton FsAccessLogToggle;
|
||||
[GUI] Adjustment FGALMSpinAdjustment;
|
||||
[GUI] Adjustment FsLogSpinAdjustment;
|
||||
[GUI] CheckButton DockedModeToggle;
|
||||
[GUI] CheckButton DiscordToggle;
|
||||
[GUI] CheckButton VSyncToggle;
|
||||
|
@ -100,7 +100,7 @@ namespace Ryujinx.UI
|
|||
|
||||
builder.Autoconnect(this);
|
||||
|
||||
SettingsWin.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.ryujinxIcon.png");
|
||||
SettingsWin.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.RyujinxIcon.png");
|
||||
ControllerImage.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.JoyCon.png", 500, 500);
|
||||
|
||||
//Bind Events
|
||||
|
@ -186,42 +186,48 @@ namespace Ryujinx.UI
|
|||
|
||||
CustThemeDir.Buffer.Text = SwitchConfig.CustomThemePath;
|
||||
GraphicsShadersDumpPath.Buffer.Text = SwitchConfig.GraphicsShadersDumpPath;
|
||||
FGALMSpinAdjustment.Value = SwitchConfig.FsGlobalAccessLogMode;
|
||||
FsLogSpinAdjustment.Value = SwitchConfig.FsGlobalAccessLogMode;
|
||||
|
||||
GameDirsBox.AppendColumn("", new CellRendererText(), "text", 0);
|
||||
_GameDirsBoxStore = new ListStore(typeof(string));
|
||||
GameDirsBox.Model = _GameDirsBoxStore;
|
||||
foreach (string GameDir in SwitchConfig.GameDirs)
|
||||
_gameDirsBoxStore = new ListStore(typeof(string));
|
||||
GameDirsBox.Model = _gameDirsBoxStore;
|
||||
foreach (string gameDir in SwitchConfig.GameDirs)
|
||||
{
|
||||
_GameDirsBoxStore.AppendValues(GameDir);
|
||||
_gameDirsBoxStore.AppendValues(gameDir);
|
||||
}
|
||||
|
||||
if (CustThemeToggle.Active == false) { CustThemeDir.Sensitive = false; CustThemeDirLabel.Sensitive = false; BrowseThemeDir.Sensitive = false; }
|
||||
if (CustThemeToggle.Active == false)
|
||||
{
|
||||
CustThemeDir.Sensitive = false;
|
||||
CustThemeDirLabel.Sensitive = false;
|
||||
BrowseThemeDir.Sensitive = false;
|
||||
}
|
||||
|
||||
LogPath.Buffer.Text = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Ryujinx.log");
|
||||
|
||||
_ListeningForKeypress = false;
|
||||
_listeningForKeypress = false;
|
||||
}
|
||||
|
||||
//Events
|
||||
private void Button_Pressed(object obj, EventArgs args, ToggleButton Button)
|
||||
{
|
||||
if (_ListeningForKeypress == false)
|
||||
if (_listeningForKeypress == false)
|
||||
{
|
||||
KeyPressEvent += On_KeyPress;
|
||||
_ListeningForKeypress = true;
|
||||
_listeningForKeypress = true;
|
||||
|
||||
void On_KeyPress(object Obj, KeyPressEventArgs KeyPressed)
|
||||
{
|
||||
string key = KeyPressed.Event.Key.ToString();
|
||||
string key = KeyPressed.Event.Key.ToString();
|
||||
string capKey = key.First().ToString().ToUpper() + key.Substring(1);
|
||||
|
||||
if (Enum.IsDefined(typeof(OpenTK.Input.Key), key.First().ToString().ToUpper() + key.Substring(1))) { Button.Label = key.First().ToString().ToUpper() + key.Substring(1); }
|
||||
else if (GdkToTKInput.ContainsKey(key)) { Button.Label = GdkToTKInput[key]; }
|
||||
else { Button.Label = "Space"; }
|
||||
if (Enum.IsDefined(typeof(OpenTK.Input.Key), capKey)) { Button.Label = capKey; }
|
||||
else if (GdkToOpenTKInput.ContainsKey(key)) { Button.Label = GdkToOpenTKInput[key]; }
|
||||
else { Button.Label = "Space"; }
|
||||
|
||||
Button.SetStateFlags(0, true);
|
||||
KeyPressEvent -= On_KeyPress;
|
||||
_ListeningForKeypress = false;
|
||||
_listeningForKeypress = false;
|
||||
}
|
||||
}
|
||||
else { Button.SetStateFlags(0, true); }
|
||||
|
@ -229,7 +235,7 @@ namespace Ryujinx.UI
|
|||
|
||||
private void AddDir_Pressed(object obj, EventArgs args)
|
||||
{
|
||||
if (Directory.Exists(AddGameDirBox.Buffer.Text)) { _GameDirsBoxStore.AppendValues(AddGameDirBox.Buffer.Text); }
|
||||
if (Directory.Exists(AddGameDirBox.Buffer.Text)) { _gameDirsBoxStore.AppendValues(AddGameDirBox.Buffer.Text); }
|
||||
|
||||
AddDir.SetStateFlags(0, true);
|
||||
}
|
||||
|
@ -240,7 +246,7 @@ namespace Ryujinx.UI
|
|||
|
||||
if (fc.Run() == (int)ResponseType.Accept)
|
||||
{
|
||||
_GameDirsBoxStore.AppendValues(fc.Filename);
|
||||
_gameDirsBoxStore.AppendValues(fc.Filename);
|
||||
}
|
||||
|
||||
fc.Destroy();
|
||||
|
@ -253,14 +259,25 @@ namespace Ryujinx.UI
|
|||
TreeSelection selection = GameDirsBox.Selection;
|
||||
|
||||
selection.GetSelected(out TreeIter treeiter);
|
||||
_GameDirsBoxStore.Remove(ref treeiter);
|
||||
_gameDirsBoxStore.Remove(ref treeiter);
|
||||
|
||||
RemoveDir.SetStateFlags(0, true);
|
||||
}
|
||||
|
||||
private void CustThemeToggle_Activated(object obj, EventArgs args)
|
||||
{
|
||||
if (CustThemeToggle.Active == false) { CustThemeDir.Sensitive = false; CustThemeDirLabel.Sensitive = false; BrowseThemeDir.Sensitive = false; } else { CustThemeDir.Sensitive = true; CustThemeDirLabel.Sensitive = true; BrowseThemeDir.Sensitive = true; }
|
||||
if (CustThemeToggle.Active == false)
|
||||
{
|
||||
CustThemeDir.Sensitive = false;
|
||||
CustThemeDirLabel.Sensitive = false;
|
||||
BrowseThemeDir.Sensitive = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
CustThemeDir.Sensitive = true;
|
||||
CustThemeDirLabel.Sensitive = true;
|
||||
BrowseThemeDir.Sensitive = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void BrowseThemeDir_Pressed(object obj, EventArgs args)
|
||||
|
@ -283,67 +300,69 @@ namespace Ryujinx.UI
|
|||
{
|
||||
List<string> gameDirs = new List<string>();
|
||||
|
||||
_GameDirsBoxStore.GetIterFirst(out TreeIter iter);
|
||||
for (int i = 0; i < _GameDirsBoxStore.IterNChildren(); i++)
|
||||
_gameDirsBoxStore.GetIterFirst(out TreeIter iter);
|
||||
for (int i = 0; i < _gameDirsBoxStore.IterNChildren(); i++)
|
||||
{
|
||||
_GameDirsBoxStore.GetValue(iter, i );
|
||||
_gameDirsBoxStore.GetValue(iter, i );
|
||||
|
||||
gameDirs.Add((string)_GameDirsBoxStore.GetValue(iter, 0));
|
||||
gameDirs.Add((string)_gameDirsBoxStore.GetValue(iter, 0));
|
||||
|
||||
_GameDirsBoxStore.IterNext(ref iter);
|
||||
_gameDirsBoxStore.IterNext(ref iter);
|
||||
}
|
||||
|
||||
if (IconToggle.Active) { SwitchConfig.GuiColumns[0] = true; }
|
||||
if (TitleToggle.Active) { SwitchConfig.GuiColumns[1] = true; }
|
||||
if (DeveloperToggle.Active) { SwitchConfig.GuiColumns[2] = true; }
|
||||
if (VersionToggle.Active) { SwitchConfig.GuiColumns[3] = true; }
|
||||
if (TimePlayedToggle.Active) { SwitchConfig.GuiColumns[4] = true; }
|
||||
if (LastPlayedToggle.Active) { SwitchConfig.GuiColumns[5] = true; }
|
||||
if (FileExtToggle.Active) { SwitchConfig.GuiColumns[6] = true; }
|
||||
if (FileSizeToggle.Active) { SwitchConfig.GuiColumns[7] = true; }
|
||||
if (PathToggle.Active) { SwitchConfig.GuiColumns[8] = true; }
|
||||
if (ErrorLogToggle.Active) { SwitchConfig.LoggingEnableError = true; }
|
||||
if (WarningLogToggle.Active) { SwitchConfig.LoggingEnableWarn = true; }
|
||||
if (InfoLogToggle.Active) { SwitchConfig.LoggingEnableInfo = true; }
|
||||
if (StubLogToggle.Active) { SwitchConfig.LoggingEnableStub = true; }
|
||||
if (DebugLogToggle.Active) { SwitchConfig.LoggingEnableDebug = true; }
|
||||
if (GuestLogToggle.Active) { SwitchConfig.LoggingEnableGuest = true; }
|
||||
if (FsAccessLogToggle.Active) { SwitchConfig.LoggingEnableFsAccessLog = true; }
|
||||
if (FileLogToggle.Active) { SwitchConfig.EnableFileLog = true; }
|
||||
if (DockedModeToggle.Active) { SwitchConfig.DockedMode = true; }
|
||||
if (DiscordToggle.Active) { SwitchConfig.EnableDiscordIntegration = true; }
|
||||
if (VSyncToggle.Active) { SwitchConfig.EnableVsync = true; }
|
||||
if (MultiSchedToggle.Active) { SwitchConfig.EnableMulticoreScheduling = true; }
|
||||
if (FSICToggle.Active) { SwitchConfig.EnableFsIntegrityChecks = true; }
|
||||
if (AggrToggle.Active) { SwitchConfig.EnableAggressiveCpuOpts = true; }
|
||||
if (IgnoreToggle.Active) { SwitchConfig.IgnoreMissingServices = true; }
|
||||
if (DirectKeyboardAccess.Active) { SwitchConfig.EnableKeyboard = true; }
|
||||
if (CustThemeToggle.Active) { SwitchConfig.EnableCustomTheme = true; }
|
||||
if (IconToggle.Active) SwitchConfig.GuiColumns[0] = true;
|
||||
if (TitleToggle.Active) SwitchConfig.GuiColumns[1] = true;
|
||||
if (DeveloperToggle.Active) SwitchConfig.GuiColumns[2] = true;
|
||||
if (VersionToggle.Active) SwitchConfig.GuiColumns[3] = true;
|
||||
if (TimePlayedToggle.Active) SwitchConfig.GuiColumns[4] = true;
|
||||
if (LastPlayedToggle.Active) SwitchConfig.GuiColumns[5] = true;
|
||||
if (FileExtToggle.Active) SwitchConfig.GuiColumns[6] = true;
|
||||
if (FileSizeToggle.Active) SwitchConfig.GuiColumns[7] = true;
|
||||
if (PathToggle.Active) SwitchConfig.GuiColumns[8] = true;
|
||||
if (ErrorLogToggle.Active) SwitchConfig.LoggingEnableError = true;
|
||||
if (WarningLogToggle.Active) SwitchConfig.LoggingEnableWarn = true;
|
||||
if (InfoLogToggle.Active) SwitchConfig.LoggingEnableInfo = true;
|
||||
if (StubLogToggle.Active) SwitchConfig.LoggingEnableStub = true;
|
||||
if (DebugLogToggle.Active) SwitchConfig.LoggingEnableDebug = true;
|
||||
if (GuestLogToggle.Active) SwitchConfig.LoggingEnableGuest = true;
|
||||
if (FsAccessLogToggle.Active) SwitchConfig.LoggingEnableFsAccessLog = true;
|
||||
if (FileLogToggle.Active) SwitchConfig.EnableFileLog = true;
|
||||
if (DockedModeToggle.Active) SwitchConfig.DockedMode = true;
|
||||
if (DiscordToggle.Active) SwitchConfig.EnableDiscordIntegration = true;
|
||||
if (VSyncToggle.Active) SwitchConfig.EnableVsync = true;
|
||||
if (MultiSchedToggle.Active) SwitchConfig.EnableMulticoreScheduling = true;
|
||||
if (FSICToggle.Active) SwitchConfig.EnableFsIntegrityChecks = true;
|
||||
if (AggrToggle.Active) SwitchConfig.EnableAggressiveCpuOpts = true;
|
||||
if (IgnoreToggle.Active) SwitchConfig.IgnoreMissingServices = true;
|
||||
if (DirectKeyboardAccess.Active) SwitchConfig.EnableKeyboard = true;
|
||||
if (CustThemeToggle.Active) SwitchConfig.EnableCustomTheme = true;
|
||||
|
||||
if (IconToggle.Active == false) { SwitchConfig.GuiColumns[0] = false; }
|
||||
if (TitleToggle.Active == false) { SwitchConfig.GuiColumns[1] = false; }
|
||||
if (DeveloperToggle.Active == false) { SwitchConfig.GuiColumns[2] = false; }
|
||||
if (VersionToggle.Active == false) { SwitchConfig.GuiColumns[3] = false; }
|
||||
if (TimePlayedToggle.Active == false) { SwitchConfig.GuiColumns[4] = false; }
|
||||
if (LastPlayedToggle.Active == false) { SwitchConfig.GuiColumns[5] = false; }
|
||||
if (FileExtToggle.Active == false) { SwitchConfig.GuiColumns[6] = false; }
|
||||
if (FileSizeToggle.Active == false) { SwitchConfig.GuiColumns[7] = false; }
|
||||
if (PathToggle.Active == false) { SwitchConfig.GuiColumns[8] = false; }
|
||||
if (ErrorLogToggle.Active == false) { SwitchConfig.LoggingEnableError = false; }
|
||||
if (WarningLogToggle.Active == false) { SwitchConfig.LoggingEnableWarn = false; }
|
||||
if (InfoLogToggle.Active == false) { SwitchConfig.LoggingEnableInfo = false; }
|
||||
if (StubLogToggle.Active == false) { SwitchConfig.LoggingEnableStub = false; }
|
||||
if (DebugLogToggle.Active == false) { SwitchConfig.LoggingEnableDebug = false; }
|
||||
if (FileLogToggle.Active == false) { SwitchConfig.EnableFileLog = false; }
|
||||
if (DockedModeToggle.Active == false) { SwitchConfig.DockedMode = false; }
|
||||
if (DiscordToggle.Active == false) { SwitchConfig.EnableDiscordIntegration = false; }
|
||||
if (VSyncToggle.Active == false) { SwitchConfig.EnableVsync = false; }
|
||||
if (MultiSchedToggle.Active == false) { SwitchConfig.EnableMulticoreScheduling = false; }
|
||||
if (FSICToggle.Active == false) { SwitchConfig.EnableFsIntegrityChecks = false; }
|
||||
if (AggrToggle.Active == false) { SwitchConfig.EnableAggressiveCpuOpts = false; }
|
||||
if (IgnoreToggle.Active == false) { SwitchConfig.IgnoreMissingServices = false; }
|
||||
if (DirectKeyboardAccess.Active == false) { SwitchConfig.EnableKeyboard = false; }
|
||||
if (CustThemeToggle.Active == false) { SwitchConfig.EnableCustomTheme = false; }
|
||||
if (!IconToggle.Active) SwitchConfig.GuiColumns[0] = false;
|
||||
if (!TitleToggle.Active) SwitchConfig.GuiColumns[1] = false;
|
||||
if (!DeveloperToggle.Active) SwitchConfig.GuiColumns[2] = false;
|
||||
if (!VersionToggle.Active) SwitchConfig.GuiColumns[3] = false;
|
||||
if (!TimePlayedToggle.Active) SwitchConfig.GuiColumns[4] = false;
|
||||
if (!LastPlayedToggle.Active) SwitchConfig.GuiColumns[5] = false;
|
||||
if (!FileExtToggle.Active) SwitchConfig.GuiColumns[6] = false;
|
||||
if (!FileSizeToggle.Active) SwitchConfig.GuiColumns[7] = false;
|
||||
if (!PathToggle.Active) SwitchConfig.GuiColumns[8] = false;
|
||||
if (!ErrorLogToggle.Active) SwitchConfig.LoggingEnableError = false;
|
||||
if (!WarningLogToggle.Active) SwitchConfig.LoggingEnableWarn = false;
|
||||
if (!InfoLogToggle.Active) SwitchConfig.LoggingEnableInfo = false;
|
||||
if (!StubLogToggle.Active ) SwitchConfig.LoggingEnableStub = false;
|
||||
if (!DebugLogToggle.Active) SwitchConfig.LoggingEnableDebug = false;
|
||||
if (!GuestLogToggle.Active) SwitchConfig.LoggingEnableGuest = false;
|
||||
if (!FsAccessLogToggle.Active) SwitchConfig.LoggingEnableFsAccessLog = false;
|
||||
if (!FileLogToggle.Active) SwitchConfig.EnableFileLog = false;
|
||||
if (!DockedModeToggle.Active) SwitchConfig.DockedMode = false;
|
||||
if (!DiscordToggle.Active) SwitchConfig.EnableDiscordIntegration = false;
|
||||
if (!VSyncToggle.Active) SwitchConfig.EnableVsync = false;
|
||||
if (!MultiSchedToggle.Active) SwitchConfig.EnableMulticoreScheduling = false;
|
||||
if (!FSICToggle.Active) SwitchConfig.EnableFsIntegrityChecks = false;
|
||||
if (!AggrToggle.Active) SwitchConfig.EnableAggressiveCpuOpts = false;
|
||||
if (!IgnoreToggle.Active) SwitchConfig.IgnoreMissingServices = false;
|
||||
if (!DirectKeyboardAccess.Active) SwitchConfig.EnableKeyboard = false;
|
||||
if (!CustThemeToggle.Active) SwitchConfig.EnableCustomTheme = false;
|
||||
|
||||
SwitchConfig.KeyboardControls.LeftJoycon = new NpadKeyboardLeft()
|
||||
{
|
||||
|
@ -382,7 +401,7 @@ namespace Ryujinx.UI
|
|||
SwitchConfig.CustomThemePath = CustThemeDir.Buffer.Text;
|
||||
SwitchConfig.GraphicsShadersDumpPath = GraphicsShadersDumpPath.Buffer.Text;
|
||||
SwitchConfig.GameDirs = gameDirs;
|
||||
SwitchConfig.FsGlobalAccessLogMode = (int)FGALMSpinAdjustment.Value;
|
||||
SwitchConfig.FsGlobalAccessLogMode = (int)FsLogSpinAdjustment.Value;
|
||||
|
||||
Configuration.SaveConfig(SwitchConfig, System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json"));
|
||||
Configuration.Configure(Device, SwitchConfig);
|
||||
|
@ -397,7 +416,7 @@ namespace Ryujinx.UI
|
|||
Destroy();
|
||||
}
|
||||
|
||||
public readonly Dictionary<string, string> GdkToTKInput = new Dictionary<string, string>()
|
||||
public readonly Dictionary<string, string> GdkToOpenTKInput = new Dictionary<string, string>()
|
||||
{
|
||||
{ "Key_0" , "Number0" },
|
||||
{ "Key_1" , "Number1" },
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!-- Generated with glade 3.22.1 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.20"/>
|
||||
<object class="GtkAdjustment" id="FGALMSpinAdjustment">
|
||||
<object class="GtkAdjustment" id="FsLogSpinAdjustment">
|
||||
<property name="upper">3</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
|
@ -2039,7 +2039,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Enables FS access log output to the console. Possible modes are 0-3</property>
|
||||
<property name="adjustment">FGALMSpinAdjustment</property>
|
||||
<property name="adjustment">FsLogSpinAdjustment</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
|
|
Loading…
Add table
Reference in a new issue