Revert UI changes
This commit is contained in:
parent
3a3252507f
commit
64eacabe8f
4 changed files with 221 additions and 229 deletions
|
@ -111,7 +111,7 @@ namespace Ryujinx.HLE.HOS
|
|||
|
||||
public string TitleName { get; private set; }
|
||||
|
||||
public string TitleId { get; private set; }
|
||||
public string TitleID { get; private set; }
|
||||
|
||||
public IntegrityCheckLevel FsIntegrityCheckLevel { get; set; }
|
||||
|
||||
|
@ -507,7 +507,7 @@ namespace Ryujinx.HLE.HOS
|
|||
|
||||
LoadExeFs(codeFs, out Npdm metaData);
|
||||
|
||||
TitleId = metaData.Aci0.TitleId.ToString("x16");
|
||||
TitleID = metaData.Aci0.TitleId.ToString("x16");
|
||||
|
||||
if (controlNca != null)
|
||||
{
|
||||
|
@ -515,7 +515,7 @@ namespace Ryujinx.HLE.HOS
|
|||
}
|
||||
else
|
||||
{
|
||||
CurrentTitle = TitleId;
|
||||
CurrentTitle = TitleID;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -555,7 +555,7 @@ namespace Ryujinx.HLE.HOS
|
|||
}
|
||||
}
|
||||
|
||||
TitleId = CurrentTitle = metaData.Aci0.TitleId.ToString("x16");
|
||||
TitleID = CurrentTitle = metaData.Aci0.TitleId.ToString("x16");
|
||||
|
||||
LoadNso("rtld");
|
||||
LoadNso("main");
|
||||
|
@ -658,7 +658,7 @@ namespace Ryujinx.HLE.HOS
|
|||
ContentManager.LoadEntries();
|
||||
|
||||
TitleName = CurrentTitle = metaData.TitleName;
|
||||
TitleId = metaData.Aci0.TitleId.ToString("x16");
|
||||
TitleID = metaData.Aci0.TitleId.ToString("x16");
|
||||
|
||||
ProgramLoader.LoadStaticObjects(this, metaData, new IExecutable[] { staticObject });
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace Ryujinx.HLE.HOS.Services.Arp
|
|||
|
||||
return new ApplicationLaunchProperty
|
||||
{
|
||||
TitleId = BitConverter.ToInt64(StringUtils.HexToBytes(context.Device.System.TitleId), 0),
|
||||
TitleId = BitConverter.ToInt64(StringUtils.HexToBytes(context.Device.System.TitleID), 0),
|
||||
Version = 0x00,
|
||||
BaseGameStorageId = (byte)StorageId.NandSystem,
|
||||
UpdateGameStorageId = (byte)StorageId.None
|
||||
|
|
|
@ -327,7 +327,7 @@ namespace Ryujinx.UI
|
|||
Version = version,
|
||||
TimePlayed = playedData[0],
|
||||
LastPlayed = playedData[1],
|
||||
FileExt = Path.GetExtension(applicationPath).ToUpper().Remove(0, 1),
|
||||
FileExt = Path.GetExtension(applicationPath).ToUpper().Remove(0 ,1),
|
||||
FileSize = (filesize < 1) ? (filesize * 1024).ToString("0.##") + "MB" : filesize.ToString("0.##") + "GB",
|
||||
Path = applicationPath,
|
||||
};
|
||||
|
@ -381,72 +381,68 @@ namespace Ryujinx.UI
|
|||
}
|
||||
|
||||
private static string[] GetPlayedData(string TitleId, string UserId)
|
||||
{
|
||||
try
|
||||
{
|
||||
string[] playedData = new string[2];
|
||||
string savePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFS", "nand", "user", "save", "0000000000000000", UserId, TitleId);
|
||||
|
||||
if (File.Exists(Path.Combine(savePath, "TimePlayed.dat")) == false)
|
||||
{
|
||||
Directory.CreateDirectory(savePath);
|
||||
using (FileStream file = File.OpenWrite(Path.Combine(savePath, "TimePlayed.dat")))
|
||||
{
|
||||
file.Write(Encoding.ASCII.GetBytes("0"));
|
||||
}
|
||||
}
|
||||
using (FileStream fs = File.OpenRead(Path.Combine(savePath, "TimePlayed.dat")))
|
||||
{
|
||||
using (StreamReader sr = new StreamReader(fs))
|
||||
{
|
||||
float timePlayed = float.Parse(sr.ReadLine());
|
||||
|
||||
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 fs = File.OpenRead(Path.Combine(savePath, "LastPlayed.dat")))
|
||||
{
|
||||
using (StreamReader sr = new StreamReader(fs))
|
||||
{
|
||||
playedData[1] = sr.ReadLine();
|
||||
}
|
||||
}
|
||||
|
||||
return playedData;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return new string[] { "Unknown", "Unknown" };
|
||||
|
||||
// TODO: Update GUI to store these files in another location
|
||||
|
||||
//try
|
||||
//{
|
||||
// string[] playedData = new string[2];
|
||||
// string savePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFS", "nand", "user", "save", "0000000000000000", UserId, TitleId);
|
||||
|
||||
// if (File.Exists(Path.Combine(savePath, "TimePlayed.dat")) == false)
|
||||
// {
|
||||
// Directory.CreateDirectory(savePath);
|
||||
// using (FileStream file = File.OpenWrite(Path.Combine(savePath, "TimePlayed.dat")))
|
||||
// {
|
||||
// file.Write(Encoding.ASCII.GetBytes("0"));
|
||||
// }
|
||||
// }
|
||||
// using (FileStream fs = File.OpenRead(Path.Combine(savePath, "TimePlayed.dat")))
|
||||
// {
|
||||
// using (StreamReader sr = new StreamReader(fs))
|
||||
// {
|
||||
// float timePlayed = float.Parse(sr.ReadLine());
|
||||
|
||||
// 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 fs = File.OpenRead(Path.Combine(savePath, "LastPlayed.dat")))
|
||||
// {
|
||||
// using (StreamReader sr = new StreamReader(fs))
|
||||
// {
|
||||
// playedData[1] = sr.ReadLine();
|
||||
// }
|
||||
// }
|
||||
|
||||
// return playedData;
|
||||
//}
|
||||
//catch
|
||||
//{
|
||||
// return new string[] { "Unknown", "Unknown" };
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
private static byte[] NspOrXciIcon(string applicationPath)
|
||||
|
|
|
@ -274,12 +274,12 @@ namespace Ryujinx.UI
|
|||
|
||||
if (DiscordIntegrationEnabled)
|
||||
{
|
||||
if (File.ReadAllLines(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "RPsupported.dat")).Contains(_device.System.TitleId))
|
||||
if (File.ReadAllLines(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "RPsupported.dat")).Contains(_device.System.TitleID))
|
||||
{
|
||||
DiscordPresence.Assets.LargeImageKey = _device.System.TitleId;
|
||||
DiscordPresence.Assets.LargeImageKey = _device.System.TitleID;
|
||||
}
|
||||
|
||||
string state = _device.System.TitleId;
|
||||
string state = _device.System.TitleID;
|
||||
|
||||
if (state == null)
|
||||
{
|
||||
|
@ -307,42 +307,40 @@ namespace Ryujinx.UI
|
|||
DiscordClient.SetPresence(DiscordPresence);
|
||||
}
|
||||
|
||||
// TODO: Update GUI to store these files in another location
|
||||
try
|
||||
{
|
||||
string savePath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFS", "nand", "user", "save", "0000000000000000", _userId, _device.System.TitleID);
|
||||
|
||||
//try
|
||||
//{
|
||||
// string savePath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFS", "nand", "user", "save", "0000000000000000", _userId, _device.System.TitleId);
|
||||
if (File.Exists(System.IO.Path.Combine(savePath, "TimePlayed.dat")) == false)
|
||||
{
|
||||
Directory.CreateDirectory(savePath);
|
||||
using (FileStream stream = File.OpenWrite(System.IO.Path.Combine(savePath, "TimePlayed.dat")))
|
||||
{
|
||||
stream.Write(Encoding.ASCII.GetBytes("0"));
|
||||
}
|
||||
}
|
||||
|
||||
// if (File.Exists(System.IO.Path.Combine(savePath, "TimePlayed.dat")) == false)
|
||||
// {
|
||||
// Directory.CreateDirectory(savePath);
|
||||
// using (FileStream stream = File.OpenWrite(System.IO.Path.Combine(savePath, "TimePlayed.dat")))
|
||||
// {
|
||||
// stream.Write(Encoding.ASCII.GetBytes("0"));
|
||||
// }
|
||||
// }
|
||||
if (File.Exists(System.IO.Path.Combine(savePath, "LastPlayed.dat")) == false)
|
||||
{
|
||||
Directory.CreateDirectory(savePath);
|
||||
using (FileStream stream = File.OpenWrite(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
|
||||
{
|
||||
stream.Write(Encoding.ASCII.GetBytes("Never"));
|
||||
}
|
||||
}
|
||||
|
||||
// if (File.Exists(System.IO.Path.Combine(savePath, "LastPlayed.dat")) == false)
|
||||
// {
|
||||
// Directory.CreateDirectory(savePath);
|
||||
// using (FileStream stream = File.OpenWrite(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
|
||||
// {
|
||||
// stream.Write(Encoding.ASCII.GetBytes("Never"));
|
||||
// }
|
||||
// }
|
||||
|
||||
// using (FileStream stream = File.OpenWrite(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
|
||||
// {
|
||||
// using (StreamWriter writer = new StreamWriter(stream))
|
||||
// {
|
||||
// writer.WriteLine(DateTime.UtcNow);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//catch (ArgumentNullException)
|
||||
//{
|
||||
// Logger.PrintWarning(LogClass.Application, $"Could not access save path to retrieve time/last played data using: UserID: {_userId}, TitleID: {_device.System.TitleId}");
|
||||
//}
|
||||
using (FileStream stream = File.OpenWrite(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
|
||||
{
|
||||
using (StreamWriter writer = new StreamWriter(stream))
|
||||
{
|
||||
writer.WriteLine(DateTime.UtcNow);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (ArgumentNullException)
|
||||
{
|
||||
Logger.PrintWarning(LogClass.Application, $"Could not access save path to retrieve time/last played data using: UserID: {_userId}, TitleID: {_device.System.TitleID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -360,44 +358,42 @@ namespace Ryujinx.UI
|
|||
|
||||
private static void End()
|
||||
{
|
||||
// TODO: Update GUI to store these files in another location
|
||||
if (_gameLoaded)
|
||||
{
|
||||
try
|
||||
{
|
||||
string savePath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFS", "nand", "user", "save", "0000000000000000", _userId, _device.System.TitleID);
|
||||
double currentPlayTime = 0;
|
||||
|
||||
//if (_gameLoaded)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// string savePath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFS", "nand", "user", "save", "0000000000000000", _userId, _device.System.TitleId);
|
||||
// double currentPlayTime = 0;
|
||||
using (FileStream stream = File.OpenRead(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
|
||||
{
|
||||
using (StreamReader reader = new StreamReader(stream))
|
||||
{
|
||||
DateTime startTime = DateTime.Parse(reader.ReadLine());
|
||||
|
||||
// using (FileStream stream = File.OpenRead(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
|
||||
// {
|
||||
// using (StreamReader reader = new StreamReader(stream))
|
||||
// {
|
||||
// DateTime startTime = DateTime.Parse(reader.ReadLine());
|
||||
using (FileStream lastPlayedStream = File.OpenRead(System.IO.Path.Combine(savePath, "TimePlayed.dat")))
|
||||
{
|
||||
using (StreamReader lastPlayedReader = new StreamReader(lastPlayedStream))
|
||||
{
|
||||
currentPlayTime = double.Parse(lastPlayedReader.ReadLine());
|
||||
}
|
||||
}
|
||||
|
||||
// using (FileStream lastPlayedStream = File.OpenRead(System.IO.Path.Combine(savePath, "TimePlayed.dat")))
|
||||
// {
|
||||
// using (StreamReader lastPlayedReader = new StreamReader(lastPlayedStream))
|
||||
// {
|
||||
// currentPlayTime = double.Parse(lastPlayedReader.ReadLine());
|
||||
// }
|
||||
// }
|
||||
|
||||
// using (FileStream timePlayedStream = File.OpenWrite(System.IO.Path.Combine(savePath, "TimePlayed.dat")))
|
||||
// {
|
||||
// using (StreamWriter timePlayedWriter = new StreamWriter(timePlayedStream))
|
||||
// {
|
||||
// timePlayedWriter.WriteLine(currentPlayTime + Math.Round(DateTime.UtcNow.Subtract(startTime).TotalSeconds, MidpointRounding.AwayFromZero));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// catch (ArgumentNullException)
|
||||
// {
|
||||
// Logger.PrintWarning(LogClass.Application, $"Could not access save path to retrieve time/last played data using: UserID: {_userId}, TitleID: {_device.System.TitleId}");
|
||||
// }
|
||||
//}
|
||||
using (FileStream timePlayedStream = File.OpenWrite(System.IO.Path.Combine(savePath, "TimePlayed.dat")))
|
||||
{
|
||||
using (StreamWriter timePlayedWriter = new StreamWriter(timePlayedStream))
|
||||
{
|
||||
timePlayedWriter.WriteLine(currentPlayTime + Math.Round(DateTime.UtcNow.Subtract(startTime).TotalSeconds, MidpointRounding.AwayFromZero));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (ArgumentNullException)
|
||||
{
|
||||
Logger.PrintWarning(LogClass.Application, $"Could not access save path to retrieve time/last played data using: UserID: {_userId}, TitleID: {_device.System.TitleID}");
|
||||
}
|
||||
}
|
||||
|
||||
Profile.FinishProfiling();
|
||||
_device.Dispose();
|
||||
|
@ -441,12 +437,12 @@ namespace Ryujinx.UI
|
|||
FileChooserDialog fileChooser = new FileChooserDialog("Choose the file to open", this, FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept);
|
||||
|
||||
fileChooser.Filter = new FileFilter();
|
||||
fileChooser.Filter.AddPattern("*.nsp");
|
||||
fileChooser.Filter.AddPattern("*.nsp" );
|
||||
fileChooser.Filter.AddPattern("*.pfs0");
|
||||
fileChooser.Filter.AddPattern("*.xci");
|
||||
fileChooser.Filter.AddPattern("*.nca");
|
||||
fileChooser.Filter.AddPattern("*.nro");
|
||||
fileChooser.Filter.AddPattern("*.nso");
|
||||
fileChooser.Filter.AddPattern("*.xci" );
|
||||
fileChooser.Filter.AddPattern("*.nca" );
|
||||
fileChooser.Filter.AddPattern("*.nro" );
|
||||
fileChooser.Filter.AddPattern("*.nso" );
|
||||
|
||||
if (fileChooser.Run() == (int)ResponseType.Accept)
|
||||
{
|
||||
|
@ -523,7 +519,7 @@ namespace Ryujinx.UI
|
|||
{
|
||||
Process.Start(new ProcessStartInfo(ryuUpdater, "/U") { UseShellExecute = true });
|
||||
}
|
||||
catch (System.ComponentModel.Win32Exception)
|
||||
catch(System.ComponentModel.Win32Exception)
|
||||
{
|
||||
CreateErrorDialog("Update canceled by user or updater was not found");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue