diff options
| author | 2024-02-19 19:22:51 +0100 | |
|---|---|---|
| committer | 2024-02-19 19:22:51 +0100 | |
| commit | ef5027712413705802d10c797b0f0b66375a9f58 (patch) | |
| tree | 979cf4d365ca5d7f0e63abdd3ecf476f93d4b21b /src | |
| parent | Address review comments (diff) | |
| download | yuzu-ef5027712413705802d10c797b0f0b66375a9f58.tar.gz yuzu-ef5027712413705802d10c797b0f0b66375a9f58.tar.xz yuzu-ef5027712413705802d10c797b0f0b66375a9f58.zip | |
Address review comments pt. 2
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/file_sys/fs_filesystem.h | 25 | ||||
| -rw-r--r-- | src/core/file_sys/fs_path_utility.h | 8 | ||||
| -rw-r--r-- | src/core/file_sys/fsa/fs_i_directory.h | 2 | ||||
| -rw-r--r-- | src/core/file_sys/fsa/fs_i_file.h | 6 | ||||
| -rw-r--r-- | src/core/hle/service/filesystem/fsp/fs_i_filesystem.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/filesystem/fsp/fs_i_filesystem.h | 28 |
6 files changed, 34 insertions, 39 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 | ||
| 41 | struct 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 | }; | ||
| 64 | static_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 | ||
| 126 | private: | 126 | private: |
| 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 | } |
diff --git a/src/core/hle/service/filesystem/fsp/fs_i_filesystem.cpp b/src/core/hle/service/filesystem/fsp/fs_i_filesystem.cpp index 86dd5b7e9..d881e144d 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_filesystem.cpp +++ b/src/core/hle/service/filesystem/fsp/fs_i_filesystem.cpp | |||
| @@ -157,10 +157,10 @@ Result IFileSystem::GetFileTimeStampRaw( | |||
| 157 | R_SUCCEED(); | 157 | R_SUCCEED(); |
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | Result IFileSystem::GetFileSystemAttribute(Out<FileSystemAttribute> out_attribute) { | 160 | Result IFileSystem::GetFileSystemAttribute(Out<FileSys::FileSystemAttribute> out_attribute) { |
| 161 | LOG_WARNING(Service_FS, "(STUBBED) called"); | 161 | LOG_WARNING(Service_FS, "(STUBBED) called"); |
| 162 | 162 | ||
| 163 | FileSystemAttribute savedata_attribute{}; | 163 | FileSys::FileSystemAttribute savedata_attribute{}; |
| 164 | savedata_attribute.dir_entry_name_length_max_defined = true; | 164 | savedata_attribute.dir_entry_name_length_max_defined = true; |
| 165 | savedata_attribute.file_entry_name_length_max_defined = true; | 165 | savedata_attribute.file_entry_name_length_max_defined = true; |
| 166 | savedata_attribute.dir_entry_name_length_max = 0x40; | 166 | savedata_attribute.dir_entry_name_length_max = 0x40; |
diff --git a/src/core/hle/service/filesystem/fsp/fs_i_filesystem.h b/src/core/hle/service/filesystem/fsp/fs_i_filesystem.h index 230ab8d71..113369203 100644 --- a/src/core/hle/service/filesystem/fsp/fs_i_filesystem.h +++ b/src/core/hle/service/filesystem/fsp/fs_i_filesystem.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include "common/common_funcs.h" | 6 | #include "common/common_funcs.h" |
| 7 | #include "core/file_sys/fs_filesystem.h" | ||
| 7 | #include "core/file_sys/fsa/fs_i_filesystem.h" | 8 | #include "core/file_sys/fsa/fs_i_filesystem.h" |
| 8 | #include "core/file_sys/vfs/vfs.h" | 9 | #include "core/file_sys/vfs/vfs.h" |
| 9 | #include "core/hle/service/cmif_types.h" | 10 | #include "core/hle/service/cmif_types.h" |
| @@ -24,31 +25,6 @@ class IFileSystem final : public ServiceFramework<IFileSystem> { | |||
| 24 | public: | 25 | public: |
| 25 | explicit IFileSystem(Core::System& system_, FileSys::VirtualDir dir_, SizeGetter size_getter_); | 26 | explicit IFileSystem(Core::System& system_, FileSys::VirtualDir dir_, SizeGetter size_getter_); |
| 26 | 27 | ||
| 27 | struct FileSystemAttribute { | ||
| 28 | u8 dir_entry_name_length_max_defined; | ||
| 29 | u8 file_entry_name_length_max_defined; | ||
| 30 | u8 dir_path_name_length_max_defined; | ||
| 31 | u8 file_path_name_length_max_defined; | ||
| 32 | INSERT_PADDING_BYTES_NOINIT(0x5); | ||
| 33 | u8 utf16_dir_entry_name_length_max_defined; | ||
| 34 | u8 utf16_file_entry_name_length_max_defined; | ||
| 35 | u8 utf16_dir_path_name_length_max_defined; | ||
| 36 | u8 utf16_file_path_name_length_max_defined; | ||
| 37 | INSERT_PADDING_BYTES_NOINIT(0x18); | ||
| 38 | s32 dir_entry_name_length_max; | ||
| 39 | s32 file_entry_name_length_max; | ||
| 40 | s32 dir_path_name_length_max; | ||
| 41 | s32 file_path_name_length_max; | ||
| 42 | INSERT_PADDING_WORDS_NOINIT(0x5); | ||
| 43 | s32 utf16_dir_entry_name_length_max; | ||
| 44 | s32 utf16_file_entry_name_length_max; | ||
| 45 | s32 utf16_dir_path_name_length_max; | ||
| 46 | s32 utf16_file_path_name_length_max; | ||
| 47 | INSERT_PADDING_WORDS_NOINIT(0x18); | ||
| 48 | INSERT_PADDING_WORDS_NOINIT(0x1); | ||
| 49 | }; | ||
| 50 | static_assert(sizeof(FileSystemAttribute) == 0xC0, "FileSystemAttribute has incorrect size"); | ||
| 51 | |||
| 52 | Result CreateFile(const InLargeData<FileSys::Sf::Path, BufferAttr_HipcPointer> path, s32 option, | 28 | Result CreateFile(const InLargeData<FileSys::Sf::Path, BufferAttr_HipcPointer> path, s32 option, |
| 53 | s64 size); | 29 | s64 size); |
| 54 | Result DeleteFile(const InLargeData<FileSys::Sf::Path, BufferAttr_HipcPointer> path); | 30 | Result DeleteFile(const InLargeData<FileSys::Sf::Path, BufferAttr_HipcPointer> path); |
| @@ -74,7 +50,7 @@ public: | |||
| 74 | const InLargeData<FileSys::Sf::Path, BufferAttr_HipcPointer> path); | 50 | const InLargeData<FileSys::Sf::Path, BufferAttr_HipcPointer> path); |
| 75 | Result GetFileTimeStampRaw(Out<FileSys::FileTimeStampRaw> out_timestamp, | 51 | Result GetFileTimeStampRaw(Out<FileSys::FileTimeStampRaw> out_timestamp, |
| 76 | const InLargeData<FileSys::Sf::Path, BufferAttr_HipcPointer> path); | 52 | const InLargeData<FileSys::Sf::Path, BufferAttr_HipcPointer> path); |
| 77 | Result GetFileSystemAttribute(Out<FileSystemAttribute> out_attribute); | 53 | Result GetFileSystemAttribute(Out<FileSys::FileSystemAttribute> out_attribute); |
| 78 | 54 | ||
| 79 | private: | 55 | private: |
| 80 | std::unique_ptr<FileSys::Fsa::IFileSystem> backend; | 56 | std::unique_ptr<FileSys::Fsa::IFileSystem> backend; |