summaryrefslogtreecommitdiff
path: root/src/core/file_sys
diff options
context:
space:
mode:
authorGravatar FearlessTobi2024-02-19 19:22:51 +0100
committerGravatar FearlessTobi2024-02-19 19:22:51 +0100
commitef5027712413705802d10c797b0f0b66375a9f58 (patch)
tree979cf4d365ca5d7f0e63abdd3ecf476f93d4b21b /src/core/file_sys
parentAddress review comments (diff)
downloadyuzu-ef5027712413705802d10c797b0f0b66375a9f58.tar.gz
yuzu-ef5027712413705802d10c797b0f0b66375a9f58.tar.xz
yuzu-ef5027712413705802d10c797b0f0b66375a9f58.zip
Address review comments pt. 2
Diffstat (limited to 'src/core/file_sys')
-rw-r--r--src/core/file_sys/fs_filesystem.h25
-rw-r--r--src/core/file_sys/fs_path_utility.h8
-rw-r--r--src/core/file_sys/fsa/fs_i_directory.h2
-rw-r--r--src/core/file_sys/fsa/fs_i_file.h6
4 files changed, 30 insertions, 11 deletions
diff --git a/src/core/file_sys/fs_filesystem.h b/src/core/file_sys/fs_filesystem.h
index 598b59a74..329b5aca5 100644
--- a/src/core/file_sys/fs_filesystem.h
+++ b/src/core/file_sys/fs_filesystem.h
@@ -38,4 +38,29 @@ enum class CreateOption : u8 {
38 BigFile = (1 << 0), 38 BigFile = (1 << 0),
39}; 39};
40 40
41struct FileSystemAttribute {
42 u8 dir_entry_name_length_max_defined;
43 u8 file_entry_name_length_max_defined;
44 u8 dir_path_name_length_max_defined;
45 u8 file_path_name_length_max_defined;
46 INSERT_PADDING_BYTES_NOINIT(0x5);
47 u8 utf16_dir_entry_name_length_max_defined;
48 u8 utf16_file_entry_name_length_max_defined;
49 u8 utf16_dir_path_name_length_max_defined;
50 u8 utf16_file_path_name_length_max_defined;
51 INSERT_PADDING_BYTES_NOINIT(0x18);
52 s32 dir_entry_name_length_max;
53 s32 file_entry_name_length_max;
54 s32 dir_path_name_length_max;
55 s32 file_path_name_length_max;
56 INSERT_PADDING_WORDS_NOINIT(0x5);
57 s32 utf16_dir_entry_name_length_max;
58 s32 utf16_file_entry_name_length_max;
59 s32 utf16_dir_path_name_length_max;
60 s32 utf16_file_path_name_length_max;
61 INSERT_PADDING_WORDS_NOINIT(0x18);
62 INSERT_PADDING_WORDS_NOINIT(0x1);
63};
64static_assert(sizeof(FileSystemAttribute) == 0xC0, "FileSystemAttribute has incorrect size");
65
41} // namespace FileSys 66} // namespace FileSys
diff --git a/src/core/file_sys/fs_path_utility.h b/src/core/file_sys/fs_path_utility.h
index 51418ee16..cdfd8c772 100644
--- a/src/core/file_sys/fs_path_utility.h
+++ b/src/core/file_sys/fs_path_utility.h
@@ -91,12 +91,8 @@ public:
91 } 91 }
92 92
93#define DECLARE_PATH_FLAG_HANDLER(__WHICH__) \ 93#define DECLARE_PATH_FLAG_HANDLER(__WHICH__) \
94 constexpr bool Is##__WHICH__##Allowed() const { \ 94 constexpr bool Is##__WHICH__##Allowed() const { return (m_value & __WHICH__##Flag) != 0; } \
95 return (m_value & __WHICH__##Flag) != 0; \ 95 constexpr void Allow##__WHICH__() { m_value |= __WHICH__##Flag; }
96 } \
97 constexpr void Allow##__WHICH__() { \
98 m_value |= __WHICH__##Flag; \
99 }
100 96
101 DECLARE_PATH_FLAG_HANDLER(WindowsPath) 97 DECLARE_PATH_FLAG_HANDLER(WindowsPath)
102 DECLARE_PATH_FLAG_HANDLER(RelativePath) 98 DECLARE_PATH_FLAG_HANDLER(RelativePath)
diff --git a/src/core/file_sys/fsa/fs_i_directory.h b/src/core/file_sys/fsa/fs_i_directory.h
index fc0407d01..c8e895eab 100644
--- a/src/core/file_sys/fsa/fs_i_directory.h
+++ b/src/core/file_sys/fsa/fs_i_directory.h
@@ -56,7 +56,7 @@ private:
56 next_entry_index += actual_entries; 56 next_entry_index += actual_entries;
57 *out_count = actual_entries; 57 *out_count = actual_entries;
58 58
59 std::memcpy(out_entries, entries.data(), range_size); 59 std::memcpy(out_entries, begin, range_size);
60 60
61 R_SUCCEED(); 61 R_SUCCEED();
62 } 62 }
diff --git a/src/core/file_sys/fsa/fs_i_file.h b/src/core/file_sys/fsa/fs_i_file.h
index 8fdd71c80..1188ae8ca 100644
--- a/src/core/file_sys/fsa/fs_i_file.h
+++ b/src/core/file_sys/fsa/fs_i_file.h
@@ -125,10 +125,8 @@ protected:
125 125
126private: 126private:
127 Result DoRead(size_t* out, s64 offset, void* buffer, size_t size, const ReadOption& option) { 127 Result DoRead(size_t* out, s64 offset, void* buffer, size_t size, const ReadOption& option) {
128 std::vector<u8> output = backend->ReadBytes(size, offset); 128 const auto read_size = backend->Read(static_cast<u8*>(buffer), size, offset);
129 129 *out = read_size;
130 *out = output.size();
131 std::memcpy(buffer, output.data(), size);
132 130
133 R_SUCCEED(); 131 R_SUCCEED();
134 } 132 }