diff options
author | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2016-09-19 03:01:46 +0200 |
---|---|---|
committer | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2016-09-19 06:14:25 +0200 |
commit | 396a8d91a4423d9c793eeff0798d544613647511 (patch) | |
tree | e0203961233db1ffcbbca2e15154d71d142c5822 /src/core/file_sys | |
parent | Tweak formatting settings (diff) | |
download | yuzu-396a8d91a4423d9c793eeff0798d544613647511.tar yuzu-396a8d91a4423d9c793eeff0798d544613647511.tar.gz yuzu-396a8d91a4423d9c793eeff0798d544613647511.tar.bz2 yuzu-396a8d91a4423d9c793eeff0798d544613647511.tar.lz yuzu-396a8d91a4423d9c793eeff0798d544613647511.tar.xz yuzu-396a8d91a4423d9c793eeff0798d544613647511.tar.zst yuzu-396a8d91a4423d9c793eeff0798d544613647511.zip |
Diffstat (limited to 'src/core/file_sys')
-rw-r--r-- | src/core/file_sys/archive_backend.h | 36 | ||||
-rw-r--r-- | src/core/file_sys/archive_savedata.cpp | 7 | ||||
-rw-r--r-- | src/core/file_sys/archive_savedatacheck.cpp | 3 | ||||
-rw-r--r-- | src/core/file_sys/archive_systemsavedata.cpp | 3 | ||||
-rw-r--r-- | src/core/file_sys/directory_backend.h | 6 | ||||
-rw-r--r-- | src/core/file_sys/disk_archive.h | 3 | ||||
-rw-r--r-- | src/core/file_sys/file_backend.h | 6 | ||||
-rw-r--r-- | src/core/file_sys/ivfc_archive.h | 9 |
8 files changed, 30 insertions, 43 deletions
diff --git a/src/core/file_sys/archive_backend.h b/src/core/file_sys/archive_backend.h index 79fde9710..7f64fe4e2 100644 --- a/src/core/file_sys/archive_backend.h +++ b/src/core/file_sys/archive_backend.h @@ -21,7 +21,13 @@ class FileBackend; class DirectoryBackend; // Path string type -enum LowPathType : u32 { Invalid = 0, Empty = 1, Binary = 2, Char = 3, Wchar = 4 }; +enum LowPathType : u32 { + Invalid = 0, + Empty = 1, + Binary = 2, + Char = 3, + Wchar = 4, +}; union Mode { u32 hex; @@ -32,12 +38,9 @@ union Mode { class Path { public: - Path() : type(Invalid) { - } - Path(const char* path) : type(Char), string(path) { - } - Path(std::vector<u8> binary_data) : type(Binary), binary(std::move(binary_data)) { - } + Path() : type(Invalid) {} + Path(const char* path) : type(Char), string(path) {} + Path(std::vector<u8> binary_data) : type(Binary), binary(std::move(binary_data)) {} Path(LowPathType type, u32 size, u32 pointer); LowPathType GetType() const { @@ -61,22 +64,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.) @@ -153,8 +152,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_savedata.cpp b/src/core/file_sys/archive_savedata.cpp index 9a264091f..860f2fca8 100644 --- a/src/core/file_sys/archive_savedata.cpp +++ b/src/core/file_sys/archive_savedata.cpp @@ -48,11 +48,10 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SaveData::Open(const P 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. + // 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. + // archive with the files and folders that it expects. return ResultCode(ErrorDescription::FS_NotFormatted, ErrorModule::FS, ErrorSummary::InvalidState, ErrorLevel::Status); } diff --git a/src/core/file_sys/archive_savedatacheck.cpp b/src/core/file_sys/archive_savedatacheck.cpp index fd9b84302..50fe004fe 100644 --- a/src/core/file_sys/archive_savedatacheck.cpp +++ b/src/core/file_sys/archive_savedatacheck.cpp @@ -30,8 +30,7 @@ static std::string GetSaveDataCheckPath(const std::string& mount_point, u32 high } ArchiveFactory_SaveDataCheck::ArchiveFactory_SaveDataCheck(const std::string& nand_directory) - : mount_point(GetSaveDataCheckContainerPath(nand_directory)) { -} + : mount_point(GetSaveDataCheckContainerPath(nand_directory)) {} ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SaveDataCheck::Open(const Path& path) { auto vec = path.AsBinary(); diff --git a/src/core/file_sys/archive_systemsavedata.cpp b/src/core/file_sys/archive_systemsavedata.cpp index 1fb858247..0261ab547 100644 --- a/src/core/file_sys/archive_systemsavedata.cpp +++ b/src/core/file_sys/archive_systemsavedata.cpp @@ -49,8 +49,7 @@ Path ConstructSystemSaveDataBinaryPath(u32 high, u32 low) { } 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); diff --git a/src/core/file_sys/directory_backend.h b/src/core/file_sys/directory_backend.h index c402ee60b..9706e909b 100644 --- a/src/core/file_sys/directory_backend.h +++ b/src/core/file_sys/directory_backend.h @@ -38,10 +38,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.h b/src/core/file_sys/disk_archive.h index 3f620128f..64e36f5ea 100644 --- a/src/core/file_sys/disk_archive.h +++ b/src/core/file_sys/disk_archive.h @@ -29,8 +29,7 @@ namespace FileSys { */ class DiskArchive : public ArchiveBackend { public: - DiskArchive(const std::string& mount_point_) : mount_point(mount_point_) { - } + DiskArchive(const std::string& mount_point_) : mount_point(mount_point_) {} virtual std::string GetName() const override { return "DiskArchive: " + mount_point; diff --git a/src/core/file_sys/file_backend.h b/src/core/file_sys/file_backend.h index 9eae697c2..3496facd4 100644 --- a/src/core/file_sys/file_backend.h +++ b/src/core/file_sys/file_backend.h @@ -16,10 +16,8 @@ namespace FileSys { class FileBackend : NonCopyable { public: - FileBackend() { - } - virtual ~FileBackend() { - } + FileBackend() {} + virtual ~FileBackend() {} /** * Open the file diff --git a/src/core/file_sys/ivfc_archive.h b/src/core/file_sys/ivfc_archive.h index dab1958f6..0d15550da 100644 --- a/src/core/file_sys/ivfc_archive.h +++ b/src/core/file_sys/ivfc_archive.h @@ -30,8 +30,7 @@ namespace FileSys { class IVFCArchive : public ArchiveBackend { public: IVFCArchive(std::shared_ptr<FileUtil::IOFile> file, u64 offset, u64 size) - : romfs_file(file), data_offset(offset), data_size(size) { - } + : romfs_file(file), data_offset(offset), data_size(size) {} std::string GetName() const override; @@ -55,8 +54,7 @@ protected: class IVFCFile : public FileBackend { public: IVFCFile(std::shared_ptr<FileUtil::IOFile> file, u64 offset, u64 size) - : romfs_file(file), data_offset(offset), data_size(size) { - } + : romfs_file(file), data_offset(offset), data_size(size) {} ResultCode Open() override { return RESULT_SUCCESS; @@ -68,8 +66,7 @@ public: bool Close() const override { return false; } - void Flush() const override { - } + void Flush() const override {} private: std::shared_ptr<FileUtil::IOFile> romfs_file; |