From 3541a9053f7728772e3face4221d2a23a67bfed9 Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Thu, 6 Jun 2019 17:01:44 -0500 Subject: [PATCH] Update to LibHac 0.4.1 (#698) * Update to LibHac 0.4.1 Updates the IFile Read and Write methods to use any specified ReadOption and WriteOption * Move casts around --- Ryujinx.HLE/HOS/Horizon.cs | 4 ++-- Ryujinx.HLE/HOS/Services/FspSrv/IFile.cs | 9 +++++---- Ryujinx.HLE/HOS/Services/FspSrv/IFileSystem.cs | 12 ++++++------ Ryujinx.HLE/Ryujinx.HLE.csproj | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Ryujinx.HLE/HOS/Horizon.cs b/Ryujinx.HLE/HOS/Horizon.cs index 0b55ee0a..05b2b28f 100644 --- a/Ryujinx.HLE/HOS/Horizon.cs +++ b/Ryujinx.HLE/HOS/Horizon.cs @@ -260,7 +260,7 @@ namespace Ryujinx.HLE.HOS if (nca.Header.ContentType == ContentType.Program) { - int dataIndex = Nca.SectionIndexFromType(NcaSectionType.Data, ContentType.Program); + int dataIndex = Nca.GetSectionIndexFromType(NcaSectionType.Data, ContentType.Program); if (nca.Header.GetFsHeader(dataIndex).IsPatchSection()) { @@ -338,7 +338,7 @@ namespace Ryujinx.HLE.HOS if (nca.Header.ContentType == ContentType.Program) { - int dataIndex = Nca.SectionIndexFromType(NcaSectionType.Data, ContentType.Program); + int dataIndex = Nca.GetSectionIndexFromType(NcaSectionType.Data, ContentType.Program); if (nca.Header.GetFsHeader(dataIndex).IsPatchSection()) { diff --git a/Ryujinx.HLE/HOS/Services/FspSrv/IFile.cs b/Ryujinx.HLE/HOS/Services/FspSrv/IFile.cs index 3cedf4fe..0b8b31fb 100644 --- a/Ryujinx.HLE/HOS/Services/FspSrv/IFile.cs +++ b/Ryujinx.HLE/HOS/Services/FspSrv/IFile.cs @@ -1,3 +1,4 @@ +using LibHac.Fs; using Ryujinx.HLE.HOS.Ipc; using System; using System.Collections.Generic; @@ -36,7 +37,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv { long position = context.Request.ReceiveBuff[0].Position; - int readOption = context.RequestData.ReadInt32(); + ReadOption readOption = (ReadOption)context.RequestData.ReadInt32(); context.RequestData.BaseStream.Position += 4; long offset = context.RequestData.ReadInt64(); @@ -44,7 +45,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv byte[] data = new byte[size]; - int readSize = _baseFile.Read(data, offset); + int readSize = _baseFile.Read(data, offset, readOption); context.Memory.WriteBytes(position, data); @@ -58,7 +59,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv { long position = context.Request.SendBuff[0].Position; - int writeOption = context.RequestData.ReadInt32(); + WriteOption writeOption = (WriteOption)context.RequestData.ReadInt32(); context.RequestData.BaseStream.Position += 4; long offset = context.RequestData.ReadInt64(); @@ -66,7 +67,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv byte[] data = context.Memory.ReadBytes(position, size); - _baseFile.Write(data, offset); + _baseFile.Write(data, offset, writeOption); return 0; } diff --git a/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystem.cs b/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystem.cs index 9e772213..74ba6216 100644 --- a/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystem.cs +++ b/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystem.cs @@ -50,7 +50,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv { string name = ReadUtf8String(context); - int createOption = context.RequestData.ReadInt32(); + CreateFileOptions createOption = (CreateFileOptions)context.RequestData.ReadInt32(); context.RequestData.BaseStream.Position += 4; long size = context.RequestData.ReadInt64(); @@ -72,7 +72,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv try { - _provider.CreateFile(name, size, (CreateFileOptions)createOption); + _provider.CreateFile(name, size, createOption); } catch (DirectoryNotFoundException) { @@ -323,7 +323,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv // OpenFile(u32 mode, buffer, 0x19, 0x301> path) -> object file public long OpenFile(ServiceCtx context) { - int mode = context.RequestData.ReadInt32(); + OpenMode mode = (OpenMode)context.RequestData.ReadInt32(); string name = ReadUtf8String(context); @@ -341,7 +341,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv try { - LibHac.Fs.IFile file = _provider.OpenFile(name, (OpenMode)mode); + LibHac.Fs.IFile file = _provider.OpenFile(name, mode); fileInterface = new IFile(file, name); } @@ -367,7 +367,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv // OpenDirectory(u32 filter_flags, buffer, 0x19, 0x301> path) -> object directory public long OpenDirectory(ServiceCtx context) { - int mode = context.RequestData.ReadInt32(); + OpenDirectoryMode mode = (OpenDirectoryMode)context.RequestData.ReadInt32(); string name = ReadUtf8String(context); @@ -385,7 +385,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv try { - LibHac.Fs.IDirectory dir = _provider.OpenDirectory(name, (OpenDirectoryMode) mode); + LibHac.Fs.IDirectory dir = _provider.OpenDirectory(name, mode); dirInterface = new IDirectory(dir); } diff --git a/Ryujinx.HLE/Ryujinx.HLE.csproj b/Ryujinx.HLE/Ryujinx.HLE.csproj index 3c42cf54..5079f030 100644 --- a/Ryujinx.HLE/Ryujinx.HLE.csproj +++ b/Ryujinx.HLE/Ryujinx.HLE.csproj @@ -46,7 +46,7 @@ - +