Revert UI changes

This commit is contained in:
Alex Barney 2019-11-29 15:56:29 -06:00
commit 64eacabe8f
4 changed files with 221 additions and 229 deletions

View file

@ -111,7 +111,7 @@ namespace Ryujinx.HLE.HOS
public string TitleName { get; private set; } public string TitleName { get; private set; }
public string TitleId { get; private set; } public string TitleID { get; private set; }
public IntegrityCheckLevel FsIntegrityCheckLevel { get; set; } public IntegrityCheckLevel FsIntegrityCheckLevel { get; set; }
@ -507,7 +507,7 @@ namespace Ryujinx.HLE.HOS
LoadExeFs(codeFs, out Npdm metaData); LoadExeFs(codeFs, out Npdm metaData);
TitleId = metaData.Aci0.TitleId.ToString("x16"); TitleID = metaData.Aci0.TitleId.ToString("x16");
if (controlNca != null) if (controlNca != null)
{ {
@ -515,7 +515,7 @@ namespace Ryujinx.HLE.HOS
} }
else 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("rtld");
LoadNso("main"); LoadNso("main");
@ -658,7 +658,7 @@ namespace Ryujinx.HLE.HOS
ContentManager.LoadEntries(); ContentManager.LoadEntries();
TitleName = CurrentTitle = metaData.TitleName; TitleName = CurrentTitle = metaData.TitleName;
TitleId = metaData.Aci0.TitleId.ToString("x16"); TitleID = metaData.Aci0.TitleId.ToString("x16");
ProgramLoader.LoadStaticObjects(this, metaData, new IExecutable[] { staticObject }); ProgramLoader.LoadStaticObjects(this, metaData, new IExecutable[] { staticObject });
} }

View file

@ -33,7 +33,7 @@ namespace Ryujinx.HLE.HOS.Services.Arp
return new ApplicationLaunchProperty 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, Version = 0x00,
BaseGameStorageId = (byte)StorageId.NandSystem, BaseGameStorageId = (byte)StorageId.NandSystem,
UpdateGameStorageId = (byte)StorageId.None UpdateGameStorageId = (byte)StorageId.None

View file

@ -381,72 +381,68 @@ namespace Ryujinx.UI
} }
private static string[] GetPlayedData(string TitleId, string UserId) 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" }; 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) private static byte[] NspOrXciIcon(string applicationPath)

View file

@ -274,12 +274,12 @@ namespace Ryujinx.UI
if (DiscordIntegrationEnabled) 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) if (state == null)
{ {
@ -307,42 +307,40 @@ namespace Ryujinx.UI
DiscordClient.SetPresence(DiscordPresence); 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 if (File.Exists(System.IO.Path.Combine(savePath, "TimePlayed.dat")) == false)
//{ {
// string savePath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFS", "nand", "user", "save", "0000000000000000", _userId, _device.System.TitleId); 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) if (File.Exists(System.IO.Path.Combine(savePath, "LastPlayed.dat")) == false)
// { {
// Directory.CreateDirectory(savePath); Directory.CreateDirectory(savePath);
// using (FileStream stream = File.OpenWrite(System.IO.Path.Combine(savePath, "TimePlayed.dat"))) using (FileStream stream = File.OpenWrite(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
// { {
// stream.Write(Encoding.ASCII.GetBytes("0")); stream.Write(Encoding.ASCII.GetBytes("Never"));
// } }
// } }
// if (File.Exists(System.IO.Path.Combine(savePath, "LastPlayed.dat")) == false) using (FileStream stream = File.OpenWrite(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
// { {
// Directory.CreateDirectory(savePath); using (StreamWriter writer = new StreamWriter(stream))
// using (FileStream stream = File.OpenWrite(System.IO.Path.Combine(savePath, "LastPlayed.dat"))) {
// { writer.WriteLine(DateTime.UtcNow);
// stream.Write(Encoding.ASCII.GetBytes("Never")); }
// } }
// } }
catch (ArgumentNullException)
// using (FileStream stream = File.OpenWrite(System.IO.Path.Combine(savePath, "LastPlayed.dat"))) {
// { Logger.PrintWarning(LogClass.Application, $"Could not access save path to retrieve time/last played data using: UserID: {_userId}, TitleID: {_device.System.TitleID}");
// 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() 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) using (FileStream stream = File.OpenRead(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
//{ {
// try using (StreamReader reader = new StreamReader(stream))
// { {
// string savePath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFS", "nand", "user", "save", "0000000000000000", _userId, _device.System.TitleId); DateTime startTime = DateTime.Parse(reader.ReadLine());
// double currentPlayTime = 0;
// using (FileStream stream = File.OpenRead(System.IO.Path.Combine(savePath, "LastPlayed.dat"))) using (FileStream lastPlayedStream = File.OpenRead(System.IO.Path.Combine(savePath, "TimePlayed.dat")))
// { {
// using (StreamReader reader = new StreamReader(stream)) using (StreamReader lastPlayedReader = new StreamReader(lastPlayedStream))
// { {
// DateTime startTime = DateTime.Parse(reader.ReadLine()); currentPlayTime = double.Parse(lastPlayedReader.ReadLine());
}
}
// using (FileStream lastPlayedStream = File.OpenRead(System.IO.Path.Combine(savePath, "TimePlayed.dat"))) using (FileStream timePlayedStream = File.OpenWrite(System.IO.Path.Combine(savePath, "TimePlayed.dat")))
// { {
// using (StreamReader lastPlayedReader = new StreamReader(lastPlayedStream)) using (StreamWriter timePlayedWriter = new StreamWriter(timePlayedStream))
// { {
// currentPlayTime = double.Parse(lastPlayedReader.ReadLine()); timePlayedWriter.WriteLine(currentPlayTime + Math.Round(DateTime.UtcNow.Subtract(startTime).TotalSeconds, MidpointRounding.AwayFromZero));
// } }
// } }
}
// using (FileStream timePlayedStream = File.OpenWrite(System.IO.Path.Combine(savePath, "TimePlayed.dat"))) }
// { }
// using (StreamWriter timePlayedWriter = new StreamWriter(timePlayedStream)) catch (ArgumentNullException)
// { {
// timePlayedWriter.WriteLine(currentPlayTime + Math.Round(DateTime.UtcNow.Subtract(startTime).TotalSeconds, MidpointRounding.AwayFromZero)); Logger.PrintWarning(LogClass.Application, $"Could not access save path to retrieve time/last played data using: UserID: {_userId}, TitleID: {_device.System.TitleID}");
// } }
// } }
// }
// }
// }
// 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(); Profile.FinishProfiling();
_device.Dispose(); _device.Dispose();