diff options
| -rw-r--r-- | src/core/hle/service/filesystem/filesystem.h | 7 | ||||
| -rw-r--r-- | src/core/hle/service/filesystem/fsp_srv.cpp | 18 |
2 files changed, 17 insertions, 8 deletions
diff --git a/src/core/hle/service/filesystem/filesystem.h b/src/core/hle/service/filesystem/filesystem.h index e7e7c4c28..276d264e1 100644 --- a/src/core/hle/service/filesystem/filesystem.h +++ b/src/core/hle/service/filesystem/filesystem.h | |||
| @@ -54,6 +54,13 @@ enum class ImageDirectoryId : u32 { | |||
| 54 | SdCard, | 54 | SdCard, |
| 55 | }; | 55 | }; |
| 56 | 56 | ||
| 57 | enum class OpenDirectoryMode : u64 { | ||
| 58 | Directory = (1 << 0), | ||
| 59 | File = (1 << 1), | ||
| 60 | All = Directory | File | ||
| 61 | }; | ||
| 62 | DECLARE_ENUM_FLAG_OPERATORS(OpenDirectoryMode); | ||
| 63 | |||
| 57 | class FileSystemController { | 64 | class FileSystemController { |
| 58 | public: | 65 | public: |
| 59 | explicit FileSystemController(Core::System& system_); | 66 | explicit FileSystemController(Core::System& system_); |
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index b1310d6e4..82ecc1b90 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp | |||
| @@ -259,7 +259,7 @@ static void BuildEntryIndex(std::vector<FileSys::Entry>& entries, const std::vec | |||
| 259 | 259 | ||
| 260 | class IDirectory final : public ServiceFramework<IDirectory> { | 260 | class IDirectory final : public ServiceFramework<IDirectory> { |
| 261 | public: | 261 | public: |
| 262 | explicit IDirectory(Core::System& system_, FileSys::VirtualDir backend_) | 262 | explicit IDirectory(Core::System& system_, FileSys::VirtualDir backend_, OpenDirectoryMode mode) |
| 263 | : ServiceFramework{system_, "IDirectory"}, backend(std::move(backend_)) { | 263 | : ServiceFramework{system_, "IDirectory"}, backend(std::move(backend_)) { |
| 264 | static const FunctionInfo functions[] = { | 264 | static const FunctionInfo functions[] = { |
| 265 | {0, &IDirectory::Read, "Read"}, | 265 | {0, &IDirectory::Read, "Read"}, |
| @@ -269,8 +269,12 @@ public: | |||
| 269 | 269 | ||
| 270 | // TODO(DarkLordZach): Verify that this is the correct behavior. | 270 | // TODO(DarkLordZach): Verify that this is the correct behavior. |
| 271 | // Build entry index now to save time later. | 271 | // Build entry index now to save time later. |
| 272 | BuildEntryIndex(entries, backend->GetFiles(), FileSys::EntryType::File); | 272 | if (True(mode & OpenDirectoryMode::Directory)) { |
| 273 | BuildEntryIndex(entries, backend->GetSubdirectories(), FileSys::EntryType::Directory); | 273 | BuildEntryIndex(entries, backend->GetSubdirectories(), FileSys::EntryType::Directory); |
| 274 | } | ||
| 275 | if (True(mode & OpenDirectoryMode::File)) { | ||
| 276 | BuildEntryIndex(entries, backend->GetFiles(), FileSys::EntryType::File); | ||
| 277 | } | ||
| 274 | } | 278 | } |
| 275 | 279 | ||
| 276 | private: | 280 | private: |
| @@ -446,11 +450,9 @@ public: | |||
| 446 | 450 | ||
| 447 | const auto file_buffer = ctx.ReadBuffer(); | 451 | const auto file_buffer = ctx.ReadBuffer(); |
| 448 | const std::string name = Common::StringFromBuffer(file_buffer); | 452 | const std::string name = Common::StringFromBuffer(file_buffer); |
| 453 | const auto mode = rp.PopRaw<OpenDirectoryMode>(); | ||
| 449 | 454 | ||
| 450 | // TODO(Subv): Implement this filter. | 455 | LOG_DEBUG(Service_FS, "called. directory={}, mode={}", name, mode); |
| 451 | const u32 filter_flags = rp.Pop<u32>(); | ||
| 452 | |||
| 453 | LOG_DEBUG(Service_FS, "called. directory={}, filter={}", name, filter_flags); | ||
| 454 | 456 | ||
| 455 | FileSys::VirtualDir vfs_dir{}; | 457 | FileSys::VirtualDir vfs_dir{}; |
| 456 | auto result = backend.OpenDirectory(&vfs_dir, name); | 458 | auto result = backend.OpenDirectory(&vfs_dir, name); |
| @@ -460,7 +462,7 @@ public: | |||
| 460 | return; | 462 | return; |
| 461 | } | 463 | } |
| 462 | 464 | ||
| 463 | auto directory = std::make_shared<IDirectory>(system, vfs_dir); | 465 | auto directory = std::make_shared<IDirectory>(system, vfs_dir, mode); |
| 464 | 466 | ||
| 465 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 467 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 466 | rb.Push(ResultSuccess); | 468 | rb.Push(ResultSuccess); |