requested changes

This commit is contained in:
Xpl0itR 2019-09-30 20:16:03 +01:00 committed by unknown
commit 88999af97f
No known key found for this signature in database
GPG key ID: 91798184109676AD
2 changed files with 35 additions and 32 deletions

View file

@ -5,6 +5,7 @@ using LibHac.FsSystem;
using LibHac.FsSystem.NcaUtils; using LibHac.FsSystem.NcaUtils;
using LibHac.Spl; using LibHac.Spl;
using Ryujinx.Common.Logging; using Ryujinx.Common.Logging;
using Ryujinx.HLE.FileSystem;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@ -27,17 +28,17 @@ namespace Ryujinx.UI
public struct ApplicationData public struct ApplicationData
{ {
public bool Fav; public bool Fav { get; set; }
public byte[] Icon; public byte[] Icon { get; set; }
public string TitleName; public string TitleName { get; set; }
public string TitleId; public string TitleId { get; set; }
public string Developer; public string Developer { get; set; }
public string Version; public string Version { get; set; }
public string TimePlayed; public string TimePlayed { get; set; }
public string LastPlayed; public string LastPlayed { get; set; }
public string FileExt; public string FileExt { get; set; }
public string FileSize; public string FileSize { get; set; }
public string Path; public string Path { get; set; }
} }
public static List<ApplicationData> ApplicationLibraryData { get; private set; } public static List<ApplicationData> ApplicationLibraryData { get; private set; }
@ -51,9 +52,9 @@ namespace Ryujinx.UI
private struct ApplicationMetadata private struct ApplicationMetadata
{ {
public bool Fav; public bool Fav { get; set; }
public double TimePlayed; public double TimePlayed { get; set; }
public string LastPlayed; public string LastPlayed { get; set; }
} }
private static ApplicationMetadata AppMetadata; private static ApplicationMetadata AppMetadata;
@ -84,12 +85,12 @@ namespace Ryujinx.UI
string[] apps = Directory.GetFiles(appDir, "*.*", SearchOption.AllDirectories); string[] apps = Directory.GetFiles(appDir, "*.*", SearchOption.AllDirectories);
foreach (string app in apps) foreach (string app in apps)
{ {
if ((Path.GetExtension(app.ToString()) == ".xci") || if ((Path.GetExtension(app) == ".xci") ||
(Path.GetExtension(app.ToString()) == ".nca") || (Path.GetExtension(app) == ".nca") ||
(Path.GetExtension(app.ToString()) == ".nsp") || (Path.GetExtension(app) == ".nsp") ||
(Path.GetExtension(app.ToString()) == ".pfs0")|| (Path.GetExtension(app) == ".pfs0")||
(Path.GetExtension(app.ToString()) == ".nro") || (Path.GetExtension(app) == ".nro") ||
(Path.GetExtension(app.ToString()) == ".nso")) (Path.GetExtension(app) == ".nso"))
{ {
applications.Add(app); applications.Add(app);
} }
@ -401,7 +402,7 @@ namespace Ryujinx.UI
private static (bool, string, string) GetMetadata(string TitleId) private static (bool, string, string) GetMetadata(string TitleId)
{ {
string metadataFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFs", "games", TitleId, "gui"); string metadataFolder = Path.Combine(new VirtualFileSystem().GetBasePath(), "games", TitleId, "gui");
string metadataFile = Path.Combine(metadataFolder, "metadata.json"); string metadataFile = Path.Combine(metadataFolder, "metadata.json");
IJsonFormatterResolver resolver = CompositeResolver.Create(new[] { StandardResolver.AllowPrivateSnakeCase }); IJsonFormatterResolver resolver = CompositeResolver.Create(new[] { StandardResolver.AllowPrivateSnakeCase });

View file

@ -6,6 +6,7 @@ using Ryujinx.Audio;
using Ryujinx.Common.Logging; using Ryujinx.Common.Logging;
using Ryujinx.Graphics.Gal; using Ryujinx.Graphics.Gal;
using Ryujinx.Graphics.Gal.OpenGL; using Ryujinx.Graphics.Gal.OpenGL;
using Ryujinx.HLE.FileSystem;
using Ryujinx.Profiler; using Ryujinx.Profiler;
using System; using System;
using System.Diagnostics; using System.Diagnostics;
@ -48,13 +49,11 @@ namespace Ryujinx.UI
private struct ApplicationMetadata private struct ApplicationMetadata
{ {
public bool Fav; public bool Fav { get; set; }
public double TimePlayed; public double TimePlayed { get; set; }
public string LastPlayed; public string LastPlayed { get; set; }
} }
private static ApplicationMetadata AppMetadata;
public static bool DiscordIntegrationEnabled { get; set; } public static bool DiscordIntegrationEnabled { get; set; }
public static DiscordRpcClient DiscordClient; public static DiscordRpcClient DiscordClient;
@ -342,10 +341,11 @@ namespace Ryujinx.UI
DiscordClient.SetPresence(DiscordPresence); DiscordClient.SetPresence(DiscordPresence);
} }
string metadataFolder = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFs", "games", _device.System.TitleID, "gui"); string metadataFolder = System.IO.Path.Combine(new VirtualFileSystem().GetBasePath(), "games", _device.System.TitleID, "gui");
string metadataFile = System.IO.Path.Combine(metadataFolder, "metadata.json"); string metadataFile = System.IO.Path.Combine(metadataFolder, "metadata.json");
IJsonFormatterResolver resolver = CompositeResolver.Create(new[] { StandardResolver.AllowPrivateSnakeCase }); IJsonFormatterResolver resolver = CompositeResolver.Create(new[] { StandardResolver.AllowPrivateSnakeCase });
ApplicationMetadata AppMetadata = new ApplicationMetadata();
if (!File.Exists(metadataFile)) if (!File.Exists(metadataFile))
{ {
@ -394,10 +394,11 @@ namespace Ryujinx.UI
if (_gameLoaded) if (_gameLoaded)
{ {
string metadataFolder = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFs", "games", _device.System.TitleID, "gui"); string metadataFolder = System.IO.Path.Combine(new VirtualFileSystem().GetBasePath(), "games", _device.System.TitleID, "gui");
string metadataFile = System.IO.Path.Combine(metadataFolder, "metadata.json"); string metadataFile = System.IO.Path.Combine(metadataFolder, "metadata.json");
IJsonFormatterResolver resolver = CompositeResolver.Create(new[] { StandardResolver.AllowPrivateSnakeCase }); IJsonFormatterResolver resolver = CompositeResolver.Create(new[] { StandardResolver.AllowPrivateSnakeCase });
ApplicationMetadata AppMetadata = new ApplicationMetadata();
if (!File.Exists(metadataFile)) if (!File.Exists(metadataFile))
{ {
@ -459,10 +460,11 @@ namespace Ryujinx.UI
{ {
_tableStore.GetIter(out TreeIter treeIter, new TreePath(args.Path)); _tableStore.GetIter(out TreeIter treeIter, new TreePath(args.Path));
string titleid = _tableStore.GetValue(treeIter, 2).ToString().Split("\n")[1].ToLower(); string titleid = _tableStore.GetValue(treeIter, 2).ToString().Split("\n")[1].ToLower();
string metadataPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFs", "games", titleid, "gui", "metadata.json"); string metadataPath = System.IO.Path.Combine(new VirtualFileSystem().GetBasePath(), "games", titleid, "gui", "metadata.json");
IJsonFormatterResolver resolver = CompositeResolver.Create(new[] { StandardResolver.AllowPrivateSnakeCase }); IJsonFormatterResolver resolver = CompositeResolver.Create(new[] { StandardResolver.AllowPrivateSnakeCase });
ApplicationMetadata AppMetadata = new ApplicationMetadata();
using (Stream stream = File.OpenRead(metadataPath)) using (Stream stream = File.OpenRead(metadataPath))
{ {
AppMetadata = JsonSerializer.Deserialize<ApplicationMetadata>(stream, resolver); AppMetadata = JsonSerializer.Deserialize<ApplicationMetadata>(stream, resolver);
@ -529,7 +531,7 @@ namespace Ryujinx.UI
{ {
Process.Start(new ProcessStartInfo() Process.Start(new ProcessStartInfo()
{ {
FileName = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFs"), FileName = new VirtualFileSystem().GetBasePath(),
UseShellExecute = true, UseShellExecute = true,
Verb = "open" Verb = "open"
}); });
@ -576,7 +578,7 @@ namespace Ryujinx.UI
private void Update_Pressed(object o, EventArgs args) private void Update_Pressed(object o, EventArgs args)
{ {
string ryuUpdater = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFs", "RyuUpdater.exe"); string ryuUpdater = System.IO.Path.Combine(new VirtualFileSystem().GetBasePath(), "RyuUpdater.exe");
try try
{ {