Rename "RyuFs" directory to "Ryujinx" and use the same savedata system the Switch uses (#801)
* Use savedata FS commands from LibHac * Add EnsureSaveData. Use ApplicationControlProperty struct * Add a function to migrate to the new directory layout * LibHac update * Change backup structure * Don't create UI files in the save path * Update RyuFs paths * Add GetProgramIndexForAccessLog Ryujinx only runs one program at a time, so always return values reflecting that * Load control NCA when loading from an NSP * Skip over UI stats when exiting * Set TitleName and TitleId in more cases. Fix TitleID naming style * Completely comment out GUI play stats code * rebase * Update LibHac * Update LibHac * Revert UI changes * Do migration automatically at startup * Rename RyuFs directory to Ryujinx * Update RyuFs text * Store savedata paths in the GUI * Make "Open Save Directory" work * Use a dummy NACP in EnsureSaveData if one is not loaded * Remove manual migration button * Respond to feedback * Don't read the installer config to get a version string * Delete nuget.config * Exclude 'sdcard' and 'bis' during migration Co-authored-by: Thog <thog@protonmail.com>
This commit is contained in:
parent
e0e12b1672
commit
63b24b4af2
22 changed files with 877 additions and 384 deletions
|
@ -1,14 +1,17 @@
|
|||
using JsonPrettyPrinterPlus;
|
||||
using LibHac;
|
||||
using LibHac.Fs;
|
||||
using LibHac.Fs.Shim;
|
||||
using LibHac.FsSystem;
|
||||
using LibHac.FsSystem.NcaUtils;
|
||||
using LibHac.Ncm;
|
||||
using LibHac.Spl;
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.HLE.FileSystem;
|
||||
using Ryujinx.HLE.Loaders.Npdm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
@ -16,6 +19,7 @@ using System.Text;
|
|||
using Utf8Json;
|
||||
using Utf8Json.Resolvers;
|
||||
|
||||
using RightsId = LibHac.Fs.RightsId;
|
||||
using TitleLanguage = Ryujinx.HLE.HOS.SystemState.TitleLanguage;
|
||||
|
||||
namespace Ryujinx.Ui
|
||||
|
@ -34,7 +38,7 @@ namespace Ryujinx.Ui
|
|||
private static TitleLanguage _desiredTitleLanguage;
|
||||
private static ApplicationMetadata _appMetadata;
|
||||
|
||||
public static void LoadApplications(List<string> appDirs, Keyset keySet, TitleLanguage desiredTitleLanguage)
|
||||
public static void LoadApplications(List<string> appDirs, Keyset keySet, TitleLanguage desiredTitleLanguage, FileSystemClient fsClient = null, VirtualFileSystem vfs = null)
|
||||
{
|
||||
int numApplicationsFound = 0;
|
||||
int numApplicationsLoaded = 0;
|
||||
|
@ -127,6 +131,7 @@ namespace Ryujinx.Ui
|
|||
string titleId = "0000000000000000";
|
||||
string developer = "Unknown";
|
||||
string version = "0";
|
||||
string saveDataPath = null;
|
||||
byte[] applicationIcon = null;
|
||||
|
||||
using (FileStream file = new FileStream(applicationPath, FileMode.Open, FileAccess.Read))
|
||||
|
@ -336,6 +341,20 @@ namespace Ryujinx.Ui
|
|||
|
||||
(bool favorite, string timePlayed, string lastPlayed) = GetMetadata(titleId);
|
||||
|
||||
if (ulong.TryParse(titleId, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out ulong titleIdNum))
|
||||
{
|
||||
SaveDataFilter filter = new SaveDataFilter();
|
||||
filter.SetUserId(new UserId(1, 0));
|
||||
filter.SetTitleId(new TitleId(titleIdNum));
|
||||
|
||||
Result result = fsClient.FindSaveDataWithFilter(out SaveDataInfo saveDataInfo, SaveDataSpaceId.User, ref filter);
|
||||
|
||||
if (result.IsSuccess())
|
||||
{
|
||||
saveDataPath = Path.Combine(vfs.GetNandPath(), $"user/save/{saveDataInfo.SaveDataId:x16}");
|
||||
}
|
||||
}
|
||||
|
||||
ApplicationData data = new ApplicationData()
|
||||
{
|
||||
Favorite = favorite,
|
||||
|
@ -349,6 +368,7 @@ namespace Ryujinx.Ui
|
|||
FileExtension = Path.GetExtension(applicationPath).ToUpper().Remove(0 ,1),
|
||||
FileSize = (fileSize < 1) ? (fileSize * 1024).ToString("0.##") + "MB" : fileSize.ToString("0.##") + "GB",
|
||||
Path = applicationPath,
|
||||
SaveDataPath = saveDataPath
|
||||
};
|
||||
|
||||
numApplicationsLoaded++;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue