requested changes

This commit is contained in:
Xpl0itR 2019-09-30 20:16:03 +01:00 committed by unknown
parent 45bf88c5a2
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.Spl;
using Ryujinx.Common.Logging;
using Ryujinx.HLE.FileSystem;
using System;
using System.Collections.Generic;
using System.IO;
@ -27,17 +28,17 @@ namespace Ryujinx.UI
public struct ApplicationData
{
public bool Fav;
public byte[] Icon;
public string TitleName;
public string TitleId;
public string Developer;
public string Version;
public string TimePlayed;
public string LastPlayed;
public string FileExt;
public string FileSize;
public string Path;
public bool Fav { get; set; }
public byte[] Icon { get; set; }
public string TitleName { get; set; }
public string TitleId { get; set; }
public string Developer { get; set; }
public string Version { get; set; }
public string TimePlayed { get; set; }
public string LastPlayed { get; set; }
public string FileExt { get; set; }
public string FileSize { get; set; }
public string Path { get; set; }
}
public static List<ApplicationData> ApplicationLibraryData { get; private set; }
@ -51,9 +52,9 @@ namespace Ryujinx.UI
private struct ApplicationMetadata
{
public bool Fav;
public double TimePlayed;
public string LastPlayed;
public bool Fav { get; set; }
public double TimePlayed { get; set; }
public string LastPlayed { get; set; }
}
private static ApplicationMetadata AppMetadata;
@ -84,12 +85,12 @@ namespace Ryujinx.UI
string[] apps = Directory.GetFiles(appDir, "*.*", SearchOption.AllDirectories);
foreach (string app in apps)
{
if ((Path.GetExtension(app.ToString()) == ".xci") ||
(Path.GetExtension(app.ToString()) == ".nca") ||
(Path.GetExtension(app.ToString()) == ".nsp") ||
(Path.GetExtension(app.ToString()) == ".pfs0")||
(Path.GetExtension(app.ToString()) == ".nro") ||
(Path.GetExtension(app.ToString()) == ".nso"))
if ((Path.GetExtension(app) == ".xci") ||
(Path.GetExtension(app) == ".nca") ||
(Path.GetExtension(app) == ".nsp") ||
(Path.GetExtension(app) == ".pfs0")||
(Path.GetExtension(app) == ".nro") ||
(Path.GetExtension(app) == ".nso"))
{
applications.Add(app);
}
@ -401,7 +402,7 @@ namespace Ryujinx.UI
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");
IJsonFormatterResolver resolver = CompositeResolver.Create(new[] { StandardResolver.AllowPrivateSnakeCase });

View file

@ -6,6 +6,7 @@ using Ryujinx.Audio;
using Ryujinx.Common.Logging;
using Ryujinx.Graphics.Gal;
using Ryujinx.Graphics.Gal.OpenGL;
using Ryujinx.HLE.FileSystem;
using Ryujinx.Profiler;
using System;
using System.Diagnostics;
@ -48,13 +49,11 @@ namespace Ryujinx.UI
private struct ApplicationMetadata
{
public bool Fav;
public double TimePlayed;
public string LastPlayed;
public bool Fav { get; set; }
public double TimePlayed { get; set; }
public string LastPlayed { get; set; }
}
private static ApplicationMetadata AppMetadata;
public static bool DiscordIntegrationEnabled { get; set; }
public static DiscordRpcClient DiscordClient;
@ -342,10 +341,11 @@ namespace Ryujinx.UI
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");
IJsonFormatterResolver resolver = CompositeResolver.Create(new[] { StandardResolver.AllowPrivateSnakeCase });
ApplicationMetadata AppMetadata = new ApplicationMetadata();
if (!File.Exists(metadataFile))
{
@ -394,10 +394,11 @@ namespace Ryujinx.UI
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");
IJsonFormatterResolver resolver = CompositeResolver.Create(new[] { StandardResolver.AllowPrivateSnakeCase });
ApplicationMetadata AppMetadata = new ApplicationMetadata();
if (!File.Exists(metadataFile))
{
@ -459,10 +460,11 @@ namespace Ryujinx.UI
{
_tableStore.GetIter(out TreeIter treeIter, new TreePath(args.Path));
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 });
ApplicationMetadata AppMetadata = new ApplicationMetadata();
using (Stream stream = File.OpenRead(metadataPath))
{
AppMetadata = JsonSerializer.Deserialize<ApplicationMetadata>(stream, resolver);
@ -529,7 +531,7 @@ namespace Ryujinx.UI
{
Process.Start(new ProcessStartInfo()
{
FileName = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RyuFs"),
FileName = new VirtualFileSystem().GetBasePath(),
UseShellExecute = true,
Verb = "open"
});
@ -576,7 +578,7 @@ 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");
string ryuUpdater = System.IO.Path.Combine(new VirtualFileSystem().GetBasePath(), "RyuUpdater.exe");
try
{