diff options
| author | 2018-03-19 23:02:30 -0500 | |
|---|---|---|
| committer | 2018-03-19 23:02:30 -0500 | |
| commit | 0485ee499f9e00fb2ec1926876d6e50c9b22447b (patch) | |
| tree | 3e0a48b1648366aa7b41ce3c48a628b0a6c067d7 /src/core | |
| parent | FS: Added the IDirectory IPC interface and implemented its two functions. (diff) | |
| download | yuzu-0485ee499f9e00fb2ec1926876d6e50c9b22447b.tar.gz yuzu-0485ee499f9e00fb2ec1926876d6e50c9b22447b.tar.xz yuzu-0485ee499f9e00fb2ec1926876d6e50c9b22447b.zip | |
FS: Implemented IFileSystem's OpenDirectory function.
Note that the filter parameter is not yet implemented.
Diffstat (limited to 'src/core')
| -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 | ||