diff options
author | bunnei <bunneidev@gmail.com> | 2021-05-08 08:30:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-08 08:30:17 +0200 |
commit | faa067f175cbf5e916ed75776817f0046e6731c4 (patch) | |
tree | 8ab02a72a6e4d6578848c8da2c02af02684aeec7 /src/core/hle/ipc_helpers.h | |
parent | Merge pull request #6287 from lioncash/ldr-copy (diff) | |
parent | hle: kernel: KPageTable: CanContain should not be constexpr. (diff) | |
download | yuzu-faa067f175cbf5e916ed75776817f0046e6731c4.tar yuzu-faa067f175cbf5e916ed75776817f0046e6731c4.tar.gz yuzu-faa067f175cbf5e916ed75776817f0046e6731c4.tar.bz2 yuzu-faa067f175cbf5e916ed75776817f0046e6731c4.tar.lz yuzu-faa067f175cbf5e916ed75776817f0046e6731c4.tar.xz yuzu-faa067f175cbf5e916ed75776817f0046e6731c4.tar.zst yuzu-faa067f175cbf5e916ed75776817f0046e6731c4.zip |
Diffstat (limited to 'src/core/hle/ipc_helpers.h')
-rw-r--r-- | src/core/hle/ipc_helpers.h | 65 |
1 files changed, 35 insertions, 30 deletions
diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h index 56cc911d1..0906b8cfb 100644 --- a/src/core/hle/ipc_helpers.h +++ b/src/core/hle/ipc_helpers.h @@ -13,12 +13,9 @@ #include "common/assert.h" #include "common/common_types.h" #include "core/hle/ipc.h" -#include "core/hle/kernel/client_port.h" -#include "core/hle/kernel/client_session.h" #include "core/hle/kernel/hle_ipc.h" -#include "core/hle/kernel/object.h" -#include "core/hle/kernel/server_session.h" -#include "core/hle/kernel/session.h" +#include "core/hle/kernel/k_client_port.h" +#include "core/hle/kernel/k_session.h" #include "core/hle/result.h" namespace IPC { @@ -137,9 +134,11 @@ public: if (context->Session()->IsDomain()) { context->AddDomainObject(std::move(iface)); } else { - auto [client, server] = Kernel::Session::Create(kernel, iface->GetServiceName()); - context->AddMoveObject(std::move(client)); - iface->ClientConnected(std::move(server)); + auto* session = Kernel::KSession::Create(kernel); + session->Initialize(nullptr, iface->GetServiceName()); + + context->AddMoveObject(&session->GetClientSession()); + iface->ClientConnected(&session->GetServerSession()); } } @@ -215,10 +214,16 @@ public: void PushRaw(const T& value); template <typename... O> - void PushMoveObjects(std::shared_ptr<O>... pointers); + void PushMoveObjects(O*... pointers); + + template <typename... O> + void PushMoveObjects(O&... pointers); template <typename... O> - void PushCopyObjects(std::shared_ptr<O>... pointers); + void PushCopyObjects(O*... pointers); + + template <typename... O> + void PushCopyObjects(O&... pointers); private: u32 normal_params_size{}; @@ -301,18 +306,34 @@ void ResponseBuilder::Push(const First& first_value, const Other&... other_value } template <typename... O> -inline void ResponseBuilder::PushCopyObjects(std::shared_ptr<O>... pointers) { +inline void ResponseBuilder::PushCopyObjects(O*... pointers) { auto objects = {pointers...}; for (auto& object : objects) { - context->AddCopyObject(std::move(object)); + context->AddCopyObject(object); } } template <typename... O> -inline void ResponseBuilder::PushMoveObjects(std::shared_ptr<O>... pointers) { +inline void ResponseBuilder::PushCopyObjects(O&... pointers) { + auto objects = {&pointers...}; + for (auto& object : objects) { + context->AddCopyObject(object); + } +} + +template <typename... O> +inline void ResponseBuilder::PushMoveObjects(O*... pointers) { auto objects = {pointers...}; for (auto& object : objects) { - context->AddMoveObject(std::move(object)); + context->AddMoveObject(object); + } +} + +template <typename... O> +inline void ResponseBuilder::PushMoveObjects(O&... pointers) { + auto objects = {&pointers...}; + for (auto& object : objects) { + context->AddMoveObject(object); } } @@ -359,12 +380,6 @@ public: template <typename T> T PopRaw(); - template <typename T> - std::shared_ptr<T> GetMoveObject(std::size_t index); - - template <typename T> - std::shared_ptr<T> GetCopyObject(std::size_t index); - template <class T> std::shared_ptr<T> PopIpcInterface() { ASSERT(context->Session()->IsDomain()); @@ -469,14 +484,4 @@ void RequestParser::Pop(First& first_value, Other&... other_values) { Pop(other_values...); } -template <typename T> -std::shared_ptr<T> RequestParser::GetMoveObject(std::size_t index) { - return context->GetMoveObject<T>(index); -} - -template <typename T> -std::shared_ptr<T> RequestParser::GetCopyObject(std::size_t index) { - return context->GetCopyObject<T>(index); -} - } // namespace IPC |