2020-09-01 13:08:59 -07:00
|
|
|
|
using System;
|
|
|
|
|
using LibHac;
|
2020-01-05 03:49:44 -08:00
|
|
|
|
|
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Fs
|
|
|
|
|
{
|
2020-09-01 13:08:59 -07:00
|
|
|
|
class ISaveDataInfoReader : IpcService, IDisposable
|
2020-01-05 03:49:44 -08:00
|
|
|
|
{
|
2020-09-01 13:08:59 -07:00
|
|
|
|
private ReferenceCountedDisposable<LibHac.FsSrv.ISaveDataInfoReader> _baseReader;
|
2020-01-05 03:49:44 -08:00
|
|
|
|
|
2020-09-01 13:08:59 -07:00
|
|
|
|
public ISaveDataInfoReader(ReferenceCountedDisposable<LibHac.FsSrv.ISaveDataInfoReader> baseReader)
|
2020-01-05 03:49:44 -08:00
|
|
|
|
{
|
|
|
|
|
_baseReader = baseReader;
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-13 15:01:24 -07:00
|
|
|
|
[CommandHipc(0)]
|
2020-01-05 03:49:44 -08:00
|
|
|
|
// ReadSaveDataInfo() -> (u64, buffer<unknown, 6>)
|
|
|
|
|
public ResultCode ReadSaveDataInfo(ServiceCtx context)
|
|
|
|
|
{
|
|
|
|
|
long bufferPosition = context.Request.ReceiveBuff[0].Position;
|
|
|
|
|
long bufferLen = context.Request.ReceiveBuff[0].Size;
|
|
|
|
|
|
|
|
|
|
byte[] infoBuffer = new byte[bufferLen];
|
|
|
|
|
|
2020-09-01 13:08:59 -07:00
|
|
|
|
Result result = _baseReader.Target.Read(out long readCount, infoBuffer);
|
2020-01-05 03:49:44 -08:00
|
|
|
|
|
2020-05-03 15:54:50 -07:00
|
|
|
|
context.Memory.Write((ulong)bufferPosition, infoBuffer);
|
2020-01-05 03:49:44 -08:00
|
|
|
|
context.ResponseData.Write(readCount);
|
|
|
|
|
|
|
|
|
|
return (ResultCode)result.Value;
|
|
|
|
|
}
|
2020-09-01 13:08:59 -07:00
|
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
|
{
|
|
|
|
|
_baseReader.Dispose();
|
|
|
|
|
}
|
2020-01-05 03:49:44 -08:00
|
|
|
|
}
|
|
|
|
|
}
|