diff options
author | mailwl <mailwl@gmail.com> | 2018-04-24 09:56:05 +0200 |
---|---|---|
committer | mailwl <mailwl@gmail.com> | 2018-04-24 09:56:05 +0200 |
commit | a0179e5ca5bc54491f03ff60d2f971197eb03e88 (patch) | |
tree | 99ba0561c6fe429169a40e76a70db7b3f99a71ee /src/core/hle | |
parent | Merge pull request #379 from Subv/multi_buffers (diff) | |
download | yuzu-a0179e5ca5bc54491f03ff60d2f971197eb03e88.tar yuzu-a0179e5ca5bc54491f03ff60d2f971197eb03e88.tar.gz yuzu-a0179e5ca5bc54491f03ff60d2f971197eb03e88.tar.bz2 yuzu-a0179e5ca5bc54491f03ff60d2f971197eb03e88.tar.lz yuzu-a0179e5ca5bc54491f03ff60d2f971197eb03e88.tar.xz yuzu-a0179e5ca5bc54491f03ff60d2f971197eb03e88.tar.zst yuzu-a0179e5ca5bc54491f03ff60d2f971197eb03e88.zip |
Diffstat (limited to 'src/core/hle')
-rw-r--r-- | src/core/hle/service/filesystem/fsp_srv.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index 2f476c869..02e270f26 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp @@ -239,7 +239,7 @@ public: {2, &IFileSystem::CreateDirectory, "CreateDirectory"}, {3, nullptr, "DeleteDirectory"}, {4, nullptr, "DeleteDirectoryRecursively"}, - {5, nullptr, "RenameFile"}, + {5, &IFileSystem::RenameFile, "RenameFile"}, {6, nullptr, "RenameDirectory"}, {7, &IFileSystem::GetEntryType, "GetEntryType"}, {8, &IFileSystem::OpenFile, "OpenFile"}, @@ -300,6 +300,26 @@ public: rb.Push(backend->CreateDirectory(name)); } + void RenameFile(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + + std::vector<u8> buffer; + buffer.resize(ctx.BufferDescriptorX()[0].Size()); + Memory::ReadBlock(ctx.BufferDescriptorX()[0].Address(), buffer.data(), buffer.size()); + auto end = std::find(buffer.begin(), buffer.end(), '\0'); + std::string src_name(buffer.begin(), end); + + buffer.resize(ctx.BufferDescriptorX()[1].Size()); + Memory::ReadBlock(ctx.BufferDescriptorX()[1].Address(), buffer.data(), buffer.size()); + end = std::find(buffer.begin(), buffer.end(), '\0'); + std::string dst_name(buffer.begin(), end); + + LOG_DEBUG(Service_FS, "called file '%s' to file '%s'", src_name.c_str(), dst_name.c_str()); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(backend->RenameFile(src_name, dst_name)); + } + void OpenFile(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; |