Skip to content

Commit

Permalink
Fix the AOC manager using incorrect paths (#5840)
Browse files Browse the repository at this point in the history
* Fix the content manager using incorrect path for some AOC NCAs

* Check Results in a few more places in the content manager
  • Loading branch information
Thealexbarney authored Oct 23, 2023
1 parent d773d51 commit b1f8f86
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Ryujinx.HLE/FileSystem/ContentManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public void AddAocData(IFileSystem fs, string containerPath, ulong aocBaseId, In
{
using var ncaFile = new UniqueRef<IFile>();

fs.OpenFile(ref ncaFile.Ref, ncaPath.FullPath.ToU8Span(), OpenMode.Read);
fs.OpenFile(ref ncaFile.Ref, ncaPath.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
var nca = new Nca(_virtualFileSystem.KeySet, ncaFile.Get.AsStorage());
if (nca.Header.ContentType != NcaContentType.Meta)
{
Expand All @@ -210,7 +210,7 @@ public void AddAocData(IFileSystem fs, string containerPath, ulong aocBaseId, In
using var pfs0 = nca.OpenFileSystem(0, integrityCheckLevel);
using var cnmtFile = new UniqueRef<IFile>();

pfs0.OpenFile(ref cnmtFile.Ref, pfs0.EnumerateEntries().Single().FullPath.ToU8Span(), OpenMode.Read);
pfs0.OpenFile(ref cnmtFile.Ref, pfs0.EnumerateEntries().Single().FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();

var cnmt = new Cnmt(cnmtFile.Get.AsStream());
if (cnmt.Type != ContentMetaType.AddOnContent || (cnmt.TitleId & 0xFFFFFFFFFFFFE000) != aocBaseId)
Expand All @@ -220,7 +220,7 @@ public void AddAocData(IFileSystem fs, string containerPath, ulong aocBaseId, In

string ncaId = Convert.ToHexString(cnmt.ContentEntries[0].NcaId).ToLower();

AddAocItem(cnmt.TitleId, containerPath, $"{ncaId}.nca", true);
AddAocItem(cnmt.TitleId, containerPath, $"/{ncaId}.nca", true);
}
}

Expand Down Expand Up @@ -265,12 +265,12 @@ public bool GetAocDataStorage(ulong aocTitleId, out IStorage aocStorage, Integri
{
case ".xci":
var xci = new Xci(_virtualFileSystem.KeySet, file.AsStorage()).OpenPartition(XciPartitionType.Secure);
xci.OpenFile(ref ncaFile.Ref, aoc.NcaPath.ToU8Span(), OpenMode.Read);
xci.OpenFile(ref ncaFile.Ref, aoc.NcaPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
break;
case ".nsp":
var pfs = new PartitionFileSystem();
pfs.Initialize(file.AsStorage());
pfs.OpenFile(ref ncaFile.Ref, aoc.NcaPath.ToU8Span(), OpenMode.Read);
pfs.OpenFile(ref ncaFile.Ref, aoc.NcaPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
break;
default:
return false; // Print error?
Expand Down Expand Up @@ -607,11 +607,11 @@ private static IFile OpenPossibleFragmentedFile(IFileSystem filesystem, string p

if (filesystem.FileExists($"{path}/00"))
{
filesystem.OpenFile(ref file.Ref, $"{path}/00".ToU8Span(), mode);
filesystem.OpenFile(ref file.Ref, $"{path}/00".ToU8Span(), mode).ThrowIfFailure();
}
else
{
filesystem.OpenFile(ref file.Ref, path.ToU8Span(), mode);
filesystem.OpenFile(ref file.Ref, path.ToU8Span(), mode).ThrowIfFailure();
}

return file.Release();
Expand Down

0 comments on commit b1f8f86

Please sign in to comment.