diff options
author | FearlessTobi <thm.frey@gmail.com> | 2024-02-19 19:22:51 +0100 |
---|---|---|
committer | FearlessTobi <thm.frey@gmail.com> | 2024-02-19 19:22:51 +0100 |
commit | ef5027712413705802d10c797b0f0b66375a9f58 (patch) | |
tree | 979cf4d365ca5d7f0e63abdd3ecf476f93d4b21b /src/core | |
parent | Address review comments (diff) | |
download | yuzu-ef5027712413705802d10c797b0f0b66375a9f58.tar yuzu-ef5027712413705802d10c797b0f0b66375a9f58.tar.gz yuzu-ef5027712413705802d10c797b0f0b66375a9f58.tar.bz2 yuzu-ef5027712413705802d10c797b0f0b66375a9f58.tar.lz yuzu-ef5027712413705802d10c797b0f0b66375a9f58.tar.xz yuzu-ef5027712413705802d10c797b0f0b66375a9f58.tar.zst yuzu-ef5027712413705802d10c797b0f0b66375a9f58.zip |
Diffstat (limited to 'src/core')
-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 { BigFile = (1 << 0), }; +struct FileSystemAttribute { + u8 dir_entry_name_length_max_defined; + u8 file_entry_name_length_max_defined; + u8 dir_path_name_length_max_defined; + u8 file_path_name_length_max_defined; + INSERT_PADDING_BYTES_NOINIT(0x5); + u8 utf16_dir_entry_name_length_max_defined; + u8 utf16_file_entry_name_length_max_defined; + u8 utf16_dir_path_name_length_max_defined; + u8 utf16_file_path_name_length_max_defined; + INSERT_PADDING_BYTES_NOINIT(0x18); + s32 dir_entry_name_length_max; + s32 file_entry_name_length_max; + s32 dir_path_name_length_max; + s32 file_path_name_length_max; + INSERT_PADDING_WORDS_NOINIT(0x5); + s32 utf16_dir_entry_name_length_max; + s32 utf16_file_entry_name_length_max; + s32 utf16_dir_path_name_length_max; + s32 utf16_file_path_name_length_max; + INSERT_PADDING_WORDS_NOINIT(0x18); + INSERT_PADDING_WORDS_NOINIT(0x1); +}; +static_assert(sizeof(FileSystemAttribute) == 0xC0, "FileSystemAttribute has incorrect size"); + } // 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: } #define DECLARE_PATH_FLAG_HANDLER(__WHICH__) \ - constexpr bool Is##__WHICH__##Allowed() const { \ - return (m_value & __WHICH__##Flag) != 0; \ - } \ - constexpr void Allow##__WHICH__() { \ - m_value |= __WHICH__##Flag; \ - } + constexpr bool Is##__WHICH__##Allowed() const { return (m_value & __WHICH__##Flag) != 0; } \ + constexpr void Allow##__WHICH__() { m_value |= __WHICH__##Flag; } DECLARE_PATH_FLAG_HANDLER(WindowsPath) 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: next_entry_index += actual_entries; *out_count = actual_entries; - std::memcpy(out_entries, entries.data(), range_size); + std::memcpy(out_entries, begin, range_size); R_SUCCEED(); } 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: private: Result DoRead(size_t* out, s64 offset, void* buffer, size_t size, const ReadOption& option) { - std::vector<u8> output = backend->ReadBytes(size, offset); - - *out = output.size(); - std::memcpy(buffer, output.data(), size); + const auto read_size = backend->Read(static_cast<u8*>(buffer), size, offset); + *out = read_size; R_SUCCEED(); } 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( R_SUCCEED(); } -Result IFileSystem::GetFileSystemAttribute(Out<FileSystemAttribute> out_attribute) { +Result IFileSystem::GetFileSystemAttribute(Out<FileSys::FileSystemAttribute> out_attribute) { LOG_WARNING(Service_FS, "(STUBBED) called"); - FileSystemAttribute savedata_attribute{}; + FileSys::FileSystemAttribute savedata_attribute{}; savedata_attribute.dir_entry_name_length_max_defined = true; savedata_attribute.file_entry_name_length_max_defined = true; 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 @@ #pragma once #include "common/common_funcs.h" +#include "core/file_sys/fs_filesystem.h" #include "core/file_sys/fsa/fs_i_filesystem.h" #include "core/file_sys/vfs/vfs.h" #include "core/hle/service/cmif_types.h" @@ -24,31 +25,6 @@ class IFileSystem final : public ServiceFramework<IFileSystem> { public: explicit IFileSystem(Core::System& system_, FileSys::VirtualDir dir_, SizeGetter size_getter_); - struct FileSystemAttribute { - u8 dir_entry_name_length_max_defined; - u8 file_entry_name_length_max_defined; - u8 dir_path_name_length_max_defined; - u8 file_path_name_length_max_defined; - INSERT_PADDING_BYTES_NOINIT(0x5); - u8 utf16_dir_entry_name_length_max_defined; - u8 utf16_file_entry_name_length_max_defined; - u8 utf16_dir_path_name_length_max_defined; - u8 utf16_file_path_name_length_max_defined; - INSERT_PADDING_BYTES_NOINIT(0x18); - s32 dir_entry_name_length_max; - s32 file_entry_name_length_max; - s32 dir_path_name_length_max; - s32 file_path_name_length_max; - INSERT_PADDING_WORDS_NOINIT(0x5); - s32 utf16_dir_entry_name_length_max; - s32 utf16_file_entry_name_length_max; - s32 utf16_dir_path_name_length_max; - s32 utf16_file_path_name_length_max; - INSERT_PADDING_WORDS_NOINIT(0x18); - INSERT_PADDING_WORDS_NOINIT(0x1); - }; - static_assert(sizeof(FileSystemAttribute) == 0xC0, "FileSystemAttribute has incorrect size"); - Result CreateFile(const InLargeData<FileSys::Sf::Path, BufferAttr_HipcPointer> path, s32 option, s64 size); Result DeleteFile(const InLargeData<FileSys::Sf::Path, BufferAttr_HipcPointer> path); @@ -74,7 +50,7 @@ public: const InLargeData<FileSys::Sf::Path, BufferAttr_HipcPointer> path); Result GetFileTimeStampRaw(Out<FileSys::FileTimeStampRaw> out_timestamp, const InLargeData<FileSys::Sf::Path, BufferAttr_HipcPointer> path); - Result GetFileSystemAttribute(Out<FileSystemAttribute> out_attribute); + Result GetFileSystemAttribute(Out<FileSys::FileSystemAttribute> out_attribute); private: std::unique_ptr<FileSys::Fsa::IFileSystem> backend; |