2021-07-13 01:19:28 -07:00
|
|
|
|
using LibHac;
|
|
|
|
|
using LibHac.Sf;
|
2020-01-05 03:49:44 -08:00
|
|
|
|
|
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Fs
|
|
|
|
|
{
|
2021-06-29 10:37:13 -07:00
|
|
|
|
class ISaveDataInfoReader : DisposableIpcService
|
2020-01-05 03:49:44 -08:00
|
|
|
|
{
|
2021-07-13 01:19:28 -07:00
|
|
|
|
private ReferenceCountedDisposable<LibHac.FsSrv.Sf.ISaveDataInfoReader> _baseReader;
|
2020-01-05 03:49:44 -08:00
|
|
|
|
|
2021-07-13 01:19:28 -07:00
|
|
|
|
public ISaveDataInfoReader(ReferenceCountedDisposable<LibHac.FsSrv.Sf.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)
|
|
|
|
|
{
|
2021-04-24 03:16:01 -07:00
|
|
|
|
ulong bufferPosition = context.Request.ReceiveBuff[0].Position;
|
|
|
|
|
ulong bufferLen = context.Request.ReceiveBuff[0].Size;
|
2020-01-05 03:49:44 -08:00
|
|
|
|
|
|
|
|
|
byte[] infoBuffer = new byte[bufferLen];
|
|
|
|
|
|
2021-07-13 01:19:28 -07:00
|
|
|
|
Result result = _baseReader.Target.Read(out long readCount, new OutBuffer(infoBuffer));
|
2020-01-05 03:49:44 -08:00
|
|
|
|
|
2021-04-24 03:16:01 -07:00
|
|
|
|
context.Memory.Write(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
|
|
|
|
|
2021-06-29 10:37:13 -07:00
|
|
|
|
protected override void Dispose(bool isDisposing)
|
2020-09-01 13:08:59 -07:00
|
|
|
|
{
|
2021-06-29 10:37:13 -07:00
|
|
|
|
if (isDisposing)
|
|
|
|
|
{
|
|
|
|
|
_baseReader?.Dispose();
|
|
|
|
|
}
|
2020-09-01 13:08:59 -07:00
|
|
|
|
}
|
2020-01-05 03:49:44 -08:00
|
|
|
|
}
|
|
|
|
|
}
|