aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Settings/ISystemSettingsServer.cs
diff options
context:
space:
mode:
authorAlex Barney <thealexbarney@gmail.com>2019-10-17 01:17:44 -0500
committerAc_K <Acoustik666@gmail.com>2019-10-17 08:17:44 +0200
commit8a8ea4c8c00e8ba23349d9cdb0a6b681d09e6b0d (patch)
treeaee0876fbc6e5f9fd2808d942297938ab3ab9495 /Ryujinx.HLE/HOS/Services/Settings/ISystemSettingsServer.cs
parentc0fe6cdca0ebe6b19f8578893ec503d432683897 (diff)
Update to LibHac 0.6.0 (#792)
* Update to LibHac 0.6.0 * Create an IFileSystemProxy object from LibHac * Rename rc -> result * Alignment and spacing * Result formatting * Spacing * Sort usings
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Settings/ISystemSettingsServer.cs')
-rw-r--r--Ryujinx.HLE/HOS/Services/Settings/ISystemSettingsServer.cs26
1 files changed, 21 insertions, 5 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Settings/ISystemSettingsServer.cs b/Ryujinx.HLE/HOS/Services/Settings/ISystemSettingsServer.cs
index 7af78dbf..490d0e8e 100644
--- a/Ryujinx.HLE/HOS/Services/Settings/ISystemSettingsServer.cs
+++ b/Ryujinx.HLE/HOS/Services/Settings/ISystemSettingsServer.cs
@@ -1,5 +1,7 @@
+using LibHac;
using LibHac.Fs;
-using LibHac.Fs.NcaUtils;
+using LibHac.FsSystem;
+using LibHac.FsSystem.NcaUtils;
using Ryujinx.Common.Logging;
using Ryujinx.HLE.FileSystem;
using Ryujinx.HLE.HOS.SystemState;
@@ -165,7 +167,7 @@ namespace Ryujinx.HLE.HOS.Services.Settings
public byte[] GetFirmwareData(Switch device)
{
long titleId = 0x0100000000000809;
- string contentPath = device.System.ContentManager.GetInstalledContentPath(titleId, StorageId.NandSystem, ContentType.Data);
+ string contentPath = device.System.ContentManager.GetInstalledContentPath(titleId, StorageId.NandSystem, NcaContentType.Data);
if (string.IsNullOrWhiteSpace(contentPath))
{
@@ -185,11 +187,25 @@ namespace Ryujinx.HLE.HOS.Services.Settings
IFileSystem firmwareRomFs = firmwareContent.OpenFileSystem(NcaSectionType.Data, device.System.FsIntegrityCheckLevel);
- IFile firmwareFile = firmwareRomFs.OpenFile("/file", OpenMode.Read);
+ Result result = firmwareRomFs.OpenFile(out IFile firmwareFile, "/file", OpenMode.Read);
+ if (result.IsFailure())
+ {
+ return null;
+ }
+
+ result = firmwareFile.GetSize(out long fileSize);
+ if (result.IsFailure())
+ {
+ return null;
+ }
- byte[] data = new byte[firmwareFile.GetSize()];
+ byte[] data = new byte[fileSize];
- firmwareFile.Read(data, 0);
+ result = firmwareFile.Read(out _, 0, data);
+ if (result.IsFailure())
+ {
+ return null;
+ }
return data;
}