summaryrefslogtreecommitdiffstats
path: root/src/core/file_sys/ivfc_archive.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2016-03-20 21:11:49 +0100
committerbunnei <bunneidev@gmail.com>2016-03-20 21:11:49 +0100
commitb83e95727f95fa6fe35d436be3e821605244a6a8 (patch)
tree64255c7432e882205a2dbea1fe962025863664ee /src/core/file_sys/ivfc_archive.cpp
parentMerge pull request #1550 from LittleWhite-tb/gdbstub_include_fix (diff)
parentHLE/FS: Change the error code returned when an ExtSaveData archive is not found. (diff)
downloadyuzu-b83e95727f95fa6fe35d436be3e821605244a6a8.tar
yuzu-b83e95727f95fa6fe35d436be3e821605244a6a8.tar.gz
yuzu-b83e95727f95fa6fe35d436be3e821605244a6a8.tar.bz2
yuzu-b83e95727f95fa6fe35d436be3e821605244a6a8.tar.lz
yuzu-b83e95727f95fa6fe35d436be3e821605244a6a8.tar.xz
yuzu-b83e95727f95fa6fe35d436be3e821605244a6a8.tar.zst
yuzu-b83e95727f95fa6fe35d436be3e821605244a6a8.zip
Diffstat (limited to 'src/core/file_sys/ivfc_archive.cpp')
-rw-r--r--src/core/file_sys/ivfc_archive.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/core/file_sys/ivfc_archive.cpp b/src/core/file_sys/ivfc_archive.cpp
index 2efc31a8c..a8e9a72ef 100644
--- a/src/core/file_sys/ivfc_archive.cpp
+++ b/src/core/file_sys/ivfc_archive.cpp
@@ -20,13 +20,15 @@ std::string IVFCArchive::GetName() const {
return "IVFC";
}
-std::unique_ptr<FileBackend> IVFCArchive::OpenFile(const Path& path, const Mode mode) const {
- return Common::make_unique<IVFCFile>(romfs_file, data_offset, data_size);
+ResultVal<std::unique_ptr<FileBackend>> IVFCArchive::OpenFile(const Path& path, const Mode mode) const {
+ return MakeResult<std::unique_ptr<FileBackend>>(Common::make_unique<IVFCFile>(romfs_file, data_offset, data_size));
}
-bool IVFCArchive::DeleteFile(const Path& path) const {
+ResultCode IVFCArchive::DeleteFile(const Path& path) const {
LOG_CRITICAL(Service_FS, "Attempted to delete a file from an IVFC archive (%s).", GetName().c_str());
- return false;
+ // TODO(Subv): Verify error code
+ return ResultCode(ErrorDescription::NoData, ErrorModule::FS,
+ ErrorSummary::Canceled, ErrorLevel::Status);
}
bool IVFCArchive::RenameFile(const Path& src_path, const Path& dest_path) const {
@@ -39,7 +41,7 @@ bool IVFCArchive::DeleteDirectory(const Path& path) const {
return false;
}
-ResultCode IVFCArchive::CreateFile(const Path& path, u32 size) const {
+ResultCode IVFCArchive::CreateFile(const Path& path, u64 size) const {
LOG_CRITICAL(Service_FS, "Attempted to create a file in an IVFC archive (%s).", GetName().c_str());
// TODO: Verify error code
return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::FS, ErrorSummary::NotSupported, ErrorLevel::Permanent);
@@ -66,17 +68,18 @@ u64 IVFCArchive::GetFreeBytes() const {
////////////////////////////////////////////////////////////////////////////////////////////////////
-size_t IVFCFile::Read(const u64 offset, const size_t length, u8* buffer) const {
+ResultVal<size_t> IVFCFile::Read(const u64 offset, const size_t length, u8* buffer) const {
LOG_TRACE(Service_FS, "called offset=%llu, length=%zu", offset, length);
romfs_file->Seek(data_offset + offset, SEEK_SET);
size_t read_length = (size_t)std::min((u64)length, data_size - offset);
- return romfs_file->ReadBytes(buffer, read_length);
+ return MakeResult<size_t>(romfs_file->ReadBytes(buffer, read_length));
}
-size_t IVFCFile::Write(const u64 offset, const size_t length, const bool flush, const u8* buffer) const {
+ResultVal<size_t> IVFCFile::Write(const u64 offset, const size_t length, const bool flush, const u8* buffer) const {
LOG_ERROR(Service_FS, "Attempted to write to IVFC file");
- return 0;
+ // TODO(Subv): Find error code
+ return MakeResult<size_t>(0);
}
u64 IVFCFile::GetSize() const {