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.Common.Logging;
using Ryujinx.HLE.FileSystem;
using Ryujinx.HLE.HOS.Ipc;
@ -184,21 +184,20 @@ namespace Ryujinx.HLE.HOS.Services.Set
string firmwareTitlePath = device.FileSystem.SwitchPathToSystemPath(contentPath);
using(FileStream firmwareStream = File.Open(firmwareTitlePath, FileMode.Open, FileAccess.Read))
{
Nca firmwareContent = new Nca(device.System.KeySet, firmwareStream.AsStorage(), false);
IStorage romFsStorage = firmwareContent.OpenSection(0, false, device.System.FsIntegrityCheckLevel, false);
using(IStorage firmwareStorage = new LocalStorage(firmwareTitlePath, FileAccess.Read))
{
Nca firmwareContent = new Nca(device.System.KeySet, firmwareStorage);
if(romFsStorage == null)
if (!firmwareContent.CanOpenSection(NcaSectionType.Data))
{
return null;
}
Romfs firmwareRomFs = new Romfs(romFsStorage);
IFileSystem firmwareRomFs = firmwareContent.OpenFileSystem(NcaSectionType.Data, device.System.FsIntegrityCheckLevel);
IStorage firmwareFile = firmwareRomFs.OpenFile("/file");
IFile firmwareFile = firmwareRomFs.OpenFile("/file", OpenMode.Read);
byte[] data = new byte[firmwareFile.Length];
byte[] data = new byte[firmwareFile.GetSize()];
firmwareFile.Read(data, 0);