diff options
author | bunnei <bunneidev@gmail.com> | 2014-09-19 04:27:06 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2014-09-19 04:27:06 +0200 |
commit | a9630a9d2b432bea7bdfef4aa462035b98b34517 (patch) | |
tree | 258010943e989fc61a2a439ff15ead7ed3d11a6f /src/core/file_sys/directory.h | |
parent | Merge pull request #107 from lioncash/sprintf (diff) | |
parent | Kernel: Implement the Close command for Archive, File and Directory. (diff) | |
download | yuzu-a9630a9d2b432bea7bdfef4aa462035b98b34517.tar yuzu-a9630a9d2b432bea7bdfef4aa462035b98b34517.tar.gz yuzu-a9630a9d2b432bea7bdfef4aa462035b98b34517.tar.bz2 yuzu-a9630a9d2b432bea7bdfef4aa462035b98b34517.tar.lz yuzu-a9630a9d2b432bea7bdfef4aa462035b98b34517.tar.xz yuzu-a9630a9d2b432bea7bdfef4aa462035b98b34517.tar.zst yuzu-a9630a9d2b432bea7bdfef4aa462035b98b34517.zip |
Diffstat (limited to 'src/core/file_sys/directory.h')
-rw-r--r-- | src/core/file_sys/directory.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/core/file_sys/directory.h b/src/core/file_sys/directory.h new file mode 100644 index 000000000..cf9a2010b --- /dev/null +++ b/src/core/file_sys/directory.h @@ -0,0 +1,53 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#pragma once + +#include "common/common_types.h" + +#include "core/hle/kernel/kernel.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; +struct Entry { + char16_t filename[FILENAME_LENGTH]; // Entry name (UTF-16, null-terminated) + char short_name[8]; // 8.3 file name ('longfilename' -> 'LONGFI~1') + char unknown1; // unknown (observed values: 0x0A, 0x70, 0xFD) + char extension[3]; // 8.3 file extension (set to spaces for directories) + 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) +}; +static_assert(sizeof(Entry) == 0x228, "Directory Entry struct isn't exactly 0x228 bytes long!"); + +class Directory : NonCopyable { +public: + Directory() { } + virtual ~Directory() { } + + /** + * List files contained in the directory + * @param count Number of entries to return at once in entries + * @param entries Buffer to read data into + * @return Number of entries listed + */ + virtual u32 Read(const u32 count, Entry* entries) = 0; + + /** + * Close the directory + * @return true if the directory closed correctly + */ + virtual bool Close() const = 0; +}; + +} // namespace FileSys |