Revert LibHac update
Users are facing save destruction on failing extra data update apparently
This commit is contained in:
parent
997380d48c
commit
208ba1dde2
32 changed files with 575 additions and 1805 deletions
|
@ -52,10 +52,9 @@ namespace Ryujinx.Ui
|
|||
{
|
||||
public class MainWindow : Window
|
||||
{
|
||||
private readonly VirtualFileSystem _virtualFileSystem;
|
||||
private readonly ContentManager _contentManager;
|
||||
private readonly AccountManager _accountManager;
|
||||
private readonly LibHacHorizonManager _libHacHorizonManager;
|
||||
private readonly VirtualFileSystem _virtualFileSystem;
|
||||
private readonly ContentManager _contentManager;
|
||||
private readonly AccountManager _accountManager;
|
||||
|
||||
private UserChannelPersistence _userChannelPersistence;
|
||||
|
||||
|
@ -157,27 +156,13 @@ namespace Ryujinx.Ui
|
|||
// Hide emulation context status bar.
|
||||
_statusBar.Hide();
|
||||
|
||||
// Instantiate HLE objects.
|
||||
_virtualFileSystem = VirtualFileSystem.CreateInstance();
|
||||
_libHacHorizonManager = new LibHacHorizonManager();
|
||||
|
||||
_libHacHorizonManager.InitializeFsServer(_virtualFileSystem);
|
||||
_libHacHorizonManager.InitializeArpServer();
|
||||
_libHacHorizonManager.InitializeBcatServer();
|
||||
_libHacHorizonManager.InitializeSystemClients();
|
||||
|
||||
// Save data created before we supported extra data in directory save data will not work properly if
|
||||
// given empty extra data. Luckily some of that extra data can be created using the data from the
|
||||
// save data indexer, which should be enough to check access permissions for user saves.
|
||||
// Every single save data's extra data will be checked and fixed if needed each time the emulator is opened.
|
||||
// Consider removing this at some point in the future when we don't need to worry about old saves.
|
||||
VirtualFileSystem.FixExtraData(_libHacHorizonManager.RyujinxClient);
|
||||
|
||||
// Instanciate HLE objects.
|
||||
_virtualFileSystem = VirtualFileSystem.CreateInstance();
|
||||
_contentManager = new ContentManager(_virtualFileSystem);
|
||||
_accountManager = new AccountManager(_libHacHorizonManager.RyujinxClient);
|
||||
_accountManager = new AccountManager(_virtualFileSystem);
|
||||
_userChannelPersistence = new UserChannelPersistence();
|
||||
|
||||
// Instantiate GUI objects.
|
||||
// Instanciate GUI objects.
|
||||
_applicationLibrary = new ApplicationLibrary(_virtualFileSystem);
|
||||
_uiHandler = new GtkHostUiHandler(this);
|
||||
_deviceExitStatus = new AutoResetEvent(false);
|
||||
|
@ -385,7 +370,7 @@ namespace Ryujinx.Ui
|
|||
|
||||
private void InitializeSwitchInstance()
|
||||
{
|
||||
_virtualFileSystem.ReloadKeySet();
|
||||
_virtualFileSystem.Reload();
|
||||
|
||||
IRenderer renderer;
|
||||
|
||||
|
@ -455,7 +440,6 @@ namespace Ryujinx.Ui
|
|||
IntegrityCheckLevel fsIntegrityCheckLevel = ConfigurationState.Instance.System.EnableFsIntegrityChecks ? IntegrityCheckLevel.ErrorOnInvalid : IntegrityCheckLevel.None;
|
||||
|
||||
HLE.HLEConfiguration configuration = new HLE.HLEConfiguration(_virtualFileSystem,
|
||||
_libHacHorizonManager,
|
||||
_contentManager,
|
||||
_accountManager,
|
||||
_userChannelPersistence,
|
||||
|
@ -1108,7 +1092,7 @@ namespace Ryujinx.Ui
|
|||
|
||||
BlitStruct<ApplicationControlProperty> controlData = (BlitStruct<ApplicationControlProperty>)_tableStore.GetValue(treeIter, 10);
|
||||
|
||||
_ = new GameTableContextMenu(this, _virtualFileSystem, _accountManager, _libHacHorizonManager.RyujinxClient, titleFilePath, titleName, titleId, controlData);
|
||||
_ = new GameTableContextMenu(this, _virtualFileSystem, _accountManager, titleFilePath, titleName, titleId, controlData);
|
||||
}
|
||||
|
||||
private void Load_Application_File(object sender, EventArgs args)
|
||||
|
@ -1224,15 +1208,15 @@ namespace Ryujinx.Ui
|
|||
|
||||
SystemVersion firmwareVersion = _contentManager.VerifyFirmwarePackage(filename);
|
||||
|
||||
if (firmwareVersion is null)
|
||||
string dialogTitle = $"Install Firmware {firmwareVersion.VersionString}";
|
||||
|
||||
if (firmwareVersion == null)
|
||||
{
|
||||
GtkDialog.CreateErrorDialog($"A valid system firmware was not found in {filename}.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
string dialogTitle = $"Install Firmware {firmwareVersion.VersionString}";
|
||||
|
||||
SystemVersion currentVersion = _contentManager.GetCurrentFirmwareVersion();
|
||||
|
||||
string dialogMessage = $"System version {firmwareVersion.VersionString} will be installed.";
|
||||
|
|
|
@ -33,7 +33,6 @@ namespace Ryujinx.Ui.Widgets
|
|||
private readonly MainWindow _parent;
|
||||
private readonly VirtualFileSystem _virtualFileSystem;
|
||||
private readonly AccountManager _accountManager;
|
||||
private readonly HorizonClient _horizonClient;
|
||||
private readonly BlitStruct<ApplicationControlProperty> _controlData;
|
||||
|
||||
private readonly string _titleFilePath;
|
||||
|
@ -44,7 +43,7 @@ namespace Ryujinx.Ui.Widgets
|
|||
private MessageDialog _dialog;
|
||||
private bool _cancel;
|
||||
|
||||
public GameTableContextMenu(MainWindow parent, VirtualFileSystem virtualFileSystem, AccountManager accountManager, HorizonClient horizonClient, string titleFilePath, string titleName, string titleId, BlitStruct<ApplicationControlProperty> controlData)
|
||||
public GameTableContextMenu(MainWindow parent, VirtualFileSystem virtualFileSystem, AccountManager accountManager, string titleFilePath, string titleName, string titleId, BlitStruct<ApplicationControlProperty> controlData)
|
||||
{
|
||||
_parent = parent;
|
||||
|
||||
|
@ -52,7 +51,6 @@ namespace Ryujinx.Ui.Widgets
|
|||
|
||||
_virtualFileSystem = virtualFileSystem;
|
||||
_accountManager = accountManager;
|
||||
_horizonClient = horizonClient;
|
||||
_titleFilePath = titleFilePath;
|
||||
_titleName = titleName;
|
||||
_titleIdText = titleId;
|
||||
|
@ -65,9 +63,9 @@ namespace Ryujinx.Ui.Widgets
|
|||
return;
|
||||
}
|
||||
|
||||
_openSaveUserDirMenuItem.Sensitive = !Utilities.IsZeros(controlData.ByteSpan) && controlData.Value.UserAccountSaveDataSize > 0;
|
||||
_openSaveDeviceDirMenuItem.Sensitive = !Utilities.IsZeros(controlData.ByteSpan) && controlData.Value.DeviceSaveDataSize > 0;
|
||||
_openSaveBcatDirMenuItem.Sensitive = !Utilities.IsZeros(controlData.ByteSpan) && controlData.Value.BcatDeliveryCacheStorageSize > 0;
|
||||
_openSaveUserDirMenuItem.Sensitive = !Utilities.IsEmpty(controlData.ByteSpan) && controlData.Value.UserAccountSaveDataSize > 0;
|
||||
_openSaveDeviceDirMenuItem.Sensitive = !Utilities.IsEmpty(controlData.ByteSpan) && controlData.Value.DeviceSaveDataSize > 0;
|
||||
_openSaveBcatDirMenuItem.Sensitive = !Utilities.IsEmpty(controlData.ByteSpan) && controlData.Value.BcatDeliveryCacheStorageSize > 0;
|
||||
|
||||
string fileExt = System.IO.Path.GetExtension(_titleFilePath).ToLower();
|
||||
bool hasNca = fileExt == ".nca" || fileExt == ".nsp" || fileExt == ".pfs0" || fileExt == ".xci";
|
||||
|
@ -83,7 +81,7 @@ namespace Ryujinx.Ui.Widgets
|
|||
{
|
||||
saveDataId = default;
|
||||
|
||||
Result result = _horizonClient.Fs.FindSaveDataWithFilter(out SaveDataInfo saveDataInfo, SaveDataSpaceId.User, in filter);
|
||||
Result result = _virtualFileSystem.FsClient.FindSaveDataWithFilter(out SaveDataInfo saveDataInfo, SaveDataSpaceId.User, ref filter);
|
||||
|
||||
if (ResultFs.TargetNotFound.Includes(result))
|
||||
{
|
||||
|
@ -104,7 +102,7 @@ namespace Ryujinx.Ui.Widgets
|
|||
|
||||
ref ApplicationControlProperty control = ref controlHolder.Value;
|
||||
|
||||
if (Utilities.IsZeros(controlHolder.ByteSpan))
|
||||
if (Utilities.IsEmpty(controlHolder.ByteSpan))
|
||||
{
|
||||
// If the current application doesn't have a loaded control property, create a dummy one
|
||||
// and set the savedata sizes so a user savedata will be created.
|
||||
|
@ -119,7 +117,7 @@ namespace Ryujinx.Ui.Widgets
|
|||
|
||||
Uid user = new Uid((ulong)_accountManager.LastOpenedUser.UserId.High, (ulong)_accountManager.LastOpenedUser.UserId.Low);
|
||||
|
||||
result = EnsureApplicationSaveData(_horizonClient.Fs, out _, new LibHac.Ncm.ApplicationId(titleId), ref control, ref user);
|
||||
result = EnsureApplicationSaveData(_virtualFileSystem.FsClient, out _, new LibHac.Ncm.ApplicationId(titleId), ref control, ref user);
|
||||
|
||||
if (result.IsFailure())
|
||||
{
|
||||
|
@ -129,7 +127,7 @@ namespace Ryujinx.Ui.Widgets
|
|||
}
|
||||
|
||||
// Try to find the savedata again after creating it
|
||||
result = _horizonClient.Fs.FindSaveDataWithFilter(out saveDataInfo, SaveDataSpaceId.User, in filter);
|
||||
result = _virtualFileSystem.FsClient.FindSaveDataWithFilter(out saveDataInfo, SaveDataSpaceId.User, ref filter);
|
||||
}
|
||||
|
||||
if (result.IsSuccess())
|
||||
|
@ -286,7 +284,7 @@ namespace Ryujinx.Ui.Widgets
|
|||
IFileSystem ncaFileSystem = patchNca != null ? mainNca.OpenFileSystemWithPatch(patchNca, index, IntegrityCheckLevel.ErrorOnInvalid)
|
||||
: mainNca.OpenFileSystem(index, IntegrityCheckLevel.ErrorOnInvalid);
|
||||
|
||||
FileSystemClient fsClient = _horizonClient.Fs;
|
||||
FileSystemClient fsClient = _virtualFileSystem.FsClient;
|
||||
|
||||
string source = DateTime.Now.ToFileTime().ToString()[10..];
|
||||
string output = DateTime.Now.ToFileTime().ToString()[10..];
|
||||
|
@ -411,7 +409,7 @@ namespace Ryujinx.Ui.Widgets
|
|||
rc = fs.ReadFile(out long _, sourceHandle, offset, buf);
|
||||
if (rc.IsFailure()) return rc;
|
||||
|
||||
rc = fs.WriteFile(destHandle, offset, buf, WriteOption.None);
|
||||
rc = fs.WriteFile(destHandle, offset, buf);
|
||||
if (rc.IsFailure()) return rc;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue