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
This commit is contained in:
Alex Barney 2019-05-31 19:31:10 -05:00 committed by Ac_K
parent 92c1726647
commit 5fc1f6a1af
20 changed files with 465 additions and 1169 deletions

View file

@ -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];