From 4250ba84f0a454c7e357758efabc7932a4606f06 Mon Sep 17 00:00:00 2001 From: Xpl0itR Date: Wed, 14 Aug 2019 21:37:37 +0100 Subject: [PATCH] reads version info from installer and displays it in about menu --- Ryujinx/Configuration.cs | 1 - Ryujinx/Ui/AboutWindow.cs | 25 ++++++++++++++++++++++++- Ryujinx/Ui/ApplicationLibrary.cs | 3 +-- Ryujinx/Ui/MainWindow.cs | 7 ++++--- 4 files changed, 29 insertions(+), 7 deletions(-) diff --git a/Ryujinx/Configuration.cs b/Ryujinx/Configuration.cs index 38208b68cf..3a3815046d 100644 --- a/Ryujinx/Configuration.cs +++ b/Ryujinx/Configuration.cs @@ -1,4 +1,3 @@ -using ARMeilleure; using JsonPrettyPrinterPlus; using LibHac.Fs; using OpenTK.Input; diff --git a/Ryujinx/Ui/AboutWindow.cs b/Ryujinx/Ui/AboutWindow.cs index 17e37fbaff..80966e16e9 100644 --- a/Ryujinx/Ui/AboutWindow.cs +++ b/Ryujinx/Ui/AboutWindow.cs @@ -4,11 +4,23 @@ using System; using System.Diagnostics; using System.Reflection; using System.Runtime.InteropServices; +using Utf8Json; +using Utf8Json.Resolvers; +using System.IO; namespace Ryujinx.UI { + public struct Info + { + public string InstallVersion; + public string InstallCommit; + public string InstallBranch; + } + public class AboutWindow : Window { + public static Info Information { get; private set; } + #pragma warning disable 649 [GUI] Window _aboutWin; [GUI] Label _versionText; @@ -32,7 +44,18 @@ namespace Ryujinx.UI _discordLogo.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.DiscordLogo.png", 30 , 30 ); _twitterLogo.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.TwitterLogo.png", 30 , 30 ); - _versionText.Text = "Version x.x.x (Commit Number)"; + try + { + var resolver = CompositeResolver.Create(new[] { StandardResolver.AllowPrivateSnakeCase }); + + using (Stream stream = File.OpenRead(System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFS", "Installer", "Config", "Config.json"))) + { + Information = JsonSerializer.Deserialize(stream, resolver); + } + + _versionText.Text = $"Version {Information.InstallVersion} - {Information.InstallBranch} ({Information.InstallCommit})"; + } + catch { _versionText.Text = "Unknown Version"; } } public void OpenUrl(string url) diff --git a/Ryujinx/Ui/ApplicationLibrary.cs b/Ryujinx/Ui/ApplicationLibrary.cs index 8458990004..9a306de9df 100644 --- a/Ryujinx/Ui/ApplicationLibrary.cs +++ b/Ryujinx/Ui/ApplicationLibrary.cs @@ -2,7 +2,6 @@ using LibHac.Fs; using LibHac.Fs.NcaUtils; using Ryujinx.Common.Logging; -using Ryujinx.HLE.FileSystem; using System; using System.Collections.Generic; using System.IO; @@ -331,7 +330,7 @@ namespace Ryujinx.UI try { string[] playedData = new string[2]; - string savePath = Path.Combine(VirtualFileSystem.UserNandPath, "save", "0000000000000000", UserId, TitleId); + 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) { diff --git a/Ryujinx/Ui/MainWindow.cs b/Ryujinx/Ui/MainWindow.cs index c504f78784..90512aa7f7 100644 --- a/Ryujinx/Ui/MainWindow.cs +++ b/Ryujinx/Ui/MainWindow.cs @@ -281,7 +281,7 @@ namespace Ryujinx.UI string userId = "00000000000000000000000000000001"; try { - string savePath = System.IO.Path.Combine(VirtualFileSystem.UserNandPath, "save", "0000000000000000", userId, _device.System.TitleID); + 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) { @@ -327,7 +327,7 @@ namespace Ryujinx.UI { try { - string savePath = System.IO.Path.Combine(VirtualFileSystem.UserNandPath, "save", "0000000000000000", userId, _device.System.TitleID); + 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 fs = File.OpenRead(System.IO.Path.Combine(savePath, "LastPlayed.dat"))) @@ -477,7 +477,8 @@ namespace Ryujinx.UI private void Update_Pressed(object o, EventArgs args) { string ryuUpdater = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFS", "RyuUpdater.exe"); - Process.Start(new ProcessStartInfo(ryuUpdater, "/U") { UseShellExecute = true }); + try { Process.Start(new ProcessStartInfo(ryuUpdater, "/U") { UseShellExecute = true }); } + catch(System.ComponentModel.Win32Exception) { CreateErrorDialog("Update canceled by user or updater was not found"); } } private void About_Pressed(object o, EventArgs args)