diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/filesystem/fsp_srv.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index 5536991bc..6f539316e 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp | |||
| @@ -210,6 +210,7 @@ public: | |||
| 210 | {0, &IFileSystem::CreateFile, "CreateFile"}, | 210 | {0, &IFileSystem::CreateFile, "CreateFile"}, |
| 211 | {7, &IFileSystem::GetEntryType, "GetEntryType"}, | 211 | {7, &IFileSystem::GetEntryType, "GetEntryType"}, |
| 212 | {8, &IFileSystem::OpenFile, "OpenFile"}, | 212 | {8, &IFileSystem::OpenFile, "OpenFile"}, |
| 213 | {9, &IFileSystem::OpenDirectory, "OpenDirectory"}, | ||
| 213 | {10, &IFileSystem::Commit, "Commit"}, | 214 | {10, &IFileSystem::Commit, "Commit"}, |
| 214 | }; | 215 | }; |
| 215 | RegisterHandlers(functions); | 216 | RegisterHandlers(functions); |
| @@ -259,6 +260,33 @@ public: | |||
| 259 | rb.PushIpcInterface<IFile>(std::move(file)); | 260 | rb.PushIpcInterface<IFile>(std::move(file)); |
| 260 | } | 261 | } |
| 261 | 262 | ||
| 263 | void OpenDirectory(Kernel::HLERequestContext& ctx) { | ||
| 264 | IPC::RequestParser rp{ctx}; | ||
| 265 | |||
| 266 | auto file_buffer = ctx.ReadBuffer(); | ||
| 267 | auto end = std::find(file_buffer.begin(), file_buffer.end(), '\0'); | ||
| 268 | |||
| 269 | std::string name(file_buffer.begin(), end); | ||
| 270 | |||
| 271 | // TODO(Subv): Implement this filter. | ||
| 272 | u32 filter_flags = rp.Pop<u32>(); | ||
| 273 | |||
| 274 | LOG_DEBUG(Service_FS, "called directory %s filter %u", name.c_str(), filter_flags); | ||
| 275 | |||
| 276 | auto result = backend->OpenDirectory(name); | ||
| 277 | if (result.Failed()) { | ||
| 278 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 279 | rb.Push(result.Code()); | ||
| 280 | return; | ||
| 281 | } | ||
| 282 | |||
| 283 | auto directory = std::move(result.Unwrap()); | ||
| 284 | |||
| 285 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 286 | rb.Push(RESULT_SUCCESS); | ||
| 287 | rb.PushIpcInterface<IDirectory>(std::move(directory)); | ||
| 288 | } | ||
| 289 | |||
| 262 | void GetEntryType(Kernel::HLERequestContext& ctx) { | 290 | void GetEntryType(Kernel::HLERequestContext& ctx) { |
| 263 | IPC::RequestParser rp{ctx}; | 291 | IPC::RequestParser rp{ctx}; |
| 264 | 292 | ||