summaryrefslogtreecommitdiffstats
path: root/src/core/file_sys/fs_directory.h
diff options
context:
space:
mode:
authorFearlessTobi <thm.frey@gmail.com>2024-01-18 21:31:41 +0100
committerLiam <byteslice@airmail.cc>2024-01-25 22:42:05 +0100
commitcc09c265e15e9598844482a8b5a22b12650b3f1b (patch)
treeefca7a933c1a599e04a0201e1657717d755a3248 /src/core/file_sys/fs_directory.h
parentvfs: Move vfs files to their own directory (diff)
downloadyuzu-cc09c265e15e9598844482a8b5a22b12650b3f1b.tar
yuzu-cc09c265e15e9598844482a8b5a22b12650b3f1b.tar.gz
yuzu-cc09c265e15e9598844482a8b5a22b12650b3f1b.tar.bz2
yuzu-cc09c265e15e9598844482a8b5a22b12650b3f1b.tar.lz
yuzu-cc09c265e15e9598844482a8b5a22b12650b3f1b.tar.xz
yuzu-cc09c265e15e9598844482a8b5a22b12650b3f1b.tar.zst
yuzu-cc09c265e15e9598844482a8b5a22b12650b3f1b.zip
Diffstat (limited to '')
-rw-r--r--src/core/file_sys/fs_directory.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/core/file_sys/fs_directory.h b/src/core/file_sys/fs_directory.h
new file mode 100644
index 000000000..cba6155f8
--- /dev/null
+++ b/src/core/file_sys/fs_directory.h
@@ -0,0 +1,33 @@
+// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+namespace FileSys {
+
+constexpr inline size_t EntryNameLengthMax = 0x300;
+
+struct DirectoryEntry {
+ DirectoryEntry(std::string_view view, s8 entry_type, u64 entry_size)
+ : type{entry_type}, file_size{static_cast<s64>(entry_size)} {
+ const std::size_t copy_size = view.copy(name, std::size(name) - 1);
+ name[copy_size] = '\0';
+ }
+
+ char name[EntryNameLengthMax + 1];
+ INSERT_PADDING_BYTES(3);
+ s8 type;
+ INSERT_PADDING_BYTES(3);
+ s64 file_size;
+};
+
+static_assert(sizeof(DirectoryEntry) == 0x310,
+ "Directory Entry struct isn't exactly 0x310 bytes long!");
+static_assert(offsetof(DirectoryEntry, type) == 0x304, "Wrong offset for type in Entry.");
+static_assert(offsetof(DirectoryEntry, file_size) == 0x308, "Wrong offset for file_size in Entry.");
+
+struct DirectoryHandle {
+ void* handle;
+};
+
+} // namespace FileSys