Implement IDirectory::GetEntryCount

This commit is contained in:
Billy Laws 2022-06-02 00:01:09 +01:00
parent c15b3a8d40
commit 0c11d9e294
2 changed files with 15 additions and 1 deletions

View File

@ -40,7 +40,14 @@ namespace skyline::service::fssrv {
span(outputEntries[i].name).copy_from(entry.name);
}
remainingReadCount += i;
response.Push<u64>(i);
return {};
}
Result IDirectory::GetEntryCount(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
auto entries{backing->Read()};
response.Push<u64>(entries.size() - remainingReadCount);
return {};
}
}

View File

@ -17,6 +17,7 @@ namespace skyline::service::fssrv {
private:
std::shared_ptr<vfs::Directory> backing; //!< Backing directory of the IDirectory
std::shared_ptr<vfs::FileSystem> backingFs; //!< Backing filesystem of the IDirectory
u32 remainingReadCount{};
public:
IDirectory(std::shared_ptr<vfs::Directory> backing, std::shared_ptr<vfs::FileSystem> backingFs, const DeviceState &state, ServiceManager &manager);
@ -26,8 +27,14 @@ namespace skyline::service::fssrv {
*/
Result Read(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
/**
* @url https://switchbrew.org/wiki/Filesystem_services#GetEntryCount
*/
Result GetEntryCount(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
SERVICE_DECL(
SFUNC(0x0, IDirectory, Read),
SFUNC(0x1, IDirectory, GetEntryCount)
)
};
}