Revert LibHac update

Users are facing save destruction on failing extra data update apparently
This commit is contained in:
Mary 2021-07-13 16:48:54 +02:00
parent 997380d48c
commit 208ba1dde2
32 changed files with 575 additions and 1805 deletions

View file

@ -1,15 +1,13 @@
using LibHac;
using LibHac.Fs;
using LibHac.Sf;
using Ryujinx.Common;
namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
{
class IFile : DisposableIpcService
{
private ReferenceCountedDisposable<LibHac.FsSrv.Sf.IFile> _baseFile;
private LibHac.Fs.Fsa.IFile _baseFile;
public IFile(ReferenceCountedDisposable<LibHac.FsSrv.Sf.IFile> baseFile)
public IFile(LibHac.Fs.Fsa.IFile baseFile)
{
_baseFile = baseFile;
}
@ -20,15 +18,15 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
{
ulong position = context.Request.ReceiveBuff[0].Position;
ReadOption readOption = context.RequestData.ReadStruct<ReadOption>();
ReadOption readOption = new ReadOption(context.RequestData.ReadInt32());
context.RequestData.BaseStream.Position += 4;
long offset = context.RequestData.ReadInt64();
long size = context.RequestData.ReadInt64();
byte[] data = new byte[context.Request.ReceiveBuff[0].Size];
byte[] data = new byte[size];
Result result = _baseFile.Target.Read(out long bytesRead, offset, new OutBuffer(data), size, readOption);
Result result = _baseFile.Read(out long bytesRead, offset, data, readOption);
context.Memory.Write(position, data);
@ -43,24 +41,24 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
{
ulong position = context.Request.SendBuff[0].Position;
WriteOption writeOption = context.RequestData.ReadStruct<WriteOption>();
WriteOption writeOption = new WriteOption(context.RequestData.ReadInt32());
context.RequestData.BaseStream.Position += 4;
long offset = context.RequestData.ReadInt64();
long size = context.RequestData.ReadInt64();
byte[] data = new byte[context.Request.SendBuff[0].Size];
byte[] data = new byte[size];
context.Memory.Read(position, data);
return (ResultCode)_baseFile.Target.Write(offset, new InBuffer(data), size, writeOption).Value;
return (ResultCode)_baseFile.Write(offset, data, writeOption).Value;
}
[CommandHipc(2)]
// Flush()
public ResultCode Flush(ServiceCtx context)
{
return (ResultCode)_baseFile.Target.Flush().Value;
return (ResultCode)_baseFile.Flush().Value;
}
[CommandHipc(3)]
@ -69,14 +67,14 @@ namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
{
long size = context.RequestData.ReadInt64();
return (ResultCode)_baseFile.Target.SetSize(size).Value;
return (ResultCode)_baseFile.SetSize(size).Value;
}
[CommandHipc(4)]
// GetSize() -> u64 fileSize
public ResultCode GetSize(ServiceCtx context)
{
Result result = _baseFile.Target.GetSize(out long size);
Result result = _baseFile.GetSize(out long size);
context.ResponseData.Write(size);