aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Barney <thealexbarney@gmail.com>2023-10-24 09:26:25 -0700
committerGitHub <noreply@github.com>2023-10-24 13:26:25 -0300
commit56fe2ff535560a5b7e6461f5925479848b9a9994 (patch)
tree7b5ac305827fc4c9bcc580e7f6418bfcaa1aba2a
parentb1f8f868f6fdec87bd3342ac379594bd695cbbfd (diff)
Fix loading tickets from a Sha256PartitionFileSystem (#5844)1.1.1063
-rw-r--r--src/Ryujinx.HLE/FileSystem/VirtualFileSystem.cs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Ryujinx.HLE/FileSystem/VirtualFileSystem.cs b/src/Ryujinx.HLE/FileSystem/VirtualFileSystem.cs
index eaf481dd..43bd2776 100644
--- a/src/Ryujinx.HLE/FileSystem/VirtualFileSystem.cs
+++ b/src/Ryujinx.HLE/FileSystem/VirtualFileSystem.cs
@@ -264,7 +264,16 @@ namespace Ryujinx.HLE.FileSystem
if (result.IsSuccess())
{
- Ticket ticket = new(ticketFile.Get.AsStream());
+ // When reading a file from a Sha256PartitionFileSystem, you can't start a read in the middle
+ // of the hashed portion (usually the first 0x200 bytes) of the file and end the read after
+ // the end of the hashed portion, so we read the ticket file using a single read.
+ byte[] ticketData = new byte[0x2C0];
+ result = ticketFile.Get.Read(out long bytesRead, 0, ticketData);
+
+ if (result.IsFailure() || bytesRead != ticketData.Length)
+ continue;
+
+ Ticket ticket = new(new MemoryStream(ticketData));
var titleKey = ticket.GetTitleKey(KeySet);
if (titleKey != null)