From 5fc1f6a1af7df0294069cd432c796e6546a4b38d Mon Sep 17 00:00:00 2001 From: Alex Barney 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/HOS/Services/Set/ISystemSettingsServer.cs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'Ryujinx.HLE/HOS/Services/Set') diff --git a/Ryujinx.HLE/HOS/Services/Set/ISystemSettingsServer.cs b/Ryujinx.HLE/HOS/Services/Set/ISystemSettingsServer.cs index 8eec31cf..4a67638b 100644 --- a/Ryujinx.HLE/HOS/Services/Set/ISystemSettingsServer.cs +++ b/Ryujinx.HLE/HOS/Services/Set/ISystemSettingsServer.cs @@ -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); -- cgit v1.2.3