aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/FileSystem/VirtualFileSystem.cs
diff options
context:
space:
mode:
authormageven <62494521+mageven@users.noreply.github.com>2020-05-15 11:46:46 +0530
committerGitHub <noreply@github.com>2020-05-15 03:16:46 -0300
commitba4830293e4786851d743865b1232928f9873c7e (patch)
tree235a9d8c7b428e5ea45c5d8e60a29399c9102be0 /Ryujinx.HLE/FileSystem/VirtualFileSystem.cs
parent0ff00bd6d35390eb132eecd3ba307ba4bbfdd56d (diff)
Refactor out Application details from Horizon (#1236)
* Initial Application refactor * Misc typo and access modifier fixes * Clean unused namespaces * Address gdkchan's comments * Move ticket reading to common method * Change IParentalControlService to use ApplicationLoader.ControlData
Diffstat (limited to 'Ryujinx.HLE/FileSystem/VirtualFileSystem.cs')
-rw-r--r--Ryujinx.HLE/FileSystem/VirtualFileSystem.cs19
1 files changed, 18 insertions, 1 deletions
diff --git a/Ryujinx.HLE/FileSystem/VirtualFileSystem.cs b/Ryujinx.HLE/FileSystem/VirtualFileSystem.cs
index d4ffc5d3..347b4fa4 100644
--- a/Ryujinx.HLE/FileSystem/VirtualFileSystem.cs
+++ b/Ryujinx.HLE/FileSystem/VirtualFileSystem.cs
@@ -1,7 +1,9 @@
using LibHac;
+using LibHac.Common;
using LibHac.Fs;
using LibHac.FsService;
using LibHac.FsSystem;
+using LibHac.Spl;
using Ryujinx.HLE.FileSystem.Content;
using Ryujinx.HLE.HOS;
using System;
@@ -261,6 +263,21 @@ namespace Ryujinx.HLE.FileSystem
KeySet = ExternalKeyReader.ReadKeyFile(keyFile, titleKeyFile, consoleKeyFile);
}
+ public void ImportTickets(IFileSystem fs)
+ {
+ foreach (DirectoryEntryEx ticketEntry in fs.EnumerateEntries("/", "*.tik"))
+ {
+ Result result = fs.OpenFile(out IFile ticketFile, ticketEntry.FullPath.ToU8Span(), OpenMode.Read);
+
+ if (result.IsSuccess())
+ {
+ Ticket ticket = new Ticket(ticketFile.AsStream());
+
+ KeySet.ExternalKeySet.Add(new RightsId(ticket.RightsId), new AccessKey(ticket.GetTitleKey(KeySet)));
+ }
+ }
+ }
+
public void Unload()
{
RomFs?.Dispose();
@@ -283,7 +300,7 @@ namespace Ryujinx.HLE.FileSystem
{
if (_isInitialized)
{
- throw new InvalidOperationException($"VirtualFileSystem can only be instanciated once!");
+ throw new InvalidOperationException($"VirtualFileSystem can only be instantiated once!");
}
_isInitialized = true;