From 381a5c053f76a7d85d811ebf37a5943f6a57579e Mon Sep 17 00:00:00 2001 From: Subv Date: Mon, 28 Dec 2015 09:38:10 -0500 Subject: HLE/FS: FS::CreateFile takes an u64 for the file size. --- src/core/file_sys/archive_backend.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/file_sys/archive_backend.h') diff --git a/src/core/file_sys/archive_backend.h b/src/core/file_sys/archive_backend.h index 601e95d8c..152c8201c 100644 --- a/src/core/file_sys/archive_backend.h +++ b/src/core/file_sys/archive_backend.h @@ -108,7 +108,7 @@ public: * @param size The size of the new file, filled with zeroes * @return File creation result code */ - virtual ResultCode CreateFile(const Path& path, u32 size) const = 0; + virtual ResultCode CreateFile(const Path& path, u64 size) const = 0; /** * Create a directory specified by its path -- cgit v1.2.3 From 09b0564c75c3da41eaf15dcb847831c11f4c27b9 Mon Sep 17 00:00:00 2001 From: Subv Date: Mon, 28 Dec 2015 09:59:27 -0500 Subject: HLE/FS: Corrected the error codes for DeleteFile --- src/core/file_sys/archive_backend.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/file_sys/archive_backend.h') diff --git a/src/core/file_sys/archive_backend.h b/src/core/file_sys/archive_backend.h index 152c8201c..c5da9bd6f 100644 --- a/src/core/file_sys/archive_backend.h +++ b/src/core/file_sys/archive_backend.h @@ -83,9 +83,9 @@ public: /** * Delete a file specified by its path * @param path Path relative to the archive - * @return Whether the file could be deleted + * @return Result of the operation */ - virtual bool DeleteFile(const Path& path) const = 0; + virtual ResultCode DeleteFile(const Path& path) const = 0; /** * Rename a File specified by its path -- cgit v1.2.3 From 95b34f8081e26cfe75d63a853d1626fdd5b636e6 Mon Sep 17 00:00:00 2001 From: Subv Date: Mon, 28 Dec 2015 10:17:06 -0500 Subject: HLE/FS: Return the proper error codes when opening files. --- src/core/file_sys/archive_backend.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/file_sys/archive_backend.h') diff --git a/src/core/file_sys/archive_backend.h b/src/core/file_sys/archive_backend.h index c5da9bd6f..60108b4b0 100644 --- a/src/core/file_sys/archive_backend.h +++ b/src/core/file_sys/archive_backend.h @@ -76,9 +76,9 @@ public: * Open a file specified by its path, using the specified mode * @param path Path relative to the archive * @param mode Mode to open the file with - * @return Opened file, or nullptr + * @return Opened file, or error code */ - virtual std::unique_ptr OpenFile(const Path& path, const Mode mode) const = 0; + virtual ResultVal> OpenFile(const Path& path, const Mode mode) const = 0; /** * Delete a file specified by its path -- cgit v1.2.3 From d26c6b3212ed36970410814593ee5ec082b1d95a Mon Sep 17 00:00:00 2001 From: Subv Date: Mon, 28 Dec 2015 13:51:44 -0500 Subject: HLE/FS: Implemented GetFormatInfo Format information is currently only implemented for the ExtSaveData, SharedExtSaveData and SaveData archives, the information is stored in a file alongside the root folder of the archive. --- src/core/file_sys/archive_backend.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/core/file_sys/archive_backend.h') diff --git a/src/core/file_sys/archive_backend.h b/src/core/file_sys/archive_backend.h index 60108b4b0..800ac1541 100644 --- a/src/core/file_sys/archive_backend.h +++ b/src/core/file_sys/archive_backend.h @@ -62,6 +62,14 @@ private: std::u16string u16str; }; +struct ArchiveFormatInfo { + u32 total_size; ///< The pre-defined size of the archive, as specified in the Create or Format call + u32 number_directories; ///< The pre-defined number of directories in the archive, as specified in the Create or Format call + u32 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 +}; +static_assert(std::is_pod::value, "ArchiveFormatInfo is not POD"); + class ArchiveBackend : NonCopyable { public: virtual ~ArchiveBackend() { @@ -159,9 +167,17 @@ public: /** * Deletes the archive contents and then re-creates the base folder * @param path Path to the archive + * @param format_info Format information for the new archive * @return ResultCode of the operation, 0 on success */ - virtual ResultCode Format(const Path& path) = 0; + virtual ResultCode Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info) = 0; + + /* + * Retrieves the format info about the archive with the specified path + * @param path Path to the archive + * @return Format information about the archive or error code + */ + virtual ResultVal GetFormatInfo(const Path& path) const = 0; }; } // namespace FileSys -- cgit v1.2.3 From 3aa42627a3a35d8a4fb9acdcced24977d1f269cd Mon Sep 17 00:00:00 2001 From: Subv Date: Sat, 16 Jan 2016 17:01:01 -0500 Subject: HLE/FS: Corrected some style concerns. --- src/core/file_sys/archive_backend.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/file_sys/archive_backend.h') diff --git a/src/core/file_sys/archive_backend.h b/src/core/file_sys/archive_backend.h index 800ac1541..94cda172f 100644 --- a/src/core/file_sys/archive_backend.h +++ b/src/core/file_sys/archive_backend.h @@ -172,7 +172,7 @@ public: */ virtual ResultCode Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info) = 0; - /* + /** * Retrieves the format info about the archive with the specified path * @param path Path to the archive * @return Format information about the archive or error code -- cgit v1.2.3 From f707026ac50c53716ac697ed439630d7728e9db6 Mon Sep 17 00:00:00 2001 From: Subv Date: Thu, 3 Mar 2016 13:05:50 -0500 Subject: HLE/FS: Change the error code returned when an ExtSaveData archive is not found. This allows Fire Emblem to boot again. --- src/core/file_sys/archive_backend.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/core/file_sys/archive_backend.h') diff --git a/src/core/file_sys/archive_backend.h b/src/core/file_sys/archive_backend.h index 94cda172f..5d91e47f3 100644 --- a/src/core/file_sys/archive_backend.h +++ b/src/core/file_sys/archive_backend.h @@ -11,6 +11,7 @@ #include "common/bit_field.h" #include "common/common_types.h" +#include "common/swap.h" #include "core/hle/result.h" @@ -63,9 +64,9 @@ private: }; struct ArchiveFormatInfo { - u32 total_size; ///< The pre-defined size of the archive, as specified in the Create or Format call - u32 number_directories; ///< The pre-defined number of directories in the archive, as specified in the Create or Format call - u32 number_files; ///< The pre-defined number of files in the archive, as specified in the Create or Format call + 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 }; static_assert(std::is_pod::value, "ArchiveFormatInfo is not POD"); -- cgit v1.2.3