2021-08-12 21:56:24 +00:00
|
|
|
|
using LibHac;
|
2021-12-23 16:55:50 +00:00
|
|
|
|
using LibHac.Common;
|
2021-08-12 21:56:24 +00:00
|
|
|
|
using LibHac.Sf;
|
2020-01-05 11:49:44 +00:00
|
|
|
|
|
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Fs
|
|
|
|
|
{
|
2021-06-29 17:37:13 +00:00
|
|
|
|
class ISaveDataInfoReader : DisposableIpcService
|
2020-01-05 11:49:44 +00:00
|
|
|
|
{
|
2021-12-23 16:55:50 +00:00
|
|
|
|
private SharedRef<LibHac.FsSrv.Sf.ISaveDataInfoReader> _baseReader;
|
2020-01-05 11:49:44 +00:00
|
|
|
|
|
2021-12-23 16:55:50 +00:00
|
|
|
|
public ISaveDataInfoReader(ref SharedRef<LibHac.FsSrv.Sf.ISaveDataInfoReader> baseReader)
|
2020-01-05 11:49:44 +00:00
|
|
|
|
{
|
2021-12-23 16:55:50 +00:00
|
|
|
|
_baseReader = SharedRef<LibHac.FsSrv.Sf.ISaveDataInfoReader>.CreateMove(ref baseReader);
|
2020-01-05 11:49:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-04-14 23:00:34 +00:00
|
|
|
|
[CommandCmif(0)]
|
2020-01-05 11:49:44 +00:00
|
|
|
|
// ReadSaveDataInfo() -> (u64, buffer<unknown, 6>)
|
|
|
|
|
public ResultCode ReadSaveDataInfo(ServiceCtx context)
|
|
|
|
|
{
|
2022-10-04 23:12:54 +00:00
|
|
|
|
ulong bufferAddress = context.Request.ReceiveBuff[0].Position;
|
2021-12-23 16:55:50 +00:00
|
|
|
|
ulong bufferLen = context.Request.ReceiveBuff[0].Size;
|
2020-01-05 11:49:44 +00:00
|
|
|
|
|
2022-10-04 23:12:54 +00:00
|
|
|
|
using (var region = context.Memory.GetWritableRegion(bufferAddress, (int)bufferLen, true))
|
|
|
|
|
{
|
|
|
|
|
Result result = _baseReader.Get.Read(out long readCount, new OutBuffer(region.Memory.Span));
|
2020-01-05 11:49:44 +00:00
|
|
|
|
|
2022-10-04 23:12:54 +00:00
|
|
|
|
context.ResponseData.Write(readCount);
|
2020-01-05 11:49:44 +00:00
|
|
|
|
|
2022-10-04 23:12:54 +00:00
|
|
|
|
return (ResultCode)result.Value;
|
|
|
|
|
}
|
2020-01-05 11:49:44 +00:00
|
|
|
|
}
|
2020-09-01 20:08:59 +00:00
|
|
|
|
|
2021-06-29 17:37:13 +00:00
|
|
|
|
protected override void Dispose(bool isDisposing)
|
2020-09-01 20:08:59 +00:00
|
|
|
|
{
|
2021-06-29 17:37:13 +00:00
|
|
|
|
if (isDisposing)
|
|
|
|
|
{
|
2021-12-23 16:55:50 +00:00
|
|
|
|
_baseReader.Destroy();
|
2021-06-29 17:37:13 +00:00
|
|
|
|
}
|
2020-09-01 20:08:59 +00:00
|
|
|
|
}
|
2020-01-05 11:49:44 +00:00
|
|
|
|
}
|
|
|
|
|
}
|