diff options
author | Zach Hilman <zachhilman@gmail.com> | 2018-11-10 02:01:20 +0100 |
---|---|---|
committer | Zach Hilman <zachhilman@gmail.com> | 2018-11-18 16:53:47 +0100 |
commit | 76d515327b14c54036065167cb5dedcc5bf29eb2 (patch) | |
tree | 4589ad42b5ce32e431499f034a09d0ea4b9d0e59 | |
parent | string_util: Implement buffer to UTF-16 string helper function (diff) | |
download | yuzu-76d515327b14c54036065167cb5dedcc5bf29eb2.tar yuzu-76d515327b14c54036065167cb5dedcc5bf29eb2.tar.gz yuzu-76d515327b14c54036065167cb5dedcc5bf29eb2.tar.bz2 yuzu-76d515327b14c54036065167cb5dedcc5bf29eb2.tar.lz yuzu-76d515327b14c54036065167cb5dedcc5bf29eb2.tar.xz yuzu-76d515327b14c54036065167cb5dedcc5bf29eb2.tar.zst yuzu-76d515327b14c54036065167cb5dedcc5bf29eb2.zip |
-rw-r--r-- | src/core/hle/service/am/am.cpp | 25 | ||||
-rw-r--r-- | src/core/hle/service/am/am.h | 1 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 3758ecae1..a7716d80b 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -704,6 +704,31 @@ void ILibraryAppletCreator::CreateStorage(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called, size={}", size); } +void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + + rp.SetCurrentOffset(3); + const auto handle{rp.Pop<Kernel::Handle>()}; + + const auto shared_mem = + Core::System::GetInstance().CurrentProcess()->GetHandleTable().Get<Kernel::SharedMemory>( + handle); + + if (shared_mem == nullptr) { + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultCode(-1)); + return; + } + + std::vector<u8> memory(shared_mem->size); + std::memcpy(memory.data(), shared_mem->backing_block->data() + shared_mem->backing_block_offset, + memory.size()); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(RESULT_SUCCESS); + rb.PushIpcInterface(std::make_shared<IStorage>(std::move(memory))); +} + IApplicationFunctions::IApplicationFunctions() : ServiceFramework("IApplicationFunctions") { // clang-format off static const FunctionInfo functions[] = { diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index 5a3fcba8f..50b2775ea 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h @@ -163,6 +163,7 @@ public: private: void CreateLibraryApplet(Kernel::HLERequestContext& ctx); void CreateStorage(Kernel::HLERequestContext& ctx); + void CreateTransferMemoryStorage(Kernel::HLERequestContext& ctx); }; class IApplicationFunctions final : public ServiceFramework<IApplicationFunctions> { |