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
This commit is contained in:
Alex Barney 2019-06-06 17:01:44 -05:00 committed by Ac_K
parent 6fbe87cccc
commit 3541a9053f
4 changed files with 14 additions and 13 deletions

View file

@ -260,7 +260,7 @@ namespace Ryujinx.HLE.HOS
if (nca.Header.ContentType == ContentType.Program) 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()) if (nca.Header.GetFsHeader(dataIndex).IsPatchSection())
{ {
@ -338,7 +338,7 @@ namespace Ryujinx.HLE.HOS
if (nca.Header.ContentType == ContentType.Program) 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()) if (nca.Header.GetFsHeader(dataIndex).IsPatchSection())
{ {

View file

@ -1,3 +1,4 @@
using LibHac.Fs;
using Ryujinx.HLE.HOS.Ipc; using Ryujinx.HLE.HOS.Ipc;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -36,7 +37,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
{ {
long position = context.Request.ReceiveBuff[0].Position; long position = context.Request.ReceiveBuff[0].Position;
int readOption = context.RequestData.ReadInt32(); ReadOption readOption = (ReadOption)context.RequestData.ReadInt32();
context.RequestData.BaseStream.Position += 4; context.RequestData.BaseStream.Position += 4;
long offset = context.RequestData.ReadInt64(); long offset = context.RequestData.ReadInt64();
@ -44,7 +45,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
byte[] data = new byte[size]; byte[] data = new byte[size];
int readSize = _baseFile.Read(data, offset); int readSize = _baseFile.Read(data, offset, readOption);
context.Memory.WriteBytes(position, data); context.Memory.WriteBytes(position, data);
@ -58,7 +59,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
{ {
long position = context.Request.SendBuff[0].Position; long position = context.Request.SendBuff[0].Position;
int writeOption = context.RequestData.ReadInt32(); WriteOption writeOption = (WriteOption)context.RequestData.ReadInt32();
context.RequestData.BaseStream.Position += 4; context.RequestData.BaseStream.Position += 4;
long offset = context.RequestData.ReadInt64(); long offset = context.RequestData.ReadInt64();
@ -66,7 +67,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
byte[] data = context.Memory.ReadBytes(position, size); byte[] data = context.Memory.ReadBytes(position, size);
_baseFile.Write(data, offset); _baseFile.Write(data, offset, writeOption);
return 0; return 0;
} }

View file

@ -50,7 +50,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
{ {
string name = ReadUtf8String(context); string name = ReadUtf8String(context);
int createOption = context.RequestData.ReadInt32(); CreateFileOptions createOption = (CreateFileOptions)context.RequestData.ReadInt32();
context.RequestData.BaseStream.Position += 4; context.RequestData.BaseStream.Position += 4;
long size = context.RequestData.ReadInt64(); long size = context.RequestData.ReadInt64();
@ -72,7 +72,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
try try
{ {
_provider.CreateFile(name, size, (CreateFileOptions)createOption); _provider.CreateFile(name, size, createOption);
} }
catch (DirectoryNotFoundException) catch (DirectoryNotFoundException)
{ {
@ -323,7 +323,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
// OpenFile(u32 mode, buffer<bytes<0x301>, 0x19, 0x301> path) -> object<nn::fssrv::sf::IFile> file // OpenFile(u32 mode, buffer<bytes<0x301>, 0x19, 0x301> path) -> object<nn::fssrv::sf::IFile> file
public long OpenFile(ServiceCtx context) public long OpenFile(ServiceCtx context)
{ {
int mode = context.RequestData.ReadInt32(); OpenMode mode = (OpenMode)context.RequestData.ReadInt32();
string name = ReadUtf8String(context); string name = ReadUtf8String(context);
@ -341,7 +341,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
try try
{ {
LibHac.Fs.IFile file = _provider.OpenFile(name, (OpenMode)mode); LibHac.Fs.IFile file = _provider.OpenFile(name, mode);
fileInterface = new IFile(file, name); fileInterface = new IFile(file, name);
} }
@ -367,7 +367,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
// OpenDirectory(u32 filter_flags, buffer<bytes<0x301>, 0x19, 0x301> path) -> object<nn::fssrv::sf::IDirectory> directory // OpenDirectory(u32 filter_flags, buffer<bytes<0x301>, 0x19, 0x301> path) -> object<nn::fssrv::sf::IDirectory> directory
public long OpenDirectory(ServiceCtx context) public long OpenDirectory(ServiceCtx context)
{ {
int mode = context.RequestData.ReadInt32(); OpenDirectoryMode mode = (OpenDirectoryMode)context.RequestData.ReadInt32();
string name = ReadUtf8String(context); string name = ReadUtf8String(context);
@ -385,7 +385,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
try try
{ {
LibHac.Fs.IDirectory dir = _provider.OpenDirectory(name, (OpenDirectoryMode) mode); LibHac.Fs.IDirectory dir = _provider.OpenDirectory(name, mode);
dirInterface = new IDirectory(dir); dirInterface = new IDirectory(dir);
} }

View file

@ -46,7 +46,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Concentus" Version="1.1.7" /> <PackageReference Include="Concentus" Version="1.1.7" />
<PackageReference Include="LibHac" Version="0.4.0" /> <PackageReference Include="LibHac" Version="0.4.1" />
</ItemGroup> </ItemGroup>
</Project> </Project>