diff options
| author | 2018-11-09 20:01:20 -0500 | |
|---|---|---|
| committer | 2018-11-18 10:53:47 -0500 | |
| commit | 76d515327b14c54036065167cb5dedcc5bf29eb2 (patch) | |
| tree | 4589ad42b5ce32e431499f034a09d0ea4b9d0e59 /src | |
| parent | string_util: Implement buffer to UTF-16 string helper function (diff) | |
| download | yuzu-76d515327b14c54036065167cb5dedcc5bf29eb2.tar.gz yuzu-76d515327b14c54036065167cb5dedcc5bf29eb2.tar.xz yuzu-76d515327b14c54036065167cb5dedcc5bf29eb2.zip | |
am: Implement CreateTransferMemoryStorage
Creates an AM::IStorage object with the contents of the transfer memory located at the handle provided.
Diffstat (limited to 'src')
| -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) { | |||
| 704 | LOG_DEBUG(Service_AM, "called, size={}", size); | 704 | LOG_DEBUG(Service_AM, "called, size={}", size); |
| 705 | } | 705 | } |
| 706 | 706 | ||
| 707 | void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContext& ctx) { | ||
| 708 | IPC::RequestParser rp{ctx}; | ||
| 709 | |||
| 710 | rp.SetCurrentOffset(3); | ||
| 711 | const auto handle{rp.Pop<Kernel::Handle>()}; | ||
| 712 | |||
| 713 | const auto shared_mem = | ||
| 714 | Core::System::GetInstance().CurrentProcess()->GetHandleTable().Get<Kernel::SharedMemory>( | ||
| 715 | handle); | ||
| 716 | |||
| 717 | if (shared_mem == nullptr) { | ||
| 718 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 719 | rb.Push(ResultCode(-1)); | ||
| 720 | return; | ||
| 721 | } | ||
| 722 | |||
| 723 | std::vector<u8> memory(shared_mem->size); | ||
| 724 | std::memcpy(memory.data(), shared_mem->backing_block->data() + shared_mem->backing_block_offset, | ||
| 725 | memory.size()); | ||
| 726 | |||
| 727 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 728 | rb.Push(RESULT_SUCCESS); | ||
| 729 | rb.PushIpcInterface(std::make_shared<IStorage>(std::move(memory))); | ||
| 730 | } | ||
| 731 | |||
| 707 | IApplicationFunctions::IApplicationFunctions() : ServiceFramework("IApplicationFunctions") { | 732 | IApplicationFunctions::IApplicationFunctions() : ServiceFramework("IApplicationFunctions") { |
| 708 | // clang-format off | 733 | // clang-format off |
| 709 | static const FunctionInfo functions[] = { | 734 | 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: | |||
| 163 | private: | 163 | private: |
| 164 | void CreateLibraryApplet(Kernel::HLERequestContext& ctx); | 164 | void CreateLibraryApplet(Kernel::HLERequestContext& ctx); |
| 165 | void CreateStorage(Kernel::HLERequestContext& ctx); | 165 | void CreateStorage(Kernel::HLERequestContext& ctx); |
| 166 | void CreateTransferMemoryStorage(Kernel::HLERequestContext& ctx); | ||
| 166 | }; | 167 | }; |
| 167 | 168 | ||
| 168 | class IApplicationFunctions final : public ServiceFramework<IApplicationFunctions> { | 169 | class IApplicationFunctions final : public ServiceFramework<IApplicationFunctions> { |