77 static_assert(std::is_base_of_v<NitroFsFileFormat, T>);
84 bool ExistsImpl(
const std::string &
path,
size_t &
out_size)
override {
86 if(this->ext_fs_file->LookupFile(
path, file).IsSuccess()) {
95 Result OpenImpl(
const std::string &
path)
override {
96 NTR_R_TRY(this->ext_fs_file->LookupFile(
path,
this->file));
98 NTR_R_TRY(this->base_bf.Open(
this->ext_fs_file->read_file_handle,
this->ext_fs_file->read_path, fs::OpenMode::Read,
this->ext_fs_file->comp));
99 const auto f_base_offset = this->ext_fs_file->GetBaseOffset() + this->file.offset;
110 Result SetOffsetImpl(
const size_t offset,
const fs::Position
pos)
override {
111 const auto f_base_offset = this->ext_fs_file->GetBaseOffset() + this->file.offset;
118 case fs::Position::Begin: {
119 if(offset > this->file.size) {
120 NTR_R_FAIL(ResultEndOfData);
123 return this->base_bf.SetAbsoluteOffset(
f_base_offset + offset);
126 case fs::Position::Current: {
128 NTR_R_FAIL(ResultEndOfData);
135 NTR_R_FAIL(ResultInvalidSeekPosition);
141 const auto f_base_offset = this->ext_fs_file->GetBaseOffset() + this->file.offset;
152 NTR_R_TRY(this->GetOffsetImpl(offset));
161 NTR_R_FAIL(ResultEndOfData);
165 Result CloseImpl()
override {
166 return this->base_bf.Close();
Definition nfs_NitroFs.hpp:17
Definition nfs_NitroFs.hpp:22