mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-21 10:25:08 -04:00
fssystem: add RomFsFileSystem
This commit is contained in:
parent
a50d6a2696
commit
8d1ada2a1b
17 changed files with 2057 additions and 21 deletions
|
@ -233,6 +233,13 @@ namespace ams::fs {
|
|||
{
|
||||
R_UNLESS(offset >= 0, fs::ResultOutOfRange());
|
||||
R_UNLESS(this->GetSize() >= 0, fs::ResultOutOfRange());
|
||||
|
||||
auto operate_size = size;
|
||||
if (offset + operate_size > this->GetSize() || offset + operate_size < offset) {
|
||||
operate_size = this->GetSize() - offset;
|
||||
}
|
||||
|
||||
return this->GetStorage()->OperateRange(dst, dst_size, op_id, this->start + offset, operate_size, src, src_size);
|
||||
}
|
||||
default:
|
||||
return fs::ResultUnsupportedOperationInRomFsFileB();
|
||||
|
@ -481,7 +488,7 @@ namespace ams::fs {
|
|||
AMS_ASSERT(out_file != nullptr);
|
||||
AMS_ASSERT(path != nullptr);
|
||||
|
||||
R_UNLESS((mode & fs::OpenMode_All) == fs::OpenMode_Read, fs::ResultInvalidArgument());
|
||||
R_UNLESS((mode & fs::OpenMode_All) == fs::OpenMode_Read, fs::ResultInvalidOpenMode());
|
||||
|
||||
RomFileTable::FileInfo file_info;
|
||||
R_TRY(this->GetFileInfo(std::addressof(file_info), path));
|
||||
|
@ -515,7 +522,8 @@ namespace ams::fs {
|
|||
}
|
||||
|
||||
Result RomFsFileSystem::GetFreeSpaceSizeImpl(s64 *out, const char *path) {
|
||||
return fs::ResultUnsupportedOperationInRomFsFileSystemC();
|
||||
*out = 0;
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
Result RomFsFileSystem::GetTotalSpaceSizeImpl(s64 *out, const char *path) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue