0
0
Fork 0
This repository has been archived on 2024-10-12. You can view files and clone it, but cannot push or open issues or pull requests.
ryujinx-final/Ryujinx.HLE/HOS/Services/Fs/FileSystemProxy/IDirectory.cs
Alex Barney aa932a6df1
Update to LibHac v0.14.3 (#2925)
* Update to LibHac v0.14.3

* Fix loading NCAs that don't have a data partition
2021-12-23 13:55:50 -03:00

52 lines
1.5 KiB
C#

using LibHac;
using LibHac.Common;
using LibHac.Sf;
namespace Ryujinx.HLE.HOS.Services.Fs.FileSystemProxy
{
class IDirectory : DisposableIpcService
{
private SharedRef<LibHac.FsSrv.Sf.IDirectory> _baseDirectory;
public IDirectory(ref SharedRef<LibHac.FsSrv.Sf.IDirectory> directory)
{
_baseDirectory = SharedRef<LibHac.FsSrv.Sf.IDirectory>.CreateMove(ref directory);
}
[CommandHipc(0)]
// Read() -> (u64 count, buffer<nn::fssrv::sf::IDirectoryEntry, 6, 0> entries)
public ResultCode Read(ServiceCtx context)
{
ulong bufferPosition = context.Request.ReceiveBuff[0].Position;
ulong bufferLen = context.Request.ReceiveBuff[0].Size;
byte[] entryBuffer = new byte[bufferLen];
Result result = _baseDirectory.Get.Read(out long entriesRead, new OutBuffer(entryBuffer));
context.Memory.Write(bufferPosition, entryBuffer);
context.ResponseData.Write(entriesRead);
return (ResultCode)result.Value;
}
[CommandHipc(1)]
// GetEntryCount() -> u64
public ResultCode GetEntryCount(ServiceCtx context)
{
Result result = _baseDirectory.Get.GetEntryCount(out long entryCount);
context.ResponseData.Write(entryCount);
return (ResultCode)result.Value;
}
protected override void Dispose(bool isDisposing)
{
if (isDisposing)
{
_baseDirectory.Destroy();
}
}
}
}