From 5165ed9efd6e6593b969ce560c952e074f4d9e06 Mon Sep 17 00:00:00 2001 From: Liam Date: Sun, 24 Dec 2023 19:20:43 -0500 Subject: service: fetch objects from the client handle table --- src/core/hle/service/hle_ipc.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/core/hle/service/hle_ipc.h') diff --git a/src/core/hle/service/hle_ipc.h b/src/core/hle/service/hle_ipc.h index 18d464c63..69a3cce36 100644 --- a/src/core/hle/service/hle_ipc.h +++ b/src/core/hle/service/hle_ipc.h @@ -17,6 +17,7 @@ #include "common/concepts.h" #include "common/swap.h" #include "core/hle/ipc.h" +#include "core/hle/kernel/k_handle_table.h" #include "core/hle/kernel/svc_common.h" union Result; @@ -196,10 +197,10 @@ public: } /// Populates this context with data from the requesting process/thread. - Result PopulateFromIncomingCommandBuffer(Kernel::KProcess& process, u32_le* src_cmdbuf); + Result PopulateFromIncomingCommandBuffer(u32_le* src_cmdbuf); /// Writes data from this context back to the requesting process/thread. - Result WriteToOutgoingCommandBuffer(Kernel::KThread& requesting_thread); + Result WriteToOutgoingCommandBuffer(); [[nodiscard]] u32_le GetHipcCommand() const { return command; @@ -359,8 +360,13 @@ public: return *thread; } - Kernel::KHandleTable& GetClientHandleTable() { - return *client_handle_table; + template + Kernel::KScopedAutoObject GetObjectFromHandle(u32 handle) { + auto obj = client_handle_table->GetObjectForIpc(handle, thread); + if (obj.IsNotNull()) { + return obj->DynamicCast(); + } + return nullptr; } [[nodiscard]] std::shared_ptr GetManager() const { @@ -378,7 +384,7 @@ public: private: friend class IPC::ResponseBuilder; - void ParseCommandBuffer(Kernel::KProcess& process, u32_le* src_cmdbuf, bool incoming); + void ParseCommandBuffer(u32_le* src_cmdbuf, bool incoming); std::array cmd_buf; Kernel::KServerSession* server_session{}; -- cgit v1.2.3