diff options
author | Subv <subv2112@gmail.com> | 2018-03-20 04:58:55 +0100 |
---|---|---|
committer | Subv <subv2112@gmail.com> | 2018-03-20 04:58:55 +0100 |
commit | a9ba2c2000d9f2e4c6018aa6fc1e754eca82f72c (patch) | |
tree | d31aeca8eacb374ab130dcd2449744cde2d5befd /src/core/file_sys/directory.h | |
parent | FS: Support the file Append open mode. (diff) | |
download | yuzu-a9ba2c2000d9f2e4c6018aa6fc1e754eca82f72c.tar yuzu-a9ba2c2000d9f2e4c6018aa6fc1e754eca82f72c.tar.gz yuzu-a9ba2c2000d9f2e4c6018aa6fc1e754eca82f72c.tar.bz2 yuzu-a9ba2c2000d9f2e4c6018aa6fc1e754eca82f72c.tar.lz yuzu-a9ba2c2000d9f2e4c6018aa6fc1e754eca82f72c.tar.xz yuzu-a9ba2c2000d9f2e4c6018aa6fc1e754eca82f72c.tar.zst yuzu-a9ba2c2000d9f2e4c6018aa6fc1e754eca82f72c.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/file_sys/directory.h | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/src/core/file_sys/directory.h b/src/core/file_sys/directory.h index 5a40bf472..c7639795e 100644 --- a/src/core/file_sys/directory.h +++ b/src/core/file_sys/directory.h @@ -6,34 +6,28 @@ #include <array> #include <cstddef> +#include "common/common_funcs.h" #include "common/common_types.h" +#include "core/file_sys/filesystem.h" //////////////////////////////////////////////////////////////////////////////////////////////////// // FileSys namespace namespace FileSys { -// Structure of a directory entry, from http://3dbrew.org/wiki/FSDir:Read#Entry_format -const size_t FILENAME_LENGTH = 0x20C / 2; +// Structure of a directory entry, from +// http://switchbrew.org/index.php?title=Filesystem_services#DirectoryEntry +const size_t FILENAME_LENGTH = 0x300; 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 is_directory; // directory 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) + char filename[FILENAME_LENGTH]; + INSERT_PADDING_BYTES(4); + EntryType type; + INSERT_PADDING_BYTES(3); + u64 file_size; }; -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."); -static_assert(offsetof(Entry, extension) == 0x216, "Wrong offset for extension in Entry."); -static_assert(offsetof(Entry, is_archive) == 0x21E, "Wrong offset for is_archive in Entry."); -static_assert(offsetof(Entry, file_size) == 0x220, "Wrong offset for file_size in Entry."); +static_assert(sizeof(Entry) == 0x310, "Directory Entry struct isn't exactly 0x310 bytes long!"); +static_assert(offsetof(Entry, type) == 0x304, "Wrong offset for type in Entry."); +static_assert(offsetof(Entry, file_size) == 0x308, "Wrong offset for file_size in Entry."); class DirectoryBackend : NonCopyable { public: @@ -46,7 +40,10 @@ public: * @param entries Buffer to read data into * @return Number of entries listed */ - virtual u32 Read(const u32 count, Entry* entries) = 0; + virtual u64 Read(const u64 count, Entry* entries) = 0; + + /// Returns the number of entries still left to read. + virtual u64 GetEntryCount() const = 0; /** * Close the directory |