diff options
| author | 2014-09-27 19:41:21 +0000 | |
|---|---|---|
| committer | 2014-10-06 19:58:43 +0200 | |
| commit | 19c2a96ab07649f901fea9e14fcb6d762c307cbc (patch) | |
| tree | 58154ff9292375fb17421f1f5b0ad80c5e015a77 | |
| parent | FileSys: split the constructor into an Open method, in order to notify the op... (diff) | |
| download | yuzu-19c2a96ab07649f901fea9e14fcb6d762c307cbc.tar.gz yuzu-19c2a96ab07649f901fea9e14fcb6d762c307cbc.tar.xz yuzu-19c2a96ab07649f901fea9e14fcb6d762c307cbc.zip | |
FileSys: Add static asserts for the Directory struct, and fix its fields position.
| -rw-r--r-- | src/core/file_sys/directory.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/core/file_sys/directory.h b/src/core/file_sys/directory.h index cf9a2010b..9f3546b05 100644 --- a/src/core/file_sys/directory.h +++ b/src/core/file_sys/directory.h | |||
| @@ -4,6 +4,8 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <cstddef> | ||
| 8 | |||
| 7 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 8 | 10 | ||
| 9 | #include "core/hle/kernel/kernel.h" | 11 | #include "core/hle/kernel/kernel.h" |
| @@ -17,9 +19,9 @@ namespace FileSys { | |||
| 17 | const size_t FILENAME_LENGTH = 0x20C / 2; | 19 | const size_t FILENAME_LENGTH = 0x20C / 2; |
| 18 | struct Entry { | 20 | struct Entry { |
| 19 | char16_t filename[FILENAME_LENGTH]; // Entry name (UTF-16, null-terminated) | 21 | char16_t filename[FILENAME_LENGTH]; // Entry name (UTF-16, null-terminated) |
| 20 | char short_name[8]; // 8.3 file name ('longfilename' -> 'LONGFI~1') | 22 | char short_name[9]; // 8.3 file name ('longfilename' -> 'LONGFI~1', null-terminated) |
| 21 | char unknown1; // unknown (observed values: 0x0A, 0x70, 0xFD) | 23 | char unknown1; // unknown (observed values: 0x0A, 0x70, 0xFD) |
| 22 | char extension[3]; // 8.3 file extension (set to spaces for directories) | 24 | char extension[4]; // 8.3 file extension (set to spaces for directories, null-terminated) |
| 23 | char unknown2; // unknown (always 0x01) | 25 | char unknown2; // unknown (always 0x01) |
| 24 | char unknown3; // unknown (0x00 or 0x08) | 26 | char unknown3; // unknown (0x00 or 0x08) |
| 25 | char is_directory; // directory flag | 27 | char is_directory; // directory flag |
| @@ -29,6 +31,10 @@ struct Entry { | |||
| 29 | u64 file_size; // file size (for files only) | 31 | u64 file_size; // file size (for files only) |
| 30 | }; | 32 | }; |
| 31 | static_assert(sizeof(Entry) == 0x228, "Directory Entry struct isn't exactly 0x228 bytes long!"); | 33 | static_assert(sizeof(Entry) == 0x228, "Directory Entry struct isn't exactly 0x228 bytes long!"); |
| 34 | static_assert(offsetof(Entry, short_name) == 0x20C, "Wrong offset for short_name in Entry."); | ||
| 35 | static_assert(offsetof(Entry, extension) == 0x216, "Wrong offset for extension in Entry."); | ||
| 36 | static_assert(offsetof(Entry, is_archive) == 0x21E, "Wrong offset for is_archive in Entry."); | ||
| 37 | static_assert(offsetof(Entry, file_size) == 0x220, "Wrong offset for file_size in Entry."); | ||
| 32 | 38 | ||
| 33 | class Directory : NonCopyable { | 39 | class Directory : NonCopyable { |
| 34 | public: | 40 | public: |