Added 'Open Ryujinx Folder' button to the file menu and did some small fixes
This commit is contained in:
parent
a42993d11d
commit
55eba3087f
5 changed files with 66 additions and 28 deletions
|
@ -39,7 +39,6 @@ namespace Ryujinx
|
||||||
|
|
||||||
public static void Init(List<string> AppDirs, Keyset keySet, HLE.HOS.SystemState.TitleLanguage desiredTitleLanguage)
|
public static void Init(List<string> AppDirs, Keyset keySet, HLE.HOS.SystemState.TitleLanguage desiredTitleLanguage)
|
||||||
{
|
{
|
||||||
// Load Variables
|
|
||||||
KeySet = keySet;
|
KeySet = keySet;
|
||||||
DesiredTitleLanguage = desiredTitleLanguage;
|
DesiredTitleLanguage = desiredTitleLanguage;
|
||||||
|
|
||||||
|
@ -129,9 +128,9 @@ namespace Ryujinx
|
||||||
titleName = controlData.Descriptions.ToList().Find(x => !string.IsNullOrWhiteSpace(x.Title)).Title;
|
titleName = controlData.Descriptions.ToList().Find(x => !string.IsNullOrWhiteSpace(x.Title)).Title;
|
||||||
}
|
}
|
||||||
|
|
||||||
titleId = controlData.PresenceGroupId.ToString("X16");
|
titleId = controlData.PresenceGroupId.ToString("x16");
|
||||||
if (string.IsNullOrWhiteSpace(titleId)) { titleId = controlData.SaveDataOwnerId.ToString("X16"); }
|
if (string.IsNullOrWhiteSpace(titleId)) { titleId = controlData.SaveDataOwnerId.ToString("x16"); }
|
||||||
if (string.IsNullOrWhiteSpace(titleId)) { titleId = (controlData.AddOnContentBaseId - 0x1000).ToString("X16"); }
|
if (string.IsNullOrWhiteSpace(titleId)) { titleId = (controlData.AddOnContentBaseId - 0x1000).ToString("x16"); }
|
||||||
|
|
||||||
developer = controlData.Descriptions[(int)DesiredTitleLanguage].Developer;
|
developer = controlData.Descriptions[(int)DesiredTitleLanguage].Developer;
|
||||||
if (string.IsNullOrWhiteSpace(developer))
|
if (string.IsNullOrWhiteSpace(developer))
|
||||||
|
@ -209,9 +208,9 @@ namespace Ryujinx
|
||||||
titleName = controlData.Descriptions.ToList().Find(x => !string.IsNullOrWhiteSpace(x.Title)).Title;
|
titleName = controlData.Descriptions.ToList().Find(x => !string.IsNullOrWhiteSpace(x.Title)).Title;
|
||||||
}
|
}
|
||||||
|
|
||||||
titleId = controlData.PresenceGroupId.ToString("X16");
|
titleId = controlData.PresenceGroupId.ToString("x16");
|
||||||
if (string.IsNullOrWhiteSpace(titleId)) { titleId = controlData.SaveDataOwnerId.ToString("X16"); }
|
if (string.IsNullOrWhiteSpace(titleId)) { titleId = controlData.SaveDataOwnerId.ToString("x16"); }
|
||||||
if (string.IsNullOrWhiteSpace(titleId)) { titleId = (controlData.AddOnContentBaseId - 0x1000).ToString("X16"); }
|
if (string.IsNullOrWhiteSpace(titleId)) { titleId = (controlData.AddOnContentBaseId - 0x1000).ToString("x16"); }
|
||||||
|
|
||||||
developer = controlData.Descriptions[(int)DesiredTitleLanguage].Developer;
|
developer = controlData.Descriptions[(int)DesiredTitleLanguage].Developer;
|
||||||
if (string.IsNullOrWhiteSpace(developer))
|
if (string.IsNullOrWhiteSpace(developer))
|
||||||
|
@ -240,6 +239,8 @@ namespace Ryujinx
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string[] playedData = GetPlayedData(titleId, "00000000000000000000000000000001");
|
||||||
|
|
||||||
ApplicationData data = new ApplicationData()
|
ApplicationData data = new ApplicationData()
|
||||||
{
|
{
|
||||||
Icon = applicationIcon,
|
Icon = applicationIcon,
|
||||||
|
@ -247,8 +248,8 @@ namespace Ryujinx
|
||||||
TitleId = titleId,
|
TitleId = titleId,
|
||||||
Developer = developer,
|
Developer = developer,
|
||||||
Version = version,
|
Version = version,
|
||||||
TimePlayed = GetPlayedData(titleId)[0],
|
TimePlayed = playedData[0],
|
||||||
LastPlayed = GetPlayedData(titleId)[1],
|
LastPlayed = playedData[1],
|
||||||
FileSize = (filesize < 1) ? (filesize * 1024).ToString("0.##") + "MB" : filesize.ToString("0.##") + "GB",
|
FileSize = (filesize < 1) ? (filesize * 1024).ToString("0.##") + "MB" : filesize.ToString("0.##") + "GB",
|
||||||
Path = applicationPath,
|
Path = applicationPath,
|
||||||
};
|
};
|
||||||
|
@ -286,11 +287,11 @@ namespace Ryujinx
|
||||||
return controlNca.OpenFileSystem(NcaSectionType.Data, IntegrityCheckLevel.None);
|
return controlNca.OpenFileSystem(NcaSectionType.Data, IntegrityCheckLevel.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string[] GetPlayedData(string TitleId)
|
private static string[] GetPlayedData(string TitleId, string UserId)
|
||||||
{
|
{
|
||||||
string[] playedData = new string[2];
|
string[] playedData = new string[2];
|
||||||
string appdataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
string appdataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
||||||
string savePath = Path.Combine(appdataPath, "RyuFs", "nand", "user", "save", "0000000000000000", "savecommon", 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)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,9 +4,9 @@ using System.Text;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.Loaders.Npdm
|
namespace Ryujinx.HLE.Loaders.Npdm
|
||||||
{
|
{
|
||||||
//https://github.com/SciresM/hactool/blob/master/npdm.c
|
// https://github.com/SciresM/hactool/blob/master/npdm.c
|
||||||
//https://github.com/SciresM/hactool/blob/master/npdm.h
|
// https://github.com/SciresM/hactool/blob/master/npdm.h
|
||||||
//http://switchbrew.org/index.php?title=NPDM
|
// http://switchbrew.org/index.php?title=NPDM
|
||||||
class Npdm
|
class Npdm
|
||||||
{
|
{
|
||||||
private const int MetaMagic = 'M' << 0 | 'E' << 8 | 'T' << 16 | 'A' << 24;
|
private const int MetaMagic = 'M' << 0 | 'E' << 8 | 'T' << 16 | 'A' << 24;
|
||||||
|
|
|
@ -7,6 +7,7 @@ using Ryujinx.Graphics.Gal;
|
||||||
using Ryujinx.Graphics.Gal.OpenGL;
|
using Ryujinx.Graphics.Gal.OpenGL;
|
||||||
using Ryujinx.Profiler;
|
using Ryujinx.Profiler;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
@ -182,7 +183,7 @@ namespace Ryujinx.UI
|
||||||
MessageDialog eRrOr = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, "A game has already been loaded, please unload the game and try again");
|
MessageDialog eRrOr = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, "A game has already been loaded, please unload the game and try again");
|
||||||
eRrOr.SetSizeRequest(100, 20);
|
eRrOr.SetSizeRequest(100, 20);
|
||||||
eRrOr.Title = "Ryujinx - Error";
|
eRrOr.Title = "Ryujinx - Error";
|
||||||
eRrOr.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.GUI.assets.ryujinxIcon.png");
|
eRrOr.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.ryujinxIcon.png");
|
||||||
eRrOr.WindowPosition = WindowPosition.Center;
|
eRrOr.WindowPosition = WindowPosition.Center;
|
||||||
eRrOr.Run();
|
eRrOr.Run();
|
||||||
eRrOr.Destroy();
|
eRrOr.Destroy();
|
||||||
|
@ -262,10 +263,11 @@ namespace Ryujinx.UI
|
||||||
DiscordClient.SetPresence(DiscordPresence);
|
DiscordClient.SetPresence(DiscordPresence);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_device.System.TitleID != null)
|
string userId = "00000000000000000000000000000001";
|
||||||
|
try
|
||||||
{
|
{
|
||||||
string appdataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
string appdataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
||||||
string savePath = System.IO.Path.Combine(appdataPath, "RyuFs", "nand", "user", "save", "0000000000000000", "savecommon", _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)
|
||||||
{
|
{
|
||||||
|
@ -275,15 +277,20 @@ namespace Ryujinx.UI
|
||||||
if (File.Exists(System.IO.Path.Combine(savePath, "LastPlayed.dat")) == false)
|
if (File.Exists(System.IO.Path.Combine(savePath, "LastPlayed.dat")) == false)
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(savePath);
|
Directory.CreateDirectory(savePath);
|
||||||
using (FileStream file = File.OpenWrite(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
|
using (FileStream file = File.OpenWrite(System.IO.Path.Combine(savePath, "LastPlayed.dat"))) { file.Write(Encoding.ASCII.GetBytes("Never")); }
|
||||||
|
}
|
||||||
|
using (FileStream fs = File.OpenWrite(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
|
||||||
|
{
|
||||||
|
using (StreamWriter sr = new StreamWriter(fs))
|
||||||
{
|
{
|
||||||
using (StreamWriter sr = new StreamWriter(file))
|
sr.WriteLine(DateTime.UtcNow);
|
||||||
{
|
|
||||||
sr.WriteLine(DateTime.UtcNow);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (ArgumentNullException exception)
|
||||||
|
{
|
||||||
|
Logger.PrintError(LogClass.Application, $"Could not access save path to retrieve time/last played data using: UserID: {userId}, TitleID: {_device.System.TitleID}\nException: {exception}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,10 +304,11 @@ namespace Ryujinx.UI
|
||||||
|
|
||||||
private static void End()
|
private static void End()
|
||||||
{
|
{
|
||||||
if (_device.System.TitleID != null)
|
string userId = "00000000000000000000000000000001";
|
||||||
|
try
|
||||||
{
|
{
|
||||||
string appdataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
string appdataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
||||||
string savePath = System.IO.Path.Combine(appdataPath, "RyuFs", "nand", "user", "save", "0000000000000000", "savecommon", _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")))
|
||||||
|
@ -327,6 +335,10 @@ namespace Ryujinx.UI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (ArgumentNullException exception)
|
||||||
|
{
|
||||||
|
Logger.PrintError(LogClass.Application, $"Could not access save path to retrieve time/last played data using: UserID: {userId}, TitleID: {_device.System.TitleID}\nException: {exception}");
|
||||||
|
}
|
||||||
|
|
||||||
Profile.FinishProfiling();
|
Profile.FinishProfiling();
|
||||||
_device.Dispose();
|
_device.Dispose();
|
||||||
|
@ -337,7 +349,7 @@ namespace Ryujinx.UI
|
||||||
}
|
}
|
||||||
|
|
||||||
//Events
|
//Events
|
||||||
private void Row_Activated(object obj, 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, 7);
|
string path = (string)_TableStore.GetValue(treeiter, 7);
|
||||||
|
@ -384,6 +396,16 @@ namespace Ryujinx.UI
|
||||||
fc.Destroy();
|
fc.Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Open_Ryu_Folder(object o, EventArgs args)
|
||||||
|
{
|
||||||
|
Process.Start(new ProcessStartInfo()
|
||||||
|
{
|
||||||
|
FileName = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFs"),
|
||||||
|
UseShellExecute = true,
|
||||||
|
Verb = "open"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void Exit_Pressed(object o, EventArgs args) { End(); }
|
private void Exit_Pressed(object o, EventArgs args) { End(); }
|
||||||
|
|
||||||
private void Window_Close(object o, DeleteEventArgs args) { End(); }
|
private void Window_Close(object o, DeleteEventArgs args) { End(); }
|
||||||
|
|
|
@ -53,6 +53,21 @@
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkMenuItem" id="OpenRyuFolder">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Open Ryujinx Folder</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<signal name="activate" handler="Open_Ryu_Folder" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSeparatorMenuItem">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkMenuItem" id="Exit">
|
<object class="GtkMenuItem" id="Exit">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -168,8 +183,6 @@
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkScrolledWindow" id="GameTableWindow">
|
<object class="GtkScrolledWindow" id="GameTableWindow">
|
||||||
<property name="width_request">1280</property>
|
|
||||||
<property name="height_request">720</property>
|
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="shadow_type">in</property>
|
<property name="shadow_type">in</property>
|
||||||
|
@ -178,6 +191,8 @@
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="headers_clickable">False</property>
|
<property name="headers_clickable">False</property>
|
||||||
|
<property name="reorderable">True</property>
|
||||||
|
<property name="hover_selection">True</property>
|
||||||
<signal name="row-activated" handler="Row_Activated" swapped="no"/>
|
<signal name="row-activated" handler="Row_Activated" swapped="no"/>
|
||||||
<child internal-child="selection">
|
<child internal-child="selection">
|
||||||
<object class="GtkTreeSelection"/>
|
<object class="GtkTreeSelection"/>
|
||||||
|
|
|
@ -1393,7 +1393,7 @@
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel">
|
||||||
<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">Controller</property>
|
<property name="label" translatable="yes">Input</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue