diff options
| author | Alex Barney <thealexbarney@gmail.com> | 2019-05-31 19:31:10 -0500 |
|---|---|---|
| committer | Ac_K <Acoustik666@gmail.com> | 2019-06-01 02:31:10 +0200 |
| commit | 5fc1f6a1af7df0294069cd432c796e6546a4b38d (patch) | |
| tree | 6c3b9b09dece9594a84f3bbb6fdef8a97f643784 /Ryujinx.HLE/HOS/Font | |
| parent | 92c1726647964da9230bc4f4c631a233cd064665 (diff) | |
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
Diffstat (limited to 'Ryujinx.HLE/HOS/Font')
| -rw-r--r-- | Ryujinx.HLE/HOS/Font/SharedFontManager.cs | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/Ryujinx.HLE/HOS/Font/SharedFontManager.cs b/Ryujinx.HLE/HOS/Font/SharedFontManager.cs index 9eb2c7e5..dfb87f3c 100644 --- a/Ryujinx.HLE/HOS/Font/SharedFontManager.cs +++ b/Ryujinx.HLE/HOS/Font/SharedFontManager.cs @@ -1,13 +1,11 @@ -using LibHac; -using LibHac.IO; +using LibHac.Fs; +using LibHac.Fs.NcaUtils; using Ryujinx.HLE.FileSystem; using Ryujinx.HLE.FileSystem.Content; using Ryujinx.HLE.Resource; using Ryujinx.HLE.Utilities; using System.Collections.Generic; using System.IO; -using System.Linq; - using static Ryujinx.HLE.Utilities.FontUtils; namespace Ryujinx.HLE.HOS.Font @@ -53,29 +51,21 @@ namespace Ryujinx.HLE.HOS.Font FontInfo CreateFont(string name) { - if (contentManager.TryGetFontTitle(name, out long fontTitle)) + if (contentManager.TryGetFontTitle(name, out long fontTitle) && + contentManager.TryGetFontFilename(name, out string fontFilename)) { string contentPath = contentManager.GetInstalledContentPath(fontTitle, StorageId.NandSystem, ContentType.Data); string fontPath = _device.FileSystem.SwitchPathToSystemPath(contentPath); if (!string.IsNullOrWhiteSpace(fontPath)) { - int fileIndex = 0; - - //Use second file in Chinese Font title for standard - if(name == "FontChineseSimplified") - { - fileIndex = 1; - } - byte[] data; - using (FileStream ncaFileStream = new FileStream(fontPath, FileMode.Open, FileAccess.Read)) + using (IStorage ncaFileStream = new LocalStorage(fontPath, FileAccess.Read, FileMode.Open)) { - Nca nca = new Nca(_device.System.KeySet, ncaFileStream.AsStorage(), false); - NcaSection romfsSection = nca.Sections.FirstOrDefault(x => x?.Type == SectionType.Romfs); - Romfs romfs = new Romfs(nca.OpenSection(romfsSection.SectionNum, false, _device.System.FsIntegrityCheckLevel, false)); - Stream fontFile = romfs.OpenFile(romfs.Files[fileIndex]).AsStream(); + Nca nca = new Nca(_device.System.KeySet, ncaFileStream); + IFileSystem romfs = nca.OpenFileSystem(NcaSectionType.Data, _device.System.FsIntegrityCheckLevel); + Stream fontFile = romfs.OpenFile(fontFilename, OpenMode.Read).AsStream(); data = DecryptFont(fontFile); } |
