summaryrefslogtreecommitdiffstats
path: root/src/core/file_sys
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/file_sys')
-rw-r--r--src/core/file_sys/archive_backend.cpp35
-rw-r--r--src/core/file_sys/archive_backend.h33
-rw-r--r--src/core/file_sys/archive_extsavedata.cpp23
-rw-r--r--src/core/file_sys/archive_extsavedata.h16
-rw-r--r--src/core/file_sys/archive_romfs.cpp9
-rw-r--r--src/core/file_sys/archive_romfs.h6
-rw-r--r--src/core/file_sys/archive_savedata.cpp40
-rw-r--r--src/core/file_sys/archive_savedata.h5
-rw-r--r--src/core/file_sys/archive_savedatacheck.cpp18
-rw-r--r--src/core/file_sys/archive_savedatacheck.h5
-rw-r--r--src/core/file_sys/archive_sdmc.cpp8
-rw-r--r--src/core/file_sys/archive_sdmc.h5
-rw-r--r--src/core/file_sys/archive_systemsavedata.cpp12
-rw-r--r--src/core/file_sys/archive_systemsavedata.h9
-rw-r--r--src/core/file_sys/directory_backend.h20
-rw-r--r--src/core/file_sys/disk_archive.cpp51
-rw-r--r--src/core/file_sys/disk_archive.h9
-rw-r--r--src/core/file_sys/file_backend.h8
-rw-r--r--src/core/file_sys/ivfc_archive.cpp36
-rw-r--r--src/core/file_sys/ivfc_archive.h27
20 files changed, 204 insertions, 171 deletions
diff --git a/src/core/file_sys/archive_backend.cpp b/src/core/file_sys/archive_backend.cpp
index cc0aa7022..1fae0ede0 100644
--- a/src/core/file_sys/archive_backend.cpp
+++ b/src/core/file_sys/archive_backend.cpp
@@ -5,34 +5,28 @@
#include <cstddef>
#include <iomanip>
#include <sstream>
-
#include "common/logging/log.h"
#include "common/string_util.h"
-
#include "core/file_sys/archive_backend.h"
#include "core/memory.h"
-
namespace FileSys {
Path::Path(LowPathType type, u32 size, u32 pointer) : type(type) {
switch (type) {
- case Binary:
- {
+ case Binary: {
binary.resize(size);
Memory::ReadBlock(pointer, binary.data(), binary.size());
break;
}
- case Char:
- {
+ case Char: {
string.resize(size - 1); // Data is always null-terminated.
Memory::ReadBlock(pointer, &string[0], string.size());
break;
}
- case Wchar:
- {
+ case Wchar: {
u16str.resize(size / 2 - 1); // Data is always null-terminated.
Memory::ReadBlock(pointer, &u16str[0], u16str.size() * sizeof(char16_t));
break;
@@ -50,8 +44,7 @@ std::string Path::DebugStr() const {
return "[Invalid]";
case Empty:
return "[Empty]";
- case Binary:
- {
+ case Binary: {
std::stringstream res;
res << "[Binary: ";
for (unsigned byte : binary)
@@ -73,13 +66,13 @@ std::string Path::AsString() const {
case Wchar:
return Common::UTF16ToUTF8(u16str);
case Empty:
- return{};
+ return {};
case Invalid:
case Binary:
default:
// TODO(yuriks): Add assert
LOG_ERROR(Service_FS, "LowPathType cannot be converted to string!");
- return{};
+ return {};
}
}
@@ -90,12 +83,12 @@ std::u16string Path::AsU16Str() const {
case Wchar:
return u16str;
case Empty:
- return{};
+ return {};
case Invalid:
case Binary:
// TODO(yuriks): Add assert
LOG_ERROR(Service_FS, "LowPathType cannot be converted to u16string!");
- return{};
+ return {};
}
}
@@ -105,25 +98,23 @@ std::vector<u8> Path::AsBinary() const {
return binary;
case Char:
return std::vector<u8>(string.begin(), string.end());
- case Wchar:
- {
+ case Wchar: {
// use two u8 for each character of u16str
std::vector<u8> to_return(u16str.size() * 2);
for (size_t i = 0; i < u16str.size(); ++i) {
u16 tmp_char = u16str.at(i);
- to_return[i*2] = (tmp_char & 0xFF00) >> 8;
- to_return[i*2 + 1] = (tmp_char & 0x00FF);
+ to_return[i * 2] = (tmp_char & 0xFF00) >> 8;
+ to_return[i * 2 + 1] = (tmp_char & 0x00FF);
}
return to_return;
}
case Empty:
- return{};
+ return {};
case Invalid:
default:
// TODO(yuriks): Add assert
LOG_ERROR(Service_FS, "LowPathType cannot be converted to binary!");
- return{};
+ return {};
}
}
-
}
diff --git a/src/core/file_sys/archive_backend.h b/src/core/file_sys/archive_backend.h
index 5d91e47f3..d69c3c785 100644
--- a/src/core/file_sys/archive_backend.h
+++ b/src/core/file_sys/archive_backend.h
@@ -8,14 +8,11 @@
#include <string>
#include <utility>
#include <vector>
-
#include "common/bit_field.h"
#include "common/common_types.h"
#include "common/swap.h"
-
#include "core/hle/result.h"
-
namespace FileSys {
class FileBackend;
@@ -24,10 +21,10 @@ class DirectoryBackend;
// Path string type
enum LowPathType : u32 {
Invalid = 0,
- Empty = 1,
- Binary = 2,
- Char = 3,
- Wchar = 4
+ Empty = 1,
+ Binary = 2,
+ Char = 3,
+ Wchar = 4,
};
union Mode {
@@ -44,7 +41,9 @@ public:
Path(std::vector<u8> binary_data) : type(Binary), binary(std::move(binary_data)) {}
Path(LowPathType type, u32 size, u32 pointer);
- LowPathType GetType() const { return type; }
+ LowPathType GetType() const {
+ return type;
+ }
/**
* Gets the string representation of the path for debugging
@@ -63,18 +62,18 @@ private:
std::u16string u16str;
};
+/// Parameters of the archive, as specified in the Create or Format call.
struct ArchiveFormatInfo {
- u32_le total_size; ///< The pre-defined size of the archive, as specified in the Create or Format call
- u32_le number_directories; ///< The pre-defined number of directories in the archive, as specified in the Create or Format call
- u32_le number_files; ///< The pre-defined number of files in the archive, as specified in the Create or Format call
- u8 duplicate_data; ///< Whether the archive should duplicate the data, as specified in the Create or Format call
+ u32_le total_size; ///< The pre-defined size of the archive.
+ u32_le number_directories; ///< The pre-defined number of directories in the archive.
+ u32_le number_files; ///< The pre-defined number of files in the archive.
+ u8 duplicate_data; ///< Whether the archive should duplicate the data.
};
static_assert(std::is_pod<ArchiveFormatInfo>::value, "ArchiveFormatInfo is not POD");
class ArchiveBackend : NonCopyable {
public:
- virtual ~ArchiveBackend() {
- }
+ virtual ~ArchiveBackend() {}
/**
* Get a descriptive name for the archive (e.g. "RomFS", "SaveData", etc.)
@@ -87,7 +86,8 @@ public:
* @param mode Mode to open the file with
* @return Opened file, or error code
*/
- virtual ResultVal<std::unique_ptr<FileBackend>> OpenFile(const Path& path, const Mode mode) const = 0;
+ virtual ResultVal<std::unique_ptr<FileBackend>> OpenFile(const Path& path,
+ const Mode mode) const = 0;
/**
* Delete a file specified by its path
@@ -150,8 +150,7 @@ public:
class ArchiveFactory : NonCopyable {
public:
- virtual ~ArchiveFactory() {
- }
+ virtual ~ArchiveFactory() {}
/**
* Get a descriptive name for the archive (e.g. "RomFS", "SaveData", etc.)
diff --git a/src/core/file_sys/archive_extsavedata.cpp b/src/core/file_sys/archive_extsavedata.cpp
index 1d9eaefcb..e1d29efd3 100644
--- a/src/core/file_sys/archive_extsavedata.cpp
+++ b/src/core/file_sys/archive_extsavedata.cpp
@@ -5,12 +5,10 @@
#include <algorithm>
#include <memory>
#include <vector>
-
#include "common/common_types.h"
#include "common/file_util.h"
#include "common/logging/log.h"
#include "common/string_util.h"
-
#include "core/file_sys/archive_extsavedata.h"
#include "core/file_sys/disk_archive.h"
#include "core/hle/service/fs/archive.h"
@@ -30,10 +28,11 @@ std::string GetExtSaveDataPath(const std::string& mount_point, const Path& path)
std::string GetExtDataContainerPath(const std::string& mount_point, bool shared) {
if (shared)
- return Common::StringFromFormat("%sdata/%s/extdata/", mount_point.c_str(), SYSTEM_ID.c_str());
+ return Common::StringFromFormat("%sdata/%s/extdata/", mount_point.c_str(),
+ SYSTEM_ID.c_str());
return Common::StringFromFormat("%sNintendo 3DS/%s/%s/extdata/", mount_point.c_str(),
- SYSTEM_ID.c_str(), SDCARD_ID.c_str());
+ SYSTEM_ID.c_str(), SDCARD_ID.c_str());
}
Path ConstructExtDataBinaryPath(u32 media_type, u32 high, u32 low) {
@@ -54,11 +53,12 @@ Path ConstructExtDataBinaryPath(u32 media_type, u32 high, u32 low) {
for (unsigned i = 0; i < 4; ++i)
binary_path.push_back((high >> (8 * i)) & 0xFF);
- return { binary_path };
+ return {binary_path};
}
-ArchiveFactory_ExtSaveData::ArchiveFactory_ExtSaveData(const std::string& mount_location, bool shared)
- : shared(shared), mount_point(GetExtDataContainerPath(mount_location, shared)) {
+ArchiveFactory_ExtSaveData::ArchiveFactory_ExtSaveData(const std::string& mount_location,
+ bool shared)
+ : shared(shared), mount_point(GetExtDataContainerPath(mount_location, shared)) {
LOG_INFO(Service_FS, "Directory %s set as base for ExtSaveData.", mount_point.c_str());
}
@@ -88,7 +88,8 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_ExtSaveData::Open(cons
return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive));
}
-ResultCode ArchiveFactory_ExtSaveData::Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info) {
+ResultCode ArchiveFactory_ExtSaveData::Format(const Path& path,
+ const FileSys::ArchiveFormatInfo& format_info) {
// These folders are always created with the ExtSaveData
std::string user_path = GetExtSaveDataPath(mount_point, path) + "user/";
std::string boss_path = GetExtSaveDataPath(mount_point, path) + "boss/";
@@ -115,7 +116,8 @@ ResultVal<ArchiveFormatInfo> ArchiveFactory_ExtSaveData::GetFormatInfo(const Pat
if (!file.IsOpen()) {
LOG_ERROR(Service_FS, "Could not open metadata information for archive");
// TODO(Subv): Verify error code
- return ResultCode(ErrorDescription::FS_NotFormatted, ErrorModule::FS, ErrorSummary::InvalidState, ErrorLevel::Status);
+ return ResultCode(ErrorDescription::FS_NotFormatted, ErrorModule::FS,
+ ErrorSummary::InvalidState, ErrorLevel::Status);
}
ArchiveFormatInfo info = {};
@@ -123,7 +125,8 @@ ResultVal<ArchiveFormatInfo> ArchiveFactory_ExtSaveData::GetFormatInfo(const Pat
return MakeResult<ArchiveFormatInfo>(info);
}
-void ArchiveFactory_ExtSaveData::WriteIcon(const Path& path, const u8* icon_data, size_t icon_size) {
+void ArchiveFactory_ExtSaveData::WriteIcon(const Path& path, const u8* icon_data,
+ size_t icon_size) {
std::string game_path = FileSys::GetExtSaveDataPath(GetMountPoint(), path);
FileUtil::IOFile icon_file(game_path + "icon", "wb");
icon_file.WriteBytes(icon_data, icon_size);
diff --git a/src/core/file_sys/archive_extsavedata.h b/src/core/file_sys/archive_extsavedata.h
index e9a72850d..6a3431e94 100644
--- a/src/core/file_sys/archive_extsavedata.h
+++ b/src/core/file_sys/archive_extsavedata.h
@@ -6,9 +6,7 @@
#include <memory>
#include <string>
-
#include "common/common_types.h"
-
#include "core/file_sys/archive_backend.h"
#include "core/hle/result.h"
@@ -28,13 +26,17 @@ public:
*/
bool Initialize();
- std::string GetName() const override { return "ExtSaveData"; }
+ std::string GetName() const override {
+ return "ExtSaveData";
+ }
ResultVal<std::unique_ptr<ArchiveBackend>> Open(const Path& path) override;
ResultCode Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info) override;
ResultVal<ArchiveFormatInfo> GetFormatInfo(const Path& path) const override;
- const std::string& GetMountPoint() const { return mount_point; }
+ const std::string& GetMountPoint() const {
+ return mount_point;
+ }
/**
* Writes the SMDH icon of the ExtSaveData to file
@@ -45,7 +47,8 @@ public:
void WriteIcon(const Path& path, const u8* icon_data, size_t icon_size);
private:
- bool shared; ///< Whether this archive represents an ExtSaveData archive or a SharedExtSaveData archive
+ bool shared; ///< Whether this archive represents an ExtSaveData archive or a SharedExtSaveData
+ /// archive
/**
* This holds the full directory path for this archive, it is only set after a successful call
@@ -65,7 +68,8 @@ private:
std::string GetExtSaveDataPath(const std::string& mount_point, const Path& path);
/**
- * Constructs a path to the base folder to hold concrete ExtSaveData archives in the host file system.
+ * Constructs a path to the base folder to hold concrete ExtSaveData archives in the host file
+ * system.
* @param mount_point The base folder where this folder resides, ie. SDMC or NAND.
* @param shared Whether this ExtSaveData container is for SharedExtSaveDatas or not.
* @returns The path to the base ExtSaveData archives' folder in the host file system
diff --git a/src/core/file_sys/archive_romfs.cpp b/src/core/file_sys/archive_romfs.cpp
index 38828b546..6c99ca5b4 100644
--- a/src/core/file_sys/archive_romfs.cpp
+++ b/src/core/file_sys/archive_romfs.cpp
@@ -4,10 +4,8 @@
#include <algorithm>
#include <memory>
-
#include "common/common_types.h"
#include "common/logging/log.h"
-
#include "core/file_sys/archive_romfs.h"
#include "core/file_sys/ivfc_archive.h"
@@ -28,11 +26,12 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_RomFS::Open(const Path
return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive));
}
-ResultCode ArchiveFactory_RomFS::Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info) {
+ResultCode ArchiveFactory_RomFS::Format(const Path& path,
+ const FileSys::ArchiveFormatInfo& format_info) {
LOG_ERROR(Service_FS, "Attempted to format a RomFS archive.");
// TODO: Verify error code
- return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::FS,
- ErrorSummary::NotSupported, ErrorLevel::Permanent);
+ return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::FS, ErrorSummary::NotSupported,
+ ErrorLevel::Permanent);
}
ResultVal<ArchiveFormatInfo> ArchiveFactory_RomFS::GetFormatInfo(const Path& path) const {
diff --git a/src/core/file_sys/archive_romfs.h b/src/core/file_sys/archive_romfs.h
index c5a329122..8a8082a05 100644
--- a/src/core/file_sys/archive_romfs.h
+++ b/src/core/file_sys/archive_romfs.h
@@ -7,9 +7,7 @@
#include <memory>
#include <string>
#include <vector>
-
#include "common/common_types.h"
-
#include "core/file_sys/archive_backend.h"
#include "core/hle/result.h"
#include "core/loader/loader.h"
@@ -24,7 +22,9 @@ class ArchiveFactory_RomFS final : public ArchiveFactory {
public:
ArchiveFactory_RomFS(Loader::AppLoader& app_loader);
- std::string GetName() const override { return "RomFS"; }
+ std::string GetName() const override {
+ return "RomFS";
+ }
ResultVal<std::unique_ptr<ArchiveBackend>> Open(const Path& path) override;
ResultCode Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info) override;
ResultVal<ArchiveFormatInfo> GetFormatInfo(const Path& path) const override;
diff --git a/src/core/file_sys/archive_savedata.cpp b/src/core/file_sys/archive_savedata.cpp
index fd5711e14..6711035ec 100644
--- a/src/core/file_sys/archive_savedata.cpp
+++ b/src/core/file_sys/archive_savedata.cpp
@@ -4,12 +4,10 @@
#include <algorithm>
#include <memory>
-
#include "common/common_types.h"
#include "common/file_util.h"
#include "common/logging/log.h"
#include "common/string_util.h"
-
#include "core/file_sys/archive_savedata.h"
#include "core/file_sys/disk_archive.h"
#include "core/hle/kernel/process.h"
@@ -22,48 +20,54 @@ namespace FileSys {
static std::string GetSaveDataContainerPath(const std::string& sdmc_directory) {
return Common::StringFromFormat("%sNintendo 3DS/%s/%s/title/", sdmc_directory.c_str(),
- SYSTEM_ID.c_str(), SDCARD_ID.c_str());
+ SYSTEM_ID.c_str(), SDCARD_ID.c_str());
}
static std::string GetSaveDataPath(const std::string& mount_location, u64 program_id) {
u32 high = (u32)(program_id >> 32);
u32 low = (u32)(program_id & 0xFFFFFFFF);
- return Common::StringFromFormat("%s%08x/%08x/data/00000001/", mount_location.c_str(), high, low);
+ return Common::StringFromFormat("%s%08x/%08x/data/00000001/", mount_location.c_str(), high,
+ low);
}
static std::string GetSaveDataMetadataPath(const std::string& mount_location, u64 program_id) {
u32 high = (u32)(program_id >> 32);
u32 low = (u32)(program_id & 0xFFFFFFFF);
- return Common::StringFromFormat("%s%08x/%08x/data/00000001.metadata", mount_location.c_str(), high, low);
+ return Common::StringFromFormat("%s%08x/%08x/data/00000001.metadata", mount_location.c_str(),
+ high, low);
}
ArchiveFactory_SaveData::ArchiveFactory_SaveData(const std::string& sdmc_directory)
- : mount_point(GetSaveDataContainerPath(sdmc_directory)) {
+ : mount_point(GetSaveDataContainerPath(sdmc_directory)) {
LOG_INFO(Service_FS, "Directory %s set as SaveData.", this->mount_point.c_str());
}
ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SaveData::Open(const Path& path) {
- std::string concrete_mount_point = GetSaveDataPath(mount_point, Kernel::g_current_process->codeset->program_id);
+ std::string concrete_mount_point =
+ GetSaveDataPath(mount_point, Kernel::g_current_process->codeset->program_id);
if (!FileUtil::Exists(concrete_mount_point)) {
- // When a SaveData archive is created for the first time, it is not yet formatted
- // and the save file/directory structure expected by the game has not yet been initialized.
- // Returning the NotFormatted error code will signal the game to provision the SaveData archive
- // with the files and folders that it expects.
+ // When a SaveData archive is created for the first time, it is not yet formatted and the
+ // save file/directory structure expected by the game has not yet been initialized.
+ // Returning the NotFormatted error code will signal the game to provision the SaveData
+ // archive with the files and folders that it expects.
return ResultCode(ErrorDescription::FS_NotFormatted, ErrorModule::FS,
- ErrorSummary::InvalidState, ErrorLevel::Status);
+ ErrorSummary::InvalidState, ErrorLevel::Status);
}
auto archive = std::make_unique<DiskArchive>(std::move(concrete_mount_point));
return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive));
}
-ResultCode ArchiveFactory_SaveData::Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info) {
- std::string concrete_mount_point = GetSaveDataPath(mount_point, Kernel::g_current_process->codeset->program_id);
+ResultCode ArchiveFactory_SaveData::Format(const Path& path,
+ const FileSys::ArchiveFormatInfo& format_info) {
+ std::string concrete_mount_point =
+ GetSaveDataPath(mount_point, Kernel::g_current_process->codeset->program_id);
FileUtil::DeleteDirRecursively(concrete_mount_point);
FileUtil::CreateFullPath(concrete_mount_point);
// Write the format metadata
- std::string metadata_path = GetSaveDataMetadataPath(mount_point, Kernel::g_current_process->codeset->program_id);
+ std::string metadata_path =
+ GetSaveDataMetadataPath(mount_point, Kernel::g_current_process->codeset->program_id);
FileUtil::IOFile file(metadata_path, "wb");
if (file.IsOpen()) {
@@ -74,13 +78,15 @@ ResultCode ArchiveFactory_SaveData::Format(const Path& path, const FileSys::Arch
}
ResultVal<ArchiveFormatInfo> ArchiveFactory_SaveData::GetFormatInfo(const Path& path) const {
- std::string metadata_path = GetSaveDataMetadataPath(mount_point, Kernel::g_current_process->codeset->program_id);
+ std::string metadata_path =
+ GetSaveDataMetadataPath(mount_point, Kernel::g_current_process->codeset->program_id);
FileUtil::IOFile file(metadata_path, "rb");
if (!file.IsOpen()) {
LOG_ERROR(Service_FS, "Could not open metadata information for archive");
// TODO(Subv): Verify error code
- return ResultCode(ErrorDescription::FS_NotFormatted, ErrorModule::FS, ErrorSummary::InvalidState, ErrorLevel::Status);
+ return ResultCode(ErrorDescription::FS_NotFormatted, ErrorModule::FS,
+ ErrorSummary::InvalidState, ErrorLevel::Status);
}
ArchiveFormatInfo info = {};
diff --git a/src/core/file_sys/archive_savedata.h b/src/core/file_sys/archive_savedata.h
index 7a5a24089..6a372865a 100644
--- a/src/core/file_sys/archive_savedata.h
+++ b/src/core/file_sys/archive_savedata.h
@@ -6,7 +6,6 @@
#include <memory>
#include <string>
-
#include "core/file_sys/archive_backend.h"
#include "core/hle/result.h"
@@ -20,7 +19,9 @@ class ArchiveFactory_SaveData final : public ArchiveFactory {
public:
ArchiveFactory_SaveData(const std::string& mount_point);
- std::string GetName() const override { return "SaveData"; }
+ std::string GetName() const override {
+ return "SaveData";
+ }
ResultVal<std::unique_ptr<ArchiveBackend>> Open(const Path& path) override;
ResultCode Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info) override;
diff --git a/src/core/file_sys/archive_savedatacheck.cpp b/src/core/file_sys/archive_savedatacheck.cpp
index 9f65e5455..6c4542b7d 100644
--- a/src/core/file_sys/archive_savedatacheck.cpp
+++ b/src/core/file_sys/archive_savedatacheck.cpp
@@ -5,12 +5,10 @@
#include <algorithm>
#include <memory>
#include <vector>
-
#include "common/common_types.h"
#include "common/file_util.h"
#include "common/logging/log.h"
#include "common/string_util.h"
-
#include "core/file_sys/archive_savedatacheck.h"
#include "core/file_sys/ivfc_archive.h"
#include "core/hle/service/fs/archive.h"
@@ -25,13 +23,12 @@ static std::string GetSaveDataCheckContainerPath(const std::string& nand_directo
}
static std::string GetSaveDataCheckPath(const std::string& mount_point, u32 high, u32 low) {
- return Common::StringFromFormat("%s%08x/%08x/content/00000000.app.romfs",
- mount_point.c_str(), high, low);
+ return Common::StringFromFormat("%s%08x/%08x/content/00000000.app.romfs", mount_point.c_str(),
+ high, low);
}
-ArchiveFactory_SaveDataCheck::ArchiveFactory_SaveDataCheck(const std::string& nand_directory) :
- mount_point(GetSaveDataCheckContainerPath(nand_directory)) {
-}
+ArchiveFactory_SaveDataCheck::ArchiveFactory_SaveDataCheck(const std::string& nand_directory)
+ : mount_point(GetSaveDataCheckContainerPath(nand_directory)) {}
ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SaveDataCheck::Open(const Path& path) {
auto vec = path.AsBinary();
@@ -48,11 +45,12 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SaveDataCheck::Open(co
return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive));
}
-ResultCode ArchiveFactory_SaveDataCheck::Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info) {
+ResultCode ArchiveFactory_SaveDataCheck::Format(const Path& path,
+ const FileSys::ArchiveFormatInfo& format_info) {
LOG_ERROR(Service_FS, "Attempted to format a SaveDataCheck archive.");
// TODO: Verify error code
- return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::FS,
- ErrorSummary::NotSupported, ErrorLevel::Permanent);
+ return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::FS, ErrorSummary::NotSupported,
+ ErrorLevel::Permanent);
}
ResultVal<ArchiveFormatInfo> ArchiveFactory_SaveDataCheck::GetFormatInfo(const Path& path) const {
diff --git a/src/core/file_sys/archive_savedatacheck.h b/src/core/file_sys/archive_savedatacheck.h
index ea2624d64..e9cafbed9 100644
--- a/src/core/file_sys/archive_savedatacheck.h
+++ b/src/core/file_sys/archive_savedatacheck.h
@@ -6,7 +6,6 @@
#include <memory>
#include <string>
-
#include "core/file_sys/archive_backend.h"
#include "core/hle/result.h"
@@ -20,7 +19,9 @@ class ArchiveFactory_SaveDataCheck final : public ArchiveFactory {
public:
ArchiveFactory_SaveDataCheck(const std::string& mount_point);
- std::string GetName() const override { return "SaveDataCheck"; }
+ std::string GetName() const override {
+ return "SaveDataCheck";
+ }
ResultVal<std::unique_ptr<ArchiveBackend>> Open(const Path& path) override;
ResultCode Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info) override;
diff --git a/src/core/file_sys/archive_sdmc.cpp b/src/core/file_sys/archive_sdmc.cpp
index 9b218af58..bcb03ed36 100644
--- a/src/core/file_sys/archive_sdmc.cpp
+++ b/src/core/file_sys/archive_sdmc.cpp
@@ -4,10 +4,8 @@
#include <algorithm>
#include <memory>
-
#include "common/file_util.h"
#include "common/logging/log.h"
-
#include "core/file_sys/archive_sdmc.h"
#include "core/file_sys/disk_archive.h"
#include "core/settings.h"
@@ -17,7 +15,8 @@
namespace FileSys {
-ArchiveFactory_SDMC::ArchiveFactory_SDMC(const std::string& sdmc_directory) : sdmc_directory(sdmc_directory) {
+ArchiveFactory_SDMC::ArchiveFactory_SDMC(const std::string& sdmc_directory)
+ : sdmc_directory(sdmc_directory) {
LOG_INFO(Service_FS, "Directory %s set as SDMC.", sdmc_directory.c_str());
}
@@ -40,7 +39,8 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SDMC::Open(const Path&
return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive));
}
-ResultCode ArchiveFactory_SDMC::Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info) {
+ResultCode ArchiveFactory_SDMC::Format(const Path& path,
+ const FileSys::ArchiveFormatInfo& format_info) {
// This is kind of an undesirable operation, so let's just ignore it. :)
return RESULT_SUCCESS;
}
diff --git a/src/core/file_sys/archive_sdmc.h b/src/core/file_sys/archive_sdmc.h
index 35c0f3725..88e855351 100644
--- a/src/core/file_sys/archive_sdmc.h
+++ b/src/core/file_sys/archive_sdmc.h
@@ -6,7 +6,6 @@
#include <memory>
#include <string>
-
#include "core/file_sys/archive_backend.h"
#include "core/hle/result.h"
@@ -26,7 +25,9 @@ public:
*/
bool Initialize();
- std::string GetName() const override { return "SDMC"; }
+ std::string GetName() const override {
+ return "SDMC";
+ }
ResultVal<std::unique_ptr<ArchiveBackend>> Open(const Path& path) override;
ResultCode Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info) override;
diff --git a/src/core/file_sys/archive_systemsavedata.cpp b/src/core/file_sys/archive_systemsavedata.cpp
index 1bcc228a1..48ebc0ed4 100644
--- a/src/core/file_sys/archive_systemsavedata.cpp
+++ b/src/core/file_sys/archive_systemsavedata.cpp
@@ -5,11 +5,9 @@
#include <algorithm>
#include <memory>
#include <vector>
-
#include "common/common_types.h"
#include "common/file_util.h"
#include "common/string_util.h"
-
#include "core/file_sys/archive_systemsavedata.h"
#include "core/file_sys/disk_archive.h"
#include "core/hle/service/fs/archive.h"
@@ -45,25 +43,25 @@ Path ConstructSystemSaveDataBinaryPath(u32 high, u32 low) {
for (unsigned i = 0; i < 4; ++i)
binary_path.push_back((low >> (8 * i)) & 0xFF);
- return { binary_path };
+ return {binary_path};
}
ArchiveFactory_SystemSaveData::ArchiveFactory_SystemSaveData(const std::string& nand_path)
- : base_path(GetSystemSaveDataContainerPath(nand_path)) {
-}
+ : base_path(GetSystemSaveDataContainerPath(nand_path)) {}
ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SystemSaveData::Open(const Path& path) {
std::string fullpath = GetSystemSaveDataPath(base_path, path);
if (!FileUtil::Exists(fullpath)) {
// TODO(Subv): Check error code, this one is probably wrong
return ResultCode(ErrorDescription::FS_NotFormatted, ErrorModule::FS,
- ErrorSummary::InvalidState, ErrorLevel::Status);
+ ErrorSummary::InvalidState, ErrorLevel::Status);
}
auto archive = std::make_unique<DiskArchive>(fullpath);
return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive));
}
-ResultCode ArchiveFactory_SystemSaveData::Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info) {
+ResultCode ArchiveFactory_SystemSaveData::Format(const Path& path,
+ const FileSys::ArchiveFormatInfo& format_info) {
std::string fullpath = GetSystemSaveDataPath(base_path, path);
FileUtil::DeleteDirRecursively(fullpath);
FileUtil::CreateFullPath(fullpath);
diff --git a/src/core/file_sys/archive_systemsavedata.h b/src/core/file_sys/archive_systemsavedata.h
index 2bc13d4ee..a24b89f2b 100644
--- a/src/core/file_sys/archive_systemsavedata.h
+++ b/src/core/file_sys/archive_systemsavedata.h
@@ -6,9 +6,7 @@
#include <memory>
#include <string>
-
#include "common/common_types.h"
-
#include "core/file_sys/archive_backend.h"
#include "core/hle/result.h"
@@ -26,7 +24,9 @@ public:
ResultCode Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info) override;
ResultVal<ArchiveFormatInfo> GetFormatInfo(const Path& path) const override;
- std::string GetName() const override { return "SystemSaveData"; }
+ std::string GetName() const override {
+ return "SystemSaveData";
+ }
private:
std::string base_path;
@@ -42,7 +42,8 @@ private:
std::string GetSystemSaveDataPath(const std::string& mount_point, const Path& path);
/**
- * Constructs a path to the base folder to hold concrete SystemSaveData archives in the host file system.
+ * Constructs a path to the base folder to hold concrete SystemSaveData archives in the host file
+ * system.
* @param mount_point The base folder where this folder resides, ie. SDMC or NAND.
* @returns The path to the base SystemSaveData archives' folder in the host file system
*/
diff --git a/src/core/file_sys/directory_backend.h b/src/core/file_sys/directory_backend.h
index a25dc0cfa..b55e382ef 100644
--- a/src/core/file_sys/directory_backend.h
+++ b/src/core/file_sys/directory_backend.h
@@ -6,7 +6,6 @@
#include <array>
#include <cstddef>
-
#include "common/common_types.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -19,15 +18,16 @@ const size_t FILENAME_LENGTH = 0x20C / 2;
struct Entry {
char16_t filename[FILENAME_LENGTH]; // Entry name (UTF-16, null-terminated)
std::array<char, 9> short_name; // 8.3 file name ('longfilename' -> 'LONGFI~1', null-terminated)
- char unknown1; // unknown (observed values: 0x0A, 0x70, 0xFD)
- std::array<char, 4> extension; // 8.3 file extension (set to spaces for directories, null-terminated)
- char unknown2; // unknown (always 0x01)
- char unknown3; // unknown (0x00 or 0x08)
+ char unknown1; // unknown (observed values: 0x0A, 0x70, 0xFD)
+ std::array<char, 4>
+ extension; // 8.3 file extension (set to spaces for directories, null-terminated)
+ char unknown2; // unknown (always 0x01)
+ char unknown3; // unknown (0x00 or 0x08)
char is_directory; // directory flag
- char is_hidden; // hidden flag
- char is_archive; // archive flag
+ char is_hidden; // hidden flag
+ char is_archive; // archive flag
char is_read_only; // read-only flag
- u64 file_size; // file size (for files only)
+ u64 file_size; // file size (for files only)
};
static_assert(sizeof(Entry) == 0x228, "Directory Entry struct isn't exactly 0x228 bytes long!");
static_assert(offsetof(Entry, short_name) == 0x20C, "Wrong offset for short_name in Entry.");
@@ -37,8 +37,8 @@ static_assert(offsetof(Entry, file_size) == 0x220, "Wrong offset for file_size i
class DirectoryBackend : NonCopyable {
public:
- DirectoryBackend() { }
- virtual ~DirectoryBackend() { }
+ DirectoryBackend() {}
+ virtual ~DirectoryBackend() {}
/**
* Open the directory
diff --git a/src/core/file_sys/disk_archive.cpp b/src/core/file_sys/disk_archive.cpp
index 489cc96fb..0f66998e1 100644
--- a/src/core/file_sys/disk_archive.cpp
+++ b/src/core/file_sys/disk_archive.cpp
@@ -5,11 +5,9 @@
#include <algorithm>
#include <cstdio>
#include <memory>
-
#include "common/common_types.h"
#include "common/file_util.h"
#include "common/logging/log.h"
-
#include "core/file_sys/disk_archive.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -17,7 +15,8 @@
namespace FileSys {
-ResultVal<std::unique_ptr<FileBackend>> DiskArchive::OpenFile(const Path& path, const Mode mode) const {
+ResultVal<std::unique_ptr<FileBackend>> DiskArchive::OpenFile(const Path& path,
+ const Mode mode) const {
LOG_DEBUG(Service_FS, "called path=%s mode=%01X", path.DebugStr().c_str(), mode.hex);
auto file = std::make_unique<DiskFile>(*this, path, mode);
ResultCode result = file->Open();
@@ -30,15 +29,18 @@ ResultCode DiskArchive::DeleteFile(const Path& path) const {
std::string file_path = mount_point + path.AsString();
if (FileUtil::IsDirectory(file_path))
- return ResultCode(ErrorDescription::FS_NotAFile, ErrorModule::FS, ErrorSummary::Canceled, ErrorLevel::Status);
+ return ResultCode(ErrorDescription::FS_NotAFile, ErrorModule::FS, ErrorSummary::Canceled,
+ ErrorLevel::Status);
if (!FileUtil::Exists(file_path))
- return ResultCode(ErrorDescription::FS_NotFound, ErrorModule::FS, ErrorSummary::NotFound, ErrorLevel::Status);
+ return ResultCode(ErrorDescription::FS_NotFound, ErrorModule::FS, ErrorSummary::NotFound,
+ ErrorLevel::Status);
if (FileUtil::Delete(file_path))
return RESULT_SUCCESS;
- return ResultCode(ErrorDescription::FS_NotAFile, ErrorModule::FS, ErrorSummary::Canceled, ErrorLevel::Status);
+ return ResultCode(ErrorDescription::FS_NotAFile, ErrorModule::FS, ErrorSummary::Canceled,
+ ErrorLevel::Status);
}
bool DiskArchive::RenameFile(const Path& src_path, const Path& dest_path) const {
@@ -53,10 +55,12 @@ ResultCode DiskArchive::CreateFile(const FileSys::Path& path, u64 size) const {
std::string full_path = mount_point + path.AsString();
if (FileUtil::IsDirectory(full_path))
- return ResultCode(ErrorDescription::FS_NotAFile, ErrorModule::FS, ErrorSummary::Canceled, ErrorLevel::Status);
+ return ResultCode(ErrorDescription::FS_NotAFile, ErrorModule::FS, ErrorSummary::Canceled,
+ ErrorLevel::Status);
if (FileUtil::Exists(full_path))
- return ResultCode(ErrorDescription::FS_AlreadyExists, ErrorModule::FS, ErrorSummary::NothingHappened, ErrorLevel::Status);
+ return ResultCode(ErrorDescription::FS_AlreadyExists, ErrorModule::FS,
+ ErrorSummary::NothingHappened, ErrorLevel::Status);
if (size == 0) {
FileUtil::CreateEmptyFile(full_path);
@@ -69,10 +73,10 @@ ResultCode DiskArchive::CreateFile(const FileSys::Path& path, u64 size) const {
if (file.Seek(size - 1, SEEK_SET) && file.WriteBytes("", 1) == 1)
return RESULT_SUCCESS;
- return ResultCode(ErrorDescription::TooLarge, ErrorModule::FS, ErrorSummary::OutOfResource, ErrorLevel::Info);
+ return ResultCode(ErrorDescription::TooLarge, ErrorModule::FS, ErrorSummary::OutOfResource,
+ ErrorLevel::Info);
}
-
bool DiskArchive::CreateDirectory(const Path& path) const {
return FileUtil::CreateDir(mount_point + path.AsString());
}
@@ -106,17 +110,21 @@ DiskFile::DiskFile(const DiskArchive& archive, const Path& path, const Mode mode
ResultCode DiskFile::Open() {
if (FileUtil::IsDirectory(path))
- return ResultCode(ErrorDescription::FS_NotAFile, ErrorModule::FS, ErrorSummary::Canceled, ErrorLevel::Status);
+ return ResultCode(ErrorDescription::FS_NotAFile, ErrorModule::FS, ErrorSummary::Canceled,
+ ErrorLevel::Status);
// Specifying only the Create flag is invalid
if (mode.create_flag && !mode.read_flag && !mode.write_flag) {
- return ResultCode(ErrorDescription::FS_InvalidOpenFlags, ErrorModule::FS, ErrorSummary::Canceled, ErrorLevel::Status);
+ return ResultCode(ErrorDescription::FS_InvalidOpenFlags, ErrorModule::FS,
+ ErrorSummary::Canceled, ErrorLevel::Status);
}
if (!FileUtil::Exists(path)) {
if (!mode.create_flag) {
- LOG_ERROR(Service_FS, "Non-existing file %s can't be open without mode create.", path.c_str());
- return ResultCode(ErrorDescription::FS_NotFound, ErrorModule::FS, ErrorSummary::NotFound, ErrorLevel::Status);
+ LOG_ERROR(Service_FS, "Non-existing file %s can't be open without mode create.",
+ path.c_str());
+ return ResultCode(ErrorDescription::FS_NotFound, ErrorModule::FS,
+ ErrorSummary::NotFound, ErrorLevel::Status);
} else {
// Create the file
FileUtil::CreateEmptyFile(path);
@@ -135,20 +143,24 @@ ResultCode DiskFile::Open() {
file = std::make_unique<FileUtil::IOFile>(path, mode_string.c_str());
if (file->IsOpen())
return RESULT_SUCCESS;
- return ResultCode(ErrorDescription::FS_NotFound, ErrorModule::FS, ErrorSummary::NotFound, ErrorLevel::Status);
+ return ResultCode(ErrorDescription::FS_NotFound, ErrorModule::FS, ErrorSummary::NotFound,
+ ErrorLevel::Status);
}
ResultVal<size_t> DiskFile::Read(const u64 offset, const size_t length, u8* buffer) const {
if (!mode.read_flag && !mode.write_flag)
- return ResultCode(ErrorDescription::FS_InvalidOpenFlags, ErrorModule::FS, ErrorSummary::Canceled, ErrorLevel::Status);
+ return ResultCode(ErrorDescription::FS_InvalidOpenFlags, ErrorModule::FS,
+ ErrorSummary::Canceled, ErrorLevel::Status);
file->Seek(offset, SEEK_SET);
return MakeResult<size_t>(file->ReadBytes(buffer, length));
}
-ResultVal<size_t> DiskFile::Write(const u64 offset, const size_t length, const bool flush, const u8* buffer) const {
+ResultVal<size_t> DiskFile::Write(const u64 offset, const size_t length, const bool flush,
+ const u8* buffer) const {
if (!mode.write_flag)
- return ResultCode(ErrorDescription::FS_InvalidOpenFlags, ErrorModule::FS, ErrorSummary::Canceled, ErrorLevel::Status);
+ return ResultCode(ErrorDescription::FS_InvalidOpenFlags, ErrorModule::FS,
+ ErrorSummary::Canceled, ErrorLevel::Status);
file->Seek(offset, SEEK_SET);
size_t written = file->WriteBytes(buffer, length);
@@ -198,7 +210,8 @@ u32 DiskDirectory::Read(const u32 count, Entry* entries) {
const std::string& filename = file.virtualName;
Entry& entry = entries[entries_read];
- LOG_TRACE(Service_FS, "File %s: size=%llu dir=%d", filename.c_str(), file.size, file.isDirectory);
+ LOG_TRACE(Service_FS, "File %s: size=%llu dir=%d", filename.c_str(), file.size,
+ file.isDirectory);
// TODO(Link Mauve): use a proper conversion to UTF-16.
for (size_t j = 0; j < FILENAME_LENGTH; ++j) {
diff --git a/src/core/file_sys/disk_archive.h b/src/core/file_sys/disk_archive.h
index b4cc2f702..2165f27f9 100644
--- a/src/core/file_sys/disk_archive.h
+++ b/src/core/file_sys/disk_archive.h
@@ -8,10 +8,8 @@
#include <memory>
#include <string>
#include <vector>
-
#include "common/common_types.h"
#include "common/file_util.h"
-
#include "core/file_sys/archive_backend.h"
#include "core/file_sys/directory_backend.h"
#include "core/file_sys/file_backend.h"
@@ -31,9 +29,12 @@ class DiskArchive : public ArchiveBackend {
public:
DiskArchive(const std::string& mount_point_) : mount_point(mount_point_) {}
- virtual std::string GetName() const override { return "DiskArchive: " + mount_point; }
+ virtual std::string GetName() const override {
+ return "DiskArchive: " + mount_point;
+ }
- ResultVal<std::unique_ptr<FileBackend>> OpenFile(const Path& path, const Mode mode) const override;
+ ResultVal<std::unique_ptr<FileBackend>> OpenFile(const Path& path,
+ const Mode mode) const override;
ResultCode DeleteFile(const Path& path) const override;
bool RenameFile(const Path& src_path, const Path& dest_path) const override;
bool DeleteDirectory(const Path& path) const override;
diff --git a/src/core/file_sys/file_backend.h b/src/core/file_sys/file_backend.h
index 9137bbbad..ed997537f 100644
--- a/src/core/file_sys/file_backend.h
+++ b/src/core/file_sys/file_backend.h
@@ -5,7 +5,6 @@
#pragma once
#include <cstddef>
-
#include "common/common_types.h"
#include "core/hle/result.h"
@@ -16,8 +15,8 @@ namespace FileSys {
class FileBackend : NonCopyable {
public:
- FileBackend() { }
- virtual ~FileBackend() { }
+ FileBackend() {}
+ virtual ~FileBackend() {}
/**
* Open the file
@@ -42,7 +41,8 @@ public:
* @param buffer Buffer to read data from
* @return Number of bytes written, or error code
*/
- virtual ResultVal<size_t> Write(u64 offset, size_t length, bool flush, const u8* buffer) const = 0;
+ virtual ResultVal<size_t> Write(u64 offset, size_t length, bool flush,
+ const u8* buffer) const = 0;
/**
* Get the size of the file in bytes
diff --git a/src/core/file_sys/ivfc_archive.cpp b/src/core/file_sys/ivfc_archive.cpp
index c61791ef7..49cc1de10 100644
--- a/src/core/file_sys/ivfc_archive.cpp
+++ b/src/core/file_sys/ivfc_archive.cpp
@@ -4,10 +4,8 @@
#include <cstring>
#include <memory>
-
#include "common/common_types.h"
#include "common/logging/log.h"
-
#include "core/file_sys/ivfc_archive.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -19,40 +17,49 @@ std::string IVFCArchive::GetName() const {
return "IVFC";
}
-ResultVal<std::unique_ptr<FileBackend>> IVFCArchive::OpenFile(const Path& path, const Mode mode) const {
- return MakeResult<std::unique_ptr<FileBackend>>(std::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>>(
+ std::make_unique<IVFCFile>(romfs_file, data_offset, data_size));
}
ResultCode IVFCArchive::DeleteFile(const Path& path) const {
- LOG_CRITICAL(Service_FS, "Attempted to delete a file from an IVFC archive (%s).", GetName().c_str());
+ LOG_CRITICAL(Service_FS, "Attempted to delete a file from an IVFC archive (%s).",
+ GetName().c_str());
// TODO(Subv): Verify error code
- return ResultCode(ErrorDescription::NoData, ErrorModule::FS,
- ErrorSummary::Canceled, ErrorLevel::Status);
+ return ResultCode(ErrorDescription::NoData, ErrorModule::FS, ErrorSummary::Canceled,
+ ErrorLevel::Status);
}
bool IVFCArchive::RenameFile(const Path& src_path, const Path& dest_path) const {
- LOG_CRITICAL(Service_FS, "Attempted to rename a file within an IVFC archive (%s).", GetName().c_str());
+ LOG_CRITICAL(Service_FS, "Attempted to rename a file within an IVFC archive (%s).",
+ GetName().c_str());
return false;
}
bool IVFCArchive::DeleteDirectory(const Path& path) const {
- LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an IVFC archive (%s).", GetName().c_str());
+ LOG_CRITICAL(Service_FS, "Attempted to delete a directory from an IVFC archive (%s).",
+ GetName().c_str());
return false;
}
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());
+ 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);
+ return ResultCode(ErrorDescription::NotAuthorized, ErrorModule::FS, ErrorSummary::NotSupported,
+ ErrorLevel::Permanent);
}
bool IVFCArchive::CreateDirectory(const Path& path) const {
- LOG_CRITICAL(Service_FS, "Attempted to create a directory in an IVFC archive (%s).", GetName().c_str());
+ LOG_CRITICAL(Service_FS, "Attempted to create a directory in an IVFC archive (%s).",
+ GetName().c_str());
return false;
}
bool IVFCArchive::RenameDirectory(const Path& src_path, const Path& dest_path) const {
- LOG_CRITICAL(Service_FS, "Attempted to rename a file within an IVFC archive (%s).", GetName().c_str());
+ LOG_CRITICAL(Service_FS, "Attempted to rename a file within an IVFC archive (%s).",
+ GetName().c_str());
return false;
}
@@ -75,7 +82,8 @@ ResultVal<size_t> IVFCFile::Read(const u64 offset, const size_t length, u8* buff
return MakeResult<size_t>(romfs_file->ReadBytes(buffer, read_length));
}
-ResultVal<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");
// TODO(Subv): Find error code
return MakeResult<size_t>(0);
diff --git a/src/core/file_sys/ivfc_archive.h b/src/core/file_sys/ivfc_archive.h
index 19d32dcca..0df6cf83a 100644
--- a/src/core/file_sys/ivfc_archive.h
+++ b/src/core/file_sys/ivfc_archive.h
@@ -8,10 +8,8 @@
#include <memory>
#include <string>
#include <vector>
-
#include "common/common_types.h"
#include "common/file_util.h"
-
#include "core/file_sys/archive_backend.h"
#include "core/file_sys/directory_backend.h"
#include "core/file_sys/file_backend.h"
@@ -34,7 +32,8 @@ public:
std::string GetName() const override;
- ResultVal<std::unique_ptr<FileBackend>> OpenFile(const Path& path, const Mode mode) const override;
+ ResultVal<std::unique_ptr<FileBackend>> OpenFile(const Path& path,
+ const Mode mode) const override;
ResultCode DeleteFile(const Path& path) const override;
bool RenameFile(const Path& src_path, const Path& dest_path) const override;
bool DeleteDirectory(const Path& path) const override;
@@ -55,13 +54,17 @@ public:
IVFCFile(std::shared_ptr<FileUtil::IOFile> file, u64 offset, u64 size)
: romfs_file(file), data_offset(offset), data_size(size) {}
- ResultCode Open() override { return RESULT_SUCCESS; }
+ ResultCode Open() override {
+ return RESULT_SUCCESS;
+ }
ResultVal<size_t> Read(u64 offset, size_t length, u8* buffer) const override;
ResultVal<size_t> Write(u64 offset, size_t length, bool flush, const u8* buffer) const override;
u64 GetSize() const override;
bool SetSize(u64 size) const override;
- bool Close() const override { return false; }
- void Flush() const override { }
+ bool Close() const override {
+ return false;
+ }
+ void Flush() const override {}
private:
std::shared_ptr<FileUtil::IOFile> romfs_file;
@@ -71,9 +74,15 @@ private:
class IVFCDirectory : public DirectoryBackend {
public:
- bool Open() override { return false; }
- u32 Read(const u32 count, Entry* entries) override { return 0; }
- bool Close() const override { return false; }
+ bool Open() override {
+ return false;
+ }
+ u32 Read(const u32 count, Entry* entries) override {
+ return 0;
+ }
+ bool Close() const override {
+ return false;
+ }
};
} // namespace FileSys