diff options
author | Alex Barney <thealexbarney@gmail.com> | 2021-12-23 09:55:50 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-23 13:55:50 -0300 |
commit | aa932a6df1764b7c600ae0ba4e0c7a0ba802f312 (patch) | |
tree | 24a390cf2330620aeeab1efbd42ae4099f61ca86 /Ryujinx.HLE/HOS/Services/Fs/FileSystemProxy/FileSystemProxyHelper.cs | |
parent | cb43cc7e322014ce2bd0ee73b06d403be62fa8d5 (diff) |
Update to LibHac v0.14.3 (#2925)
* Update to LibHac v0.14.3
* Fix loading NCAs that don't have a data partition
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Fs/FileSystemProxy/FileSystemProxyHelper.cs')
-rw-r--r-- | Ryujinx.HLE/HOS/Services/Fs/FileSystemProxy/FileSystemProxyHelper.cs | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Fs/FileSystemProxy/FileSystemProxyHelper.cs b/Ryujinx.HLE/HOS/Services/Fs/FileSystemProxy/FileSystemProxyHelper.cs index 1b6c84c3..e66ace9c 100644 --- a/Ryujinx.HLE/HOS/Services/Fs/FileSystemProxy/FileSystemProxyHelper.cs +++ b/Ryujinx.HLE/HOS/Services/Fs/FileSystemProxy/FileSystemProxyHelper.cs @@ -23,11 +23,13 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy try { LocalStorage storage = new LocalStorage(pfsPath, FileAccess.Read, FileMode.Open); - ReferenceCountedDisposable<LibHac.Fs.Fsa.IFileSystem> nsp = new(new PartitionFileSystem(storage)); + using SharedRef<LibHac.Fs.Fsa.IFileSystem> nsp = new(new PartitionFileSystem(storage)); - ImportTitleKeysFromNsp(nsp.Target, context.Device.System.KeySet); + ImportTitleKeysFromNsp(nsp.Get, context.Device.System.KeySet); - openedFileSystem = new IFileSystem(FileSystemInterfaceAdapter.CreateShared(ref nsp)); + using SharedRef<LibHac.FsSrv.Sf.IFileSystem> adapter = FileSystemInterfaceAdapter.CreateShared(ref nsp.Ref(), true); + + openedFileSystem = new IFileSystem(ref adapter.Ref()); } catch (HorizonResultException ex) { @@ -51,9 +53,11 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy } LibHac.Fs.Fsa.IFileSystem fileSystem = nca.OpenFileSystem(NcaSectionType.Data, context.Device.System.FsIntegrityCheckLevel); - var sharedFs = new ReferenceCountedDisposable<LibHac.Fs.Fsa.IFileSystem>(fileSystem); + using var sharedFs = new SharedRef<LibHac.Fs.Fsa.IFileSystem>(fileSystem); + + using SharedRef<LibHac.FsSrv.Sf.IFileSystem> adapter = FileSystemInterfaceAdapter.CreateShared(ref sharedFs.Ref(), true); - openedFileSystem = new IFileSystem(FileSystemInterfaceAdapter.CreateShared(ref sharedFs)); + openedFileSystem = new IFileSystem(ref adapter.Ref()); } catch (HorizonResultException ex) { @@ -89,13 +93,15 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy string filename = fullPath.Replace(archivePath.FullName, string.Empty).TrimStart('\\'); - Result result = nsp.OpenFile(out LibHac.Fs.Fsa.IFile ncaFile, filename.ToU8Span(), OpenMode.Read); + using var ncaFile = new UniqueRef<LibHac.Fs.Fsa.IFile>(); + + Result result = nsp.OpenFile(ref ncaFile.Ref(), filename.ToU8Span(), OpenMode.Read); if (result.IsFailure()) { return (ResultCode)result.Value; } - return OpenNcaFs(context, fullPath, ncaFile.AsStorage(), out openedFileSystem); + return OpenNcaFs(context, fullPath, ncaFile.Release().AsStorage(), out openedFileSystem); } catch (HorizonResultException ex) { @@ -110,11 +116,13 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy { foreach (DirectoryEntryEx ticketEntry in nsp.EnumerateEntries("/", "*.tik")) { - Result result = nsp.OpenFile(out LibHac.Fs.Fsa.IFile ticketFile, ticketEntry.FullPath.ToU8Span(), OpenMode.Read); + using var ticketFile = new UniqueRef<LibHac.Fs.Fsa.IFile>(); + + Result result = nsp.OpenFile(ref ticketFile.Ref(), ticketEntry.FullPath.ToU8Span(), OpenMode.Read); if (result.IsSuccess()) { - Ticket ticket = new Ticket(ticketFile.AsStream()); + Ticket ticket = new Ticket(ticketFile.Get.AsStream()); keySet.ExternalKeySet.Add(new RightsId(ticket.RightsId), new AccessKey(ticket.GetTitleKey(keySet))); } |