Did some testing and fixed some bugs
Im not happy with one of the fixes so i will do it properly an upcoming commit
This commit is contained in:
parent
708a518e10
commit
9518dc831c
3 changed files with 45 additions and 44 deletions
|
@ -685,7 +685,7 @@ namespace Ryujinx.HLE.HOS
|
||||||
// It's only safe to release resources once all threads
|
// It's only safe to release resources once all threads
|
||||||
// have exited.
|
// have exited.
|
||||||
ThreadCounter.Signal();
|
ThreadCounter.Signal();
|
||||||
ThreadCounter.Wait();
|
//ThreadCounter.Wait();
|
||||||
|
|
||||||
Scheduler.Dispose();
|
Scheduler.Dispose();
|
||||||
|
|
||||||
|
|
|
@ -251,9 +251,9 @@ namespace Ryujinx
|
||||||
float timePlayed = float.Parse(sr.ReadLine());
|
float timePlayed = float.Parse(sr.ReadLine());
|
||||||
|
|
||||||
if (timePlayed <= 60.0) { playedData[0] = $"{timePlayed}s"; }
|
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 <= 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 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"; }
|
else { playedData[0] = $"{Math.Round(timePlayed / 86400, 2, MidpointRounding.AwayFromZero)} days"; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ namespace Ryujinx
|
||||||
#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 Nfc;
|
[GUI] MenuItem Nfc;
|
||||||
[GUI] Box Box;
|
[GUI] Box Box;
|
||||||
[GUI] ScrolledWindow GameTableWindow;
|
[GUI] ScrolledWindow GameTableWindow;
|
||||||
|
@ -97,7 +98,8 @@ namespace Ryujinx
|
||||||
{
|
{
|
||||||
Box.Remove(GlScreen);
|
Box.Remove(GlScreen);
|
||||||
|
|
||||||
Nfc.Sensitive = false;
|
Nfc.Sensitive = false;
|
||||||
|
ReturnMain.Sensitive = false;
|
||||||
|
|
||||||
GameTable.AppendColumn("Icon" , new CellRendererPixbuf(), "pixbuf", 0);
|
GameTable.AppendColumn("Icon" , new CellRendererPixbuf(), "pixbuf", 0);
|
||||||
GameTable.AppendColumn("Game" , new CellRendererText() , "text" , 1);
|
GameTable.AppendColumn("Game" , new CellRendererText() , "text" , 1);
|
||||||
|
@ -153,7 +155,7 @@ namespace Ryujinx
|
||||||
StyleContext.AddProviderForScreen(Gdk.Screen.Default, cssProvider, 800);
|
StyleContext.AddProviderForScreen(Gdk.Screen.Default, cssProvider, 800);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void LoadApplication(string path)
|
private void LoadApplication(string path)
|
||||||
{
|
{
|
||||||
if (_GameLoaded)
|
if (_GameLoaded)
|
||||||
{
|
{
|
||||||
|
@ -185,10 +187,6 @@ namespace Ryujinx
|
||||||
Logger.PrintInfo(LogClass.Application, "Loading as cart WITHOUT RomFS.");
|
Logger.PrintInfo(LogClass.Application, "Loading as cart WITHOUT RomFS.");
|
||||||
_device.LoadCart(path);
|
_device.LoadCart(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
new Thread(new ThreadStart(CreateGameWindow)).Start();
|
|
||||||
|
|
||||||
_GameLoaded = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (File.Exists(path))
|
else if (File.Exists(path))
|
||||||
|
@ -213,40 +211,44 @@ namespace Ryujinx
|
||||||
_device.LoadProgram(path);
|
_device.LoadProgram(path);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
new Thread(new ThreadStart(CreateGameWindow)).Start();
|
|
||||||
|
|
||||||
_GameLoaded = true;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Logger.PrintWarning(LogClass.Application, "Please specify a valid XCI/NCA/NSP/PFS0/NRO file");
|
Logger.PrintWarning(LogClass.Application, "Please specify a valid XCI/NCA/NSP/PFS0/NRO file");
|
||||||
|
End();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
new Thread(new ThreadStart(CreateGameWindow)).Start();
|
||||||
|
|
||||||
|
_GameLoaded = true;
|
||||||
|
ReturnMain.Sensitive = true;
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
DiscordPresence.Details = $"Playing {_device.System.TitleName}";
|
DiscordPresence.Details = $"Playing {_device.System.TitleName}";
|
||||||
DiscordPresence.State = string.IsNullOrWhiteSpace(_device.System.TitleID) ? string.Empty : _device.System.TitleID.ToUpper();
|
DiscordPresence.State = string.IsNullOrWhiteSpace(_device.System.TitleID) ? string.Empty : _device.System.TitleID.ToUpper();
|
||||||
DiscordPresence.Assets.LargeImageText = _device.System.TitleName;
|
DiscordPresence.Assets.LargeImageText = _device.System.TitleName;
|
||||||
DiscordPresence.Assets.SmallImageKey = "ryujinx";
|
DiscordPresence.Assets.SmallImageKey = "ryujinx";
|
||||||
DiscordPresence.Assets.SmallImageText = "Ryujinx is an emulator for the Nintendo Switch";
|
DiscordPresence.Assets.SmallImageText = "Ryujinx is an emulator for the Nintendo Switch";
|
||||||
DiscordPresence.Timestamps = new Timestamps(DateTime.UnixEpoch);
|
DiscordPresence.Timestamps = new Timestamps(DateTime.UtcNow);
|
||||||
|
|
||||||
DiscordClient.SetPresence(DiscordPresence);
|
DiscordClient.SetPresence(DiscordPresence);
|
||||||
}
|
}
|
||||||
|
|
||||||
string appdataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
if (_device.System.TitleID != null)
|
||||||
string savePath = System.IO.Path.Combine(appdataPath, "RyuFs", "nand", "user", "save", "0000000000000000", "savecommon", _device.System.TitleID);
|
|
||||||
using (FileStream fs = File.OpenWrite(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
|
|
||||||
{
|
{
|
||||||
using (StreamWriter sr = new StreamWriter(fs))
|
string appdataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
||||||
|
string savePath = System.IO.Path.Combine(appdataPath, "RyuFs", "nand", "user", "save", "0000000000000000", "savecommon", _device.System.TitleID);
|
||||||
|
using (FileStream fs = File.OpenWrite(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
|
||||||
{
|
{
|
||||||
sr.WriteLine(DateTime.UtcNow);
|
using (StreamWriter sr = new StreamWriter(fs))
|
||||||
|
{
|
||||||
|
sr.WriteLine(DateTime.UtcNow);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -256,45 +258,44 @@ namespace Ryujinx
|
||||||
using (GlScreen screen = new GlScreen(_device, _renderer))
|
using (GlScreen screen = new GlScreen(_device, _renderer))
|
||||||
{
|
{
|
||||||
screen.MainLoop();
|
screen.MainLoop();
|
||||||
|
|
||||||
Profile.FinishProfiling();
|
|
||||||
|
|
||||||
_device.Dispose();
|
|
||||||
|
|
||||||
_audioOut.Dispose();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void End()
|
private static void End()
|
||||||
{
|
{
|
||||||
string appdataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
if (_device.System.TitleID != null)
|
||||||
string savePath = System.IO.Path.Combine(appdataPath, "RyuFs", "nand", "user", "save", "0000000000000000", "savecommon", _device.System.TitleID);
|
|
||||||
double currentPlayTime = 0;
|
|
||||||
|
|
||||||
using (FileStream fs = File.OpenRead(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
|
|
||||||
{
|
{
|
||||||
using (StreamReader sr = new StreamReader(fs))
|
string appdataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
||||||
|
string savePath = System.IO.Path.Combine(appdataPath, "RyuFs", "nand", "user", "save", "0000000000000000", "savecommon", _device.System.TitleID);
|
||||||
|
double currentPlayTime = 0;
|
||||||
|
|
||||||
|
using (FileStream fs = File.OpenRead(System.IO.Path.Combine(savePath, "LastPlayed.dat")))
|
||||||
{
|
{
|
||||||
DateTime startTime = DateTime.Parse(sr.ReadLine());
|
using (StreamReader sr = new StreamReader(fs))
|
||||||
|
|
||||||
using (FileStream lpfs = File.OpenRead(System.IO.Path.Combine(savePath, "TimePlayed.dat")))
|
|
||||||
{
|
{
|
||||||
using (StreamReader lpsr = new StreamReader(lpfs))
|
DateTime startTime = DateTime.Parse(sr.ReadLine());
|
||||||
|
|
||||||
|
using (FileStream lpfs = File.OpenRead(System.IO.Path.Combine(savePath, "TimePlayed.dat")))
|
||||||
{
|
{
|
||||||
currentPlayTime = double.Parse(lpsr.ReadLine());
|
using (StreamReader lpsr = new StreamReader(lpfs))
|
||||||
|
{
|
||||||
|
currentPlayTime = double.Parse(lpsr.ReadLine());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
using (FileStream tpfs = File.OpenWrite(System.IO.Path.Combine(savePath, "TimePlayed.dat")))
|
using (FileStream tpfs = File.OpenWrite(System.IO.Path.Combine(savePath, "TimePlayed.dat")))
|
||||||
{
|
|
||||||
using (StreamWriter tpsr = new StreamWriter(tpfs))
|
|
||||||
{
|
{
|
||||||
tpsr.WriteLine(currentPlayTime + Math.Round(DateTime.UtcNow.Subtract(startTime).TotalSeconds, MidpointRounding.AwayFromZero));
|
using (StreamWriter tpsr = new StreamWriter(tpfs))
|
||||||
|
{
|
||||||
|
tpsr.WriteLine(currentPlayTime + Math.Round(DateTime.UtcNow.Subtract(startTime).TotalSeconds, MidpointRounding.AwayFromZero));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Profile.FinishProfiling();
|
||||||
|
_device.Dispose();
|
||||||
_audioOut.Dispose();
|
_audioOut.Dispose();
|
||||||
DiscordClient.Dispose();
|
DiscordClient.Dispose();
|
||||||
Logger.Shutdown();
|
Logger.Shutdown();
|
||||||
|
@ -351,7 +352,7 @@ namespace Ryujinx
|
||||||
|
|
||||||
private void Exit_Pressed(object o, EventArgs args) { End(); }
|
private void Exit_Pressed(object o, EventArgs args) { End(); }
|
||||||
|
|
||||||
private void Window_Close(object obj, DeleteEventArgs args) { End(); }
|
private void Window_Close(object o, DeleteEventArgs args) { End(); }
|
||||||
|
|
||||||
private void ReturnMain_Pressed(object o, EventArgs args)
|
private void ReturnMain_Pressed(object o, EventArgs args)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue