Update to LibHac v0.14.3 (#2925)

* Update to LibHac v0.14.3

* Fix loading NCAs that don't have a data partition
This commit is contained in:
Alex Barney 2021-12-23 09:55:50 -07:00 committed by GitHub
parent cb43cc7e32
commit aa932a6df1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 554 additions and 406 deletions

View file

@ -1,4 +1,5 @@
using LibHac;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Sf;
using Ryujinx.Common;
@ -7,11 +8,11 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
{
class IFile : DisposableIpcService
{
private ReferenceCountedDisposable<LibHac.FsSrv.Sf.IFile> _baseFile;
private SharedRef<LibHac.FsSrv.Sf.IFile> _baseFile;
public IFile(ReferenceCountedDisposable<LibHac.FsSrv.Sf.IFile> baseFile)
public IFile(ref SharedRef<LibHac.FsSrv.Sf.IFile> baseFile)
{
_baseFile = baseFile;
_baseFile = SharedRef<LibHac.FsSrv.Sf.IFile>.CreateMove(ref baseFile);
}
[CommandHipc(0)]
@ -28,7 +29,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
byte[] data = new byte[context.Request.ReceiveBuff[0].Size];
Result result = _baseFile.Target.Read(out long bytesRead, offset, new OutBuffer(data), size, readOption);
Result result = _baseFile.Get.Read(out long bytesRead, offset, new OutBuffer(data), size, readOption);
context.Memory.Write(position, data);
@ -53,14 +54,14 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
context.Memory.Read(position, data);
return (ResultCode)_baseFile.Target.Write(offset, new InBuffer(data), size, writeOption).Value;
return (ResultCode)_baseFile.Get.Write(offset, new InBuffer(data), size, writeOption).Value;
}
[CommandHipc(2)]
// Flush()
public ResultCode Flush(ServiceCtx context)
{
return (ResultCode)_baseFile.Target.Flush().Value;
return (ResultCode)_baseFile.Get.Flush().Value;
}
[CommandHipc(3)]
@ -69,14 +70,14 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
{
long size = context.RequestData.ReadInt64();
return (ResultCode)_baseFile.Target.SetSize(size).Value;
return (ResultCode)_baseFile.Get.SetSize(size).Value;
}
[CommandHipc(4)]
// GetSize() -> u64 fileSize
public ResultCode GetSize(ServiceCtx context)
{
Result result = _baseFile.Target.GetSize(out long size);
Result result = _baseFile.Get.GetSize(out long size);
context.ResponseData.Write(size);
@ -87,7 +88,7 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
{
if (isDisposing)
{
_baseFile?.Dispose();
_baseFile.Destroy();
}
}
}