From 5fc1f6a1af7df0294069cd432c796e6546a4b38d Mon Sep 17 00:00:00 2001
From: Alex Barney <thealexbarney@gmail.com>
Date: Fri, 31 May 2019 19:31:10 -0500
Subject: Update to version 0.4 of LibHac (#689)

* It compiles

* Print correct name when loading an exefs

* Use DirectorySaveDataFileSystem for savedata

* Handle more errors in IFileSystem

* Remove structs replaced by LibHac structs

* Fix alignment

* Fix alignment again

* Fix IFile and IFileSystem IPC

* Alignment

* Use released libhac version
---
 Ryujinx.HLE/FileSystem/Content/ContentManager.cs | 26 +++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

(limited to 'Ryujinx.HLE/FileSystem/Content/ContentManager.cs')

diff --git a/Ryujinx.HLE/FileSystem/Content/ContentManager.cs b/Ryujinx.HLE/FileSystem/Content/ContentManager.cs
index 94f06475..40109f1c 100644
--- a/Ryujinx.HLE/FileSystem/Content/ContentManager.cs
+++ b/Ryujinx.HLE/FileSystem/Content/ContentManager.cs
@@ -1,5 +1,5 @@
-using LibHac;
-using LibHac.IO;
+using LibHac.Fs;
+using LibHac.Fs.NcaUtils;
 using Ryujinx.HLE.Utilities;
 using System;
 using System.Collections.Generic;
@@ -13,6 +13,7 @@ namespace Ryujinx.HLE.FileSystem.Content
         private Dictionary<StorageId, LinkedList<LocationEntry>> _locationEntries;
 
         private Dictionary<string, long> _sharedFontTitleDictionary;
+        private Dictionary<string, string> _sharedFontFilenameDictionary;
 
         private SortedDictionary<(ulong, ContentType), string> _contentDictionary;
 
@@ -33,6 +34,16 @@ namespace Ryujinx.HLE.FileSystem.Content
                 { "FontNintendoExtended",          0x0100000000000810 }
             };
 
+            _sharedFontFilenameDictionary = new Dictionary<string, string>
+            {
+                { "FontStandard",                  "nintendo_udsg-r_std_003.bfttf" },
+                { "FontChineseSimplified",         "nintendo_udsg-r_org_zh-cn_003.bfttf" },
+                { "FontExtendedChineseSimplified", "nintendo_udsg-r_ext_zh-cn_003.bfttf" },
+                { "FontKorean",                    "nintendo_udsg-r_ko_003.bfttf" },
+                { "FontChineseTraditional",        "nintendo_udjxh-db_zh-tw_003.bfttf" },
+                { "FontNintendoExtended",          "nintendo_ext_003.bfttf" }
+            };
+
             _device = device;
         }
 
@@ -74,7 +85,7 @@ namespace Ryujinx.HLE.FileSystem.Content
 
                         using (FileStream ncaFile = new FileStream(Directory.GetFiles(directoryPath)[0], FileMode.Open, FileAccess.Read))
                         {
-                            Nca nca = new Nca(_device.System.KeySet, ncaFile.AsStorage(), false);
+                            Nca nca = new Nca(_device.System.KeySet, ncaFile.AsStorage());
 
                             string switchPath = Path.Combine(contentPathString + ":",
                                                               ncaFile.Name.Replace(contentDirectory, string.Empty).TrimStart('\\'));
@@ -102,7 +113,7 @@ namespace Ryujinx.HLE.FileSystem.Content
 
                         using (FileStream ncaFile = new FileStream(filePath, FileMode.Open, FileAccess.Read))
                         {
-                            Nca nca = new Nca(_device.System.KeySet, ncaFile.AsStorage(), false);
+                            Nca nca = new Nca(_device.System.KeySet, ncaFile.AsStorage());
 
                             string switchPath = Path.Combine(contentPathString + ":",
                                                               filePath.Replace(contentDirectory, string.Empty).TrimStart('\\'));
@@ -230,7 +241,7 @@ namespace Ryujinx.HLE.FileSystem.Content
                 {
                     using (FileStream file = new FileStream(installedPath, FileMode.Open, FileAccess.Read))
                     {
-                        Nca  nca          = new Nca(_device.System.KeySet, file.AsStorage(), false);
+                        Nca  nca          = new Nca(_device.System.KeySet, file.AsStorage());
                         bool contentCheck = nca.Header.ContentType == contentType;
 
                         return contentCheck;
@@ -287,6 +298,11 @@ namespace Ryujinx.HLE.FileSystem.Content
             return _sharedFontTitleDictionary.TryGetValue(fontName, out titleId);
         }
 
+        public bool TryGetFontFilename(string fontName, out string filename)
+        {
+            return _sharedFontFilenameDictionary.TryGetValue(fontName, out filename);
+        }
+
         private LocationEntry GetLocation(long titleId, ContentType contentType, StorageId storageId)
         {
             LinkedList<LocationEntry> locationList = _locationEntries[storageId];
-- 
cgit v1.2.3-70-g09d2