diff options
| author | Alex Barney <thealexbarney@gmail.com> | 2019-01-04 17:41:49 -0700 |
|---|---|---|
| committer | Ac_K <Acoustik666@gmail.com> | 2019-01-05 01:41:49 +0100 |
| commit | 290f5e812e68e47d95aba0cc3789a4bc6d04c7ce (patch) | |
| tree | ffe7b55c31c913e002afe55db1f68107cd1da854 /Ryujinx.HLE/HOS/Font/SharedFontManager.cs | |
| parent | cf147f1e4977a2dfe197d00341739b72a0e3a129 (diff) | |
Update to LibHac 0.2.0 (#549)
* Update to LibHac 0.2.0
* Changes based on feedback
Diffstat (limited to 'Ryujinx.HLE/HOS/Font/SharedFontManager.cs')
| -rw-r--r-- | Ryujinx.HLE/HOS/Font/SharedFontManager.cs | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/Ryujinx.HLE/HOS/Font/SharedFontManager.cs b/Ryujinx.HLE/HOS/Font/SharedFontManager.cs index 31c8178a..9eb2c7e5 100644 --- a/Ryujinx.HLE/HOS/Font/SharedFontManager.cs +++ b/Ryujinx.HLE/HOS/Font/SharedFontManager.cs @@ -1,4 +1,5 @@ using LibHac; +using LibHac.IO; using Ryujinx.HLE.FileSystem; using Ryujinx.HLE.FileSystem.Content; using Ryujinx.HLE.Resource; @@ -67,14 +68,18 @@ namespace Ryujinx.HLE.HOS.Font fileIndex = 1; } - FileStream ncaFileStream = new FileStream(fontPath, FileMode.Open, FileAccess.Read); - Nca nca = new Nca(_device.System.KeySet, ncaFileStream, false); - NcaSection romfsSection = nca.Sections.FirstOrDefault(x => x?.Type == SectionType.Romfs); - Romfs romfs = new Romfs(nca.OpenSection(romfsSection.SectionNum, false, _device.System.FsIntegrityCheckLevel)); - Stream fontFile = romfs.OpenFile(romfs.Files[fileIndex]); - - byte[] data = DecryptFont(fontFile); + byte[] data; + + using (FileStream ncaFileStream = new FileStream(fontPath, FileMode.Open, FileAccess.Read)) + { + 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(); + data = DecryptFont(fontFile); + } + FontInfo info = new FontInfo((int)fontOffset, data.Length); WriteMagicAndSize(_physicalAddress + fontOffset, data.Length); @@ -88,9 +93,6 @@ namespace Ryujinx.HLE.HOS.Font _device.Memory.WriteByte(_physicalAddress + fontOffset, data[fontOffset - start]); } - ncaFileStream.Dispose(); - nca.Dispose(); - return info; } } |
