all requested changes marked as resolved have been changed

This commit is contained in:
Xpl0itR 2019-07-13 14:46:14 +01:00
commit 098f76a695
No known key found for this signature in database
GPG key ID: 91798184109676AD
8 changed files with 194 additions and 169 deletions

View file

@ -2,6 +2,7 @@
using LibHac.Fs; using LibHac.Fs;
using LibHac.Fs.NcaUtils; using LibHac.Fs.NcaUtils;
using Ryujinx.Common.Logging; using Ryujinx.Common.Logging;
using Ryujinx.HLE.FileSystem;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@ -16,6 +17,10 @@ namespace Ryujinx.HLE
private static Keyset KeySet; private static Keyset KeySet;
private static HOS.SystemState.TitleLanguage DesiredTitleLanguage; 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[] RyujinxNspIcon { get; private set; }
public static byte[] RyujinxXciIcon { get; private set; } public static byte[] RyujinxXciIcon { get; private set; }
public static byte[] RyujinxNcaIcon { get; private set; } public static byte[] RyujinxNcaIcon { get; private set; }
@ -44,26 +49,11 @@ namespace Ryujinx.HLE
DesiredTitleLanguage = desiredTitleLanguage; DesiredTitleLanguage = desiredTitleLanguage;
// Loads the default application Icons // Loads the default application Icons
using (Stream resourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Ryujinx.HLE.ryujinxNSPIcon.png")) RyujinxNspIcon = GetResourceBytes("Ryujinx.HLE.ryujinxNSPIcon.png");
{ RyujinxXciIcon = GetResourceBytes("Ryujinx.HLE.ryujinxXCIIcon.png");
using (MemoryStream ms = new MemoryStream()) { resourceStream.CopyTo(ms); RyujinxNspIcon = ms.ToArray(); } RyujinxNcaIcon = GetResourceBytes("Ryujinx.HLE.ryujinxNCAIcon.png");
} RyujinxNroIcon = GetResourceBytes("Ryujinx.HLE.ryujinxNROIcon.png");
using (Stream resourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Ryujinx.HLE.ryujinxXCIIcon.png")) RyujinxNsoIcon = GetResourceBytes("Ryujinx.HLE.ryujinxNSOIcon.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(); }
}
// Builds the applications list with paths to found applications // Builds the applications list with paths to found applications
List<string> applications = new List<string>(); 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) private static IFileSystem GetControlFs(PartitionFileSystem Pfs)
{ {
Nca controlNca = null; Nca controlNca = null;
@ -331,8 +331,7 @@ namespace Ryujinx.HLE
try try
{ {
string[] playedData = new string[2]; string[] playedData = new string[2];
string appdataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); string savePath = Path.Combine(VirtualFileSystem.UserNandPath, "save", "0000000000000000", UserId, TitleId);
string savePath = Path.Combine(appdataPath, "RyuFs", "nand", "user", "save", "0000000000000000", UserId, TitleId);
if (File.Exists(Path.Combine(savePath, "TimePlayed.dat")) == false) if (File.Exists(Path.Combine(savePath, "TimePlayed.dat")) == false)
{ {
@ -345,17 +344,20 @@ namespace Ryujinx.HLE
{ {
float timePlayed = float.Parse(sr.ReadLine()); float timePlayed = float.Parse(sr.ReadLine());
if (timePlayed <= 60.0) { playedData[0] = $"{timePlayed}s"; } if (timePlayed < SecondsPerMinute) { playedData[0] = $"{timePlayed}s"; }
else if (timePlayed <= 3600.0) { playedData[0] = $"{Math.Round(timePlayed / 60 , 2, MidpointRounding.AwayFromZero)} mins"; } else if (timePlayed < SecondsPerHour) { playedData[0] = $"{Math.Round(timePlayed / SecondsPerMinute, 2, MidpointRounding.AwayFromZero)} mins"; }
else if (timePlayed <= 86400.0) { playedData[0] = $"{Math.Round(timePlayed / 3600 , 2, MidpointRounding.AwayFromZero)} hrs"; } else if (timePlayed < SecondsPerDay) { playedData[0] = $"{Math.Round(timePlayed / SecondsPerHour , 2, MidpointRounding.AwayFromZero)} hrs"; }
else { playedData[0] = $"{Math.Round(timePlayed / 86400, 2, MidpointRounding.AwayFromZero)} days"; } else { playedData[0] = $"{Math.Round(timePlayed / SecondsPerDay , 2, MidpointRounding.AwayFromZero)} days"; }
} }
} }
if (File.Exists(Path.Combine(savePath, "LastPlayed.dat")) == false) if (File.Exists(Path.Combine(savePath, "LastPlayed.dat")) == false)
{ {
Directory.CreateDirectory(savePath); 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"))) using (FileStream fs = File.OpenRead(Path.Combine(savePath, "LastPlayed.dat")))
{ {

View file

@ -5,7 +5,7 @@ using System.IO;
namespace Ryujinx.HLE.FileSystem namespace Ryujinx.HLE.FileSystem
{ {
class VirtualFileSystem : IDisposable public class VirtualFileSystem : IDisposable
{ {
public const string BasePath = "RyuFs"; public const string BasePath = "RyuFs";
public const string NandPath = "nand"; public const string NandPath = "nand";
@ -60,7 +60,7 @@ namespace Ryujinx.HLE.FileSystem
public string GetSystemPath() => MakeDirAndGetFullPath(SystemPath); 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)); return MakeDirAndGetFullPath(SaveHelper.GetSavePath(save, context));
} }

View file

@ -13,8 +13,8 @@ namespace Ryujinx
{ {
Console.Title = "Ryujinx Console"; Console.Title = "Ryujinx Console";
string systemPATH = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.Machine); string systemPath = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.Machine);
Environment.SetEnvironmentVariable("Path", $"{Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "bin")};{systemPATH}"); Environment.SetEnvironmentVariable("Path", $"{Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "bin")};{systemPath}");
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit; AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;

View file

@ -24,7 +24,7 @@
<EmbeddedResource Include="Ui\assets\GitHubLogo.png" /> <EmbeddedResource Include="Ui\assets\GitHubLogo.png" />
<EmbeddedResource Include="Ui\assets\JoyCon.png" /> <EmbeddedResource Include="Ui\assets\JoyCon.png" />
<EmbeddedResource Include="Ui\assets\PatreonLogo.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\assets\TwitterLogo.png" />
<EmbeddedResource Include="Ui\MainWindow.glade" /> <EmbeddedResource Include="Ui\MainWindow.glade" />
<EmbeddedResource Include="Ui\SwitchSettings.glade" /> <EmbeddedResource Include="Ui\SwitchSettings.glade" />

View file

@ -6,6 +6,7 @@ using Ryujinx.Common.Logging;
using Ryujinx.Graphics.Gal; using Ryujinx.Graphics.Gal;
using Ryujinx.Graphics.Gal.OpenGL; using Ryujinx.Graphics.Gal.OpenGL;
using Ryujinx.HLE; using Ryujinx.HLE;
using Ryujinx.HLE.FileSystem;
using Ryujinx.Profiler; using Ryujinx.Profiler;
using System; using System;
using System.Diagnostics; using System.Diagnostics;
@ -33,14 +34,14 @@ namespace Ryujinx.UI
private static Application _gtkapp; 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 #pragma warning disable 649
[GUI] Window MainWin; [GUI] Window MainWin;
[GUI] CheckMenuItem FullScreen; [GUI] CheckMenuItem FullScreen;
[GUI] MenuItem ReturnMain; [GUI] MenuItem StopEmulation;
[GUI] MenuItem Nfc; [GUI] MenuItem Nfc;
[GUI] Box Box; [GUI] Box Box;
[GUI] TreeView GameTable; [GUI] TreeView GameTable;
@ -88,14 +89,14 @@ namespace Ryujinx.UI
} }
builder.Autoconnect(this); 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) if (args.Length == 1)
{ {
// Temporary code section start, remove this section when game is rendered to the GLArea in the GUI // Temporary code section start, remove this section when game is rendered to the GLArea in the GUI
Box.Remove(GlScreen); Box.Remove(GlScreen);
Nfc.Sensitive = false; Nfc.Sensitive = false;
ReturnMain.Sensitive = false; StopEmulation.Sensitive = false;
if (SwitchSettings.SwitchConfig.GuiColumns[0]) { GameTable.AppendColumn("Icon" , new CellRendererPixbuf(), "pixbuf", 0); } 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[1]) { GameTable.AppendColumn("Application", new CellRendererText() , "text" , 1); }
if (SwitchSettings.SwitchConfig.GuiColumns[2]) { GameTable.AppendColumn("Developer" , new CellRendererText() , "text" , 2); } 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[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[7]) { GameTable.AppendColumn("File Size" , new CellRendererText() , "text" , 7); }
if (SwitchSettings.SwitchConfig.GuiColumns[8]) { GameTable.AppendColumn("Path" , new CellRendererText() , "text" , 8); } 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)); _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; GameTable.Model = _tableStore;
UpdateGameTable(); UpdateGameTable();
// Temporary code section end // Temporary code section end
@ -116,8 +117,8 @@ namespace Ryujinx.UI
{ {
Box.Remove(GlScreen); Box.Remove(GlScreen);
Nfc.Sensitive = false; Nfc.Sensitive = false;
ReturnMain.Sensitive = false; StopEmulation.Sensitive = false;
if (SwitchSettings.SwitchConfig.GuiColumns[0]) { GameTable.AppendColumn("Icon" , new CellRendererPixbuf(), "pixbuf", 0); } 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[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[7]) { GameTable.AppendColumn("File Size" , new CellRendererText() , "text" , 7); }
if (SwitchSettings.SwitchConfig.GuiColumns[8]) { GameTable.AppendColumn("Path" , new CellRendererText() , "text" , 8); } 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)); _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; GameTable.Model = _tableStore;
UpdateGameTable(); 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() public static void UpdateGameTable()
{ {
_TableStore.Clear(); _tableStore.Clear();
ApplicationLibrary.Init(SwitchSettings.SwitchConfig.GameDirs, _device.System.KeySet, _device.System.State.DesiredTitleLanguage); ApplicationLibrary.Init(SwitchSettings.SwitchConfig.GameDirs, _device.System.KeySet, _device.System.State.DesiredTitleLanguage);
foreach (ApplicationLibrary.ApplicationData AppData in ApplicationLibrary.ApplicationLibraryData) 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) 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"); CreateErrorDialog("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();
} }
else else
{ {
@ -243,8 +249,8 @@ namespace Ryujinx.UI
new Thread(new ThreadStart(CreateGameWindow)).Start(); new Thread(new ThreadStart(CreateGameWindow)).Start();
_GameLoaded = true; _gameLoaded = true;
ReturnMain.Sensitive = true; StopEmulation.Sensitive = true;
if (DiscordIntegrationEnabled) if (DiscordIntegrationEnabled)
{ {
@ -265,8 +271,7 @@ namespace Ryujinx.UI
string userId = "00000000000000000000000000000001"; string userId = "00000000000000000000000000000001";
try try
{ {
string appdataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); string savePath = System.IO.Path.Combine(VirtualFileSystem.UserNandPath, "save", "0000000000000000", userId, _device.System.TitleID);
string savePath = System.IO.Path.Combine(appdataPath, "RyuFs", "nand", "user", "save", "0000000000000000", userId, _device.System.TitleID);
if (File.Exists(System.IO.Path.Combine(savePath, "TimePlayed.dat")) == false) if (File.Exists(System.IO.Path.Combine(savePath, "TimePlayed.dat")) == false)
{ {
@ -306,12 +311,11 @@ namespace Ryujinx.UI
private static void End() private static void End()
{ {
string userId = "00000000000000000000000000000001"; string userId = "00000000000000000000000000000001";
if (_GameLoaded) if (_gameLoaded)
{ {
try try
{ {
string appdataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); string savePath = System.IO.Path.Combine(VirtualFileSystem.UserNandPath, "save", "0000000000000000", userId, _device.System.TitleID);
string savePath = System.IO.Path.Combine(appdataPath, "RyuFs", "nand", "user", "save", "0000000000000000", userId, _device.System.TitleID);
double currentPlayTime = 0; double currentPlayTime = 0;
using (FileStream fs = File.OpenRead(System.IO.Path.Combine(savePath, "LastPlayed.dat"))) using (FileStream fs = File.OpenRead(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
@ -351,12 +355,32 @@ namespace Ryujinx.UI
Logger.Shutdown(); Logger.Shutdown();
Environment.Exit(0); 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 //Events
private void Row_Activated(object o, RowActivatedArgs args) private void Row_Activated(object o, RowActivatedArgs args)
{ {
_TableStore.GetIter(out TreeIter treeiter, new TreePath(args.Path.ToString())); _tableStore.GetIter(out TreeIter treeiter, new TreePath(args.Path.ToString()));
string path = (string)_TableStore.GetValue(treeiter, 8); string path = (string)_tableStore.GetValue(treeiter, 8);
LoadApplication(path); LoadApplication(path);
} }
@ -406,7 +430,7 @@ namespace Ryujinx.UI
private void Window_Close(object o, DeleteEventArgs args) { End(); } 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 // TODO: Write logic to kill running game
} }
@ -445,25 +469,5 @@ namespace Ryujinx.UI
_gtkapp.AddWindow(AboutWin); _gtkapp.AddWindow(AboutWin);
AboutWin.Show(); 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();
}
}
} }
} }

View file

@ -101,12 +101,12 @@
</object> </object>
</child> </child>
<child> <child>
<object class="GtkMenuItem" id="ReturnMain"> <object class="GtkMenuItem" id="StopEmulation">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</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> <property name="use_underline">True</property>
<signal name="activate" handler="ReturnMain_Pressed" swapped="no"/> <signal name="activate" handler="StopEmulation_Pressed" swapped="no"/>
</object> </object>
</child> </child>
<child> <child>

View file

@ -17,9 +17,9 @@ namespace Ryujinx.UI
internal HLE.Switch Device { get; set; } 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 #pragma warning disable 649
[GUI] Window SettingsWin; [GUI] Window SettingsWin;
@ -40,7 +40,7 @@ namespace Ryujinx.UI
[GUI] CheckButton FileLogToggle; [GUI] CheckButton FileLogToggle;
[GUI] CheckButton GuestLogToggle; [GUI] CheckButton GuestLogToggle;
[GUI] CheckButton FsAccessLogToggle; [GUI] CheckButton FsAccessLogToggle;
[GUI] Adjustment FGALMSpinAdjustment; [GUI] Adjustment FsLogSpinAdjustment;
[GUI] CheckButton DockedModeToggle; [GUI] CheckButton DockedModeToggle;
[GUI] CheckButton DiscordToggle; [GUI] CheckButton DiscordToggle;
[GUI] CheckButton VSyncToggle; [GUI] CheckButton VSyncToggle;
@ -100,7 +100,7 @@ namespace Ryujinx.UI
builder.Autoconnect(this); 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); ControllerImage.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.JoyCon.png", 500, 500);
//Bind Events //Bind Events
@ -186,42 +186,48 @@ namespace Ryujinx.UI
CustThemeDir.Buffer.Text = SwitchConfig.CustomThemePath; CustThemeDir.Buffer.Text = SwitchConfig.CustomThemePath;
GraphicsShadersDumpPath.Buffer.Text = SwitchConfig.GraphicsShadersDumpPath; GraphicsShadersDumpPath.Buffer.Text = SwitchConfig.GraphicsShadersDumpPath;
FGALMSpinAdjustment.Value = SwitchConfig.FsGlobalAccessLogMode; FsLogSpinAdjustment.Value = SwitchConfig.FsGlobalAccessLogMode;
GameDirsBox.AppendColumn("", new CellRendererText(), "text", 0); GameDirsBox.AppendColumn("", new CellRendererText(), "text", 0);
_GameDirsBoxStore = new ListStore(typeof(string)); _gameDirsBoxStore = new ListStore(typeof(string));
GameDirsBox.Model = _GameDirsBoxStore; GameDirsBox.Model = _gameDirsBoxStore;
foreach (string GameDir in SwitchConfig.GameDirs) 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"); LogPath.Buffer.Text = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Ryujinx.log");
_ListeningForKeypress = false; _listeningForKeypress = false;
} }
//Events //Events
private void Button_Pressed(object obj, EventArgs args, ToggleButton Button) private void Button_Pressed(object obj, EventArgs args, ToggleButton Button)
{ {
if (_ListeningForKeypress == false) if (_listeningForKeypress == false)
{ {
KeyPressEvent += On_KeyPress; KeyPressEvent += On_KeyPress;
_ListeningForKeypress = true; _listeningForKeypress = true;
void On_KeyPress(object Obj, KeyPressEventArgs KeyPressed) 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); } if (Enum.IsDefined(typeof(OpenTK.Input.Key), capKey)) { Button.Label = capKey; }
else if (GdkToTKInput.ContainsKey(key)) { Button.Label = GdkToTKInput[key]; } else if (GdkToOpenTKInput.ContainsKey(key)) { Button.Label = GdkToOpenTKInput[key]; }
else { Button.Label = "Space"; } else { Button.Label = "Space"; }
Button.SetStateFlags(0, true); Button.SetStateFlags(0, true);
KeyPressEvent -= On_KeyPress; KeyPressEvent -= On_KeyPress;
_ListeningForKeypress = false; _listeningForKeypress = false;
} }
} }
else { Button.SetStateFlags(0, true); } else { Button.SetStateFlags(0, true); }
@ -229,7 +235,7 @@ namespace Ryujinx.UI
private void AddDir_Pressed(object obj, EventArgs args) 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); AddDir.SetStateFlags(0, true);
} }
@ -240,7 +246,7 @@ namespace Ryujinx.UI
if (fc.Run() == (int)ResponseType.Accept) if (fc.Run() == (int)ResponseType.Accept)
{ {
_GameDirsBoxStore.AppendValues(fc.Filename); _gameDirsBoxStore.AppendValues(fc.Filename);
} }
fc.Destroy(); fc.Destroy();
@ -253,14 +259,25 @@ namespace Ryujinx.UI
TreeSelection selection = GameDirsBox.Selection; TreeSelection selection = GameDirsBox.Selection;
selection.GetSelected(out TreeIter treeiter); selection.GetSelected(out TreeIter treeiter);
_GameDirsBoxStore.Remove(ref treeiter); _gameDirsBoxStore.Remove(ref treeiter);
RemoveDir.SetStateFlags(0, true); RemoveDir.SetStateFlags(0, true);
} }
private void CustThemeToggle_Activated(object obj, EventArgs args) 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) private void BrowseThemeDir_Pressed(object obj, EventArgs args)
@ -283,67 +300,69 @@ namespace Ryujinx.UI
{ {
List<string> gameDirs = new List<string>(); List<string> gameDirs = new List<string>();
_GameDirsBoxStore.GetIterFirst(out TreeIter iter); _gameDirsBoxStore.GetIterFirst(out TreeIter iter);
for (int i = 0; i < _GameDirsBoxStore.IterNChildren(); i++) 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 (IconToggle.Active) SwitchConfig.GuiColumns[0] = true;
if (TitleToggle.Active) { SwitchConfig.GuiColumns[1] = true; } if (TitleToggle.Active) SwitchConfig.GuiColumns[1] = true;
if (DeveloperToggle.Active) { SwitchConfig.GuiColumns[2] = true; } if (DeveloperToggle.Active) SwitchConfig.GuiColumns[2] = true;
if (VersionToggle.Active) { SwitchConfig.GuiColumns[3] = true; } if (VersionToggle.Active) SwitchConfig.GuiColumns[3] = true;
if (TimePlayedToggle.Active) { SwitchConfig.GuiColumns[4] = true; } if (TimePlayedToggle.Active) SwitchConfig.GuiColumns[4] = true;
if (LastPlayedToggle.Active) { SwitchConfig.GuiColumns[5] = true; } if (LastPlayedToggle.Active) SwitchConfig.GuiColumns[5] = true;
if (FileExtToggle.Active) { SwitchConfig.GuiColumns[6] = true; } if (FileExtToggle.Active) SwitchConfig.GuiColumns[6] = true;
if (FileSizeToggle.Active) { SwitchConfig.GuiColumns[7] = true; } if (FileSizeToggle.Active) SwitchConfig.GuiColumns[7] = true;
if (PathToggle.Active) { SwitchConfig.GuiColumns[8] = true; } if (PathToggle.Active) SwitchConfig.GuiColumns[8] = true;
if (ErrorLogToggle.Active) { SwitchConfig.LoggingEnableError = true; } if (ErrorLogToggle.Active) SwitchConfig.LoggingEnableError = true;
if (WarningLogToggle.Active) { SwitchConfig.LoggingEnableWarn = true; } if (WarningLogToggle.Active) SwitchConfig.LoggingEnableWarn = true;
if (InfoLogToggle.Active) { SwitchConfig.LoggingEnableInfo = true; } if (InfoLogToggle.Active) SwitchConfig.LoggingEnableInfo = true;
if (StubLogToggle.Active) { SwitchConfig.LoggingEnableStub = true; } if (StubLogToggle.Active) SwitchConfig.LoggingEnableStub = true;
if (DebugLogToggle.Active) { SwitchConfig.LoggingEnableDebug = true; } if (DebugLogToggle.Active) SwitchConfig.LoggingEnableDebug = true;
if (GuestLogToggle.Active) { SwitchConfig.LoggingEnableGuest = true; } if (GuestLogToggle.Active) SwitchConfig.LoggingEnableGuest = true;
if (FsAccessLogToggle.Active) { SwitchConfig.LoggingEnableFsAccessLog = true; } if (FsAccessLogToggle.Active) SwitchConfig.LoggingEnableFsAccessLog = true;
if (FileLogToggle.Active) { SwitchConfig.EnableFileLog = true; } if (FileLogToggle.Active) SwitchConfig.EnableFileLog = true;
if (DockedModeToggle.Active) { SwitchConfig.DockedMode = true; } if (DockedModeToggle.Active) SwitchConfig.DockedMode = true;
if (DiscordToggle.Active) { SwitchConfig.EnableDiscordIntegration = true; } if (DiscordToggle.Active) SwitchConfig.EnableDiscordIntegration = true;
if (VSyncToggle.Active) { SwitchConfig.EnableVsync = true; } if (VSyncToggle.Active) SwitchConfig.EnableVsync = true;
if (MultiSchedToggle.Active) { SwitchConfig.EnableMulticoreScheduling = true; } if (MultiSchedToggle.Active) SwitchConfig.EnableMulticoreScheduling = true;
if (FSICToggle.Active) { SwitchConfig.EnableFsIntegrityChecks = true; } if (FSICToggle.Active) SwitchConfig.EnableFsIntegrityChecks = true;
if (AggrToggle.Active) { SwitchConfig.EnableAggressiveCpuOpts = true; } if (AggrToggle.Active) SwitchConfig.EnableAggressiveCpuOpts = true;
if (IgnoreToggle.Active) { SwitchConfig.IgnoreMissingServices = true; } if (IgnoreToggle.Active) SwitchConfig.IgnoreMissingServices = true;
if (DirectKeyboardAccess.Active) { SwitchConfig.EnableKeyboard = true; } if (DirectKeyboardAccess.Active) SwitchConfig.EnableKeyboard = true;
if (CustThemeToggle.Active) { SwitchConfig.EnableCustomTheme = true; } if (CustThemeToggle.Active) SwitchConfig.EnableCustomTheme = true;
if (IconToggle.Active == false) { SwitchConfig.GuiColumns[0] = false; } if (!IconToggle.Active) SwitchConfig.GuiColumns[0] = false;
if (TitleToggle.Active == false) { SwitchConfig.GuiColumns[1] = false; } if (!TitleToggle.Active) SwitchConfig.GuiColumns[1] = false;
if (DeveloperToggle.Active == false) { SwitchConfig.GuiColumns[2] = false; } if (!DeveloperToggle.Active) SwitchConfig.GuiColumns[2] = false;
if (VersionToggle.Active == false) { SwitchConfig.GuiColumns[3] = false; } if (!VersionToggle.Active) SwitchConfig.GuiColumns[3] = false;
if (TimePlayedToggle.Active == false) { SwitchConfig.GuiColumns[4] = false; } if (!TimePlayedToggle.Active) SwitchConfig.GuiColumns[4] = false;
if (LastPlayedToggle.Active == false) { SwitchConfig.GuiColumns[5] = false; } if (!LastPlayedToggle.Active) SwitchConfig.GuiColumns[5] = false;
if (FileExtToggle.Active == false) { SwitchConfig.GuiColumns[6] = false; } if (!FileExtToggle.Active) SwitchConfig.GuiColumns[6] = false;
if (FileSizeToggle.Active == false) { SwitchConfig.GuiColumns[7] = false; } if (!FileSizeToggle.Active) SwitchConfig.GuiColumns[7] = false;
if (PathToggle.Active == false) { SwitchConfig.GuiColumns[8] = false; } if (!PathToggle.Active) SwitchConfig.GuiColumns[8] = false;
if (ErrorLogToggle.Active == false) { SwitchConfig.LoggingEnableError = false; } if (!ErrorLogToggle.Active) SwitchConfig.LoggingEnableError = false;
if (WarningLogToggle.Active == false) { SwitchConfig.LoggingEnableWarn = false; } if (!WarningLogToggle.Active) SwitchConfig.LoggingEnableWarn = false;
if (InfoLogToggle.Active == false) { SwitchConfig.LoggingEnableInfo = false; } if (!InfoLogToggle.Active) SwitchConfig.LoggingEnableInfo = false;
if (StubLogToggle.Active == false) { SwitchConfig.LoggingEnableStub = false; } if (!StubLogToggle.Active ) SwitchConfig.LoggingEnableStub = false;
if (DebugLogToggle.Active == false) { SwitchConfig.LoggingEnableDebug = false; } if (!DebugLogToggle.Active) SwitchConfig.LoggingEnableDebug = false;
if (FileLogToggle.Active == false) { SwitchConfig.EnableFileLog = false; } if (!GuestLogToggle.Active) SwitchConfig.LoggingEnableGuest = false;
if (DockedModeToggle.Active == false) { SwitchConfig.DockedMode = false; } if (!FsAccessLogToggle.Active) SwitchConfig.LoggingEnableFsAccessLog = false;
if (DiscordToggle.Active == false) { SwitchConfig.EnableDiscordIntegration = false; } if (!FileLogToggle.Active) SwitchConfig.EnableFileLog = false;
if (VSyncToggle.Active == false) { SwitchConfig.EnableVsync = false; } if (!DockedModeToggle.Active) SwitchConfig.DockedMode = false;
if (MultiSchedToggle.Active == false) { SwitchConfig.EnableMulticoreScheduling = false; } if (!DiscordToggle.Active) SwitchConfig.EnableDiscordIntegration = false;
if (FSICToggle.Active == false) { SwitchConfig.EnableFsIntegrityChecks = false; } if (!VSyncToggle.Active) SwitchConfig.EnableVsync = false;
if (AggrToggle.Active == false) { SwitchConfig.EnableAggressiveCpuOpts = false; } if (!MultiSchedToggle.Active) SwitchConfig.EnableMulticoreScheduling = false;
if (IgnoreToggle.Active == false) { SwitchConfig.IgnoreMissingServices = false; } if (!FSICToggle.Active) SwitchConfig.EnableFsIntegrityChecks = false;
if (DirectKeyboardAccess.Active == false) { SwitchConfig.EnableKeyboard = false; } if (!AggrToggle.Active) SwitchConfig.EnableAggressiveCpuOpts = false;
if (CustThemeToggle.Active == false) { SwitchConfig.EnableCustomTheme = false; } if (!IgnoreToggle.Active) SwitchConfig.IgnoreMissingServices = false;
if (!DirectKeyboardAccess.Active) SwitchConfig.EnableKeyboard = false;
if (!CustThemeToggle.Active) SwitchConfig.EnableCustomTheme = false;
SwitchConfig.KeyboardControls.LeftJoycon = new NpadKeyboardLeft() SwitchConfig.KeyboardControls.LeftJoycon = new NpadKeyboardLeft()
{ {
@ -382,7 +401,7 @@ namespace Ryujinx.UI
SwitchConfig.CustomThemePath = CustThemeDir.Buffer.Text; SwitchConfig.CustomThemePath = CustThemeDir.Buffer.Text;
SwitchConfig.GraphicsShadersDumpPath = GraphicsShadersDumpPath.Buffer.Text; SwitchConfig.GraphicsShadersDumpPath = GraphicsShadersDumpPath.Buffer.Text;
SwitchConfig.GameDirs = gameDirs; 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.SaveConfig(SwitchConfig, System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json"));
Configuration.Configure(Device, SwitchConfig); Configuration.Configure(Device, SwitchConfig);
@ -397,7 +416,7 @@ namespace Ryujinx.UI
Destroy(); 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_0" , "Number0" },
{ "Key_1" , "Number1" }, { "Key_1" , "Number1" },

View file

@ -2,7 +2,7 @@
<!-- Generated with glade 3.22.1 --> <!-- Generated with glade 3.22.1 -->
<interface> <interface>
<requires lib="gtk+" version="3.20"/> <requires lib="gtk+" version="3.20"/>
<object class="GtkAdjustment" id="FGALMSpinAdjustment"> <object class="GtkAdjustment" id="FsLogSpinAdjustment">
<property name="upper">3</property> <property name="upper">3</property>
<property name="step_increment">1</property> <property name="step_increment">1</property>
<property name="page_increment">10</property> <property name="page_increment">10</property>
@ -2039,7 +2039,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">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="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> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>