diff options
-rw-r--r-- | src/common/vector_math.h | 18 | ||||
-rw-r--r-- | src/core/hle/ipc.h | 1 | ||||
-rw-r--r-- | src/core/hle/ipc_helpers.h | 7 | ||||
-rw-r--r-- | src/core/hle/kernel/hle_ipc.h | 12 | ||||
-rw-r--r-- | src/core/hle/kernel/server_session.cpp | 3 |
5 files changed, 32 insertions, 9 deletions
diff --git a/src/common/vector_math.h b/src/common/vector_math.h index 3f15ac1f4..cca43bd4c 100644 --- a/src/common/vector_math.h +++ b/src/common/vector_math.h @@ -52,8 +52,8 @@ static inline Vec4<T> MakeVec(const T& x, const T& y, const T& z, const T& w); template <typename T> class Vec2 { public: - T x; - T y; + T x{}; + T y{}; Vec2() = default; Vec2(const T& _x, const T& _y) : x(_x), y(_y) {} @@ -192,9 +192,9 @@ inline float Vec2<float>::Normalize() { template <typename T> class Vec3 { public: - T x; - T y; - T z; + T x{}; + T y{}; + T z{}; Vec3() = default; Vec3(const T& _x, const T& _y, const T& _z) : x(_x), y(_y), z(_z) {} @@ -392,10 +392,10 @@ typedef Vec3<float> Vec3f; template <typename T> class Vec4 { public: - T x; - T y; - T z; - T w; + T x{}; + T y{}; + T z{}; + T w{}; Vec4() = default; Vec4(const T& _x, const T& _y, const T& _z, const T& _w) : x(_x), y(_y), z(_z), w(_w) {} diff --git a/src/core/hle/ipc.h b/src/core/hle/ipc.h index a6602e12c..ef6595550 100644 --- a/src/core/hle/ipc.h +++ b/src/core/hle/ipc.h @@ -167,6 +167,7 @@ struct DomainMessageHeader { struct { union { BitField<0, 8, CommandType> command; + BitField<8, 8, u32_le> input_object_count; BitField<16, 16, u32_le> size; }; u32_le object_id; diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h index 3f87c4297..24605a273 100644 --- a/src/core/hle/ipc_helpers.h +++ b/src/core/hle/ipc_helpers.h @@ -298,6 +298,13 @@ public: template <typename T> Kernel::SharedPtr<T> GetCopyObject(size_t index); + + template <class T> + std::shared_ptr<T> PopIpcInterface() { + ASSERT(context->Session()->IsDomain()); + ASSERT(context->GetDomainMessageHeader()->input_object_count > 0); + return context->GetDomainRequestHandler<T>(Pop<u32>() - 1); + } }; /// Pop /// diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h index 6d4ed7648..376263eac 100644 --- a/src/core/hle/kernel/hle_ipc.h +++ b/src/core/hle/kernel/hle_ipc.h @@ -202,6 +202,16 @@ public: domain_objects.emplace_back(std::move(object)); } + template <typename T> + std::shared_ptr<T> GetDomainRequestHandler(size_t index) const { + return std::static_pointer_cast<T>(domain_request_handlers[index]); + } + + void SetDomainRequestHandlers( + const std::vector<std::shared_ptr<SessionRequestHandler>>& handlers) { + domain_request_handlers = handlers; + } + /// Clears the list of objects so that no lingering objects are written accidentally to the /// response buffer. void ClearIncomingObjects() { @@ -245,6 +255,8 @@ private: unsigned data_payload_offset{}; unsigned buffer_c_offset{}; u32_le command{}; + + std::vector<std::shared_ptr<SessionRequestHandler>> domain_request_handlers; }; } // namespace Kernel diff --git a/src/core/hle/kernel/server_session.cpp b/src/core/hle/kernel/server_session.cpp index ad47ff9df..bf812c543 100644 --- a/src/core/hle/kernel/server_session.cpp +++ b/src/core/hle/kernel/server_session.cpp @@ -61,6 +61,9 @@ void ServerSession::Acquire(Thread* thread) { ResultCode ServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& context) { auto& domain_message_header = context.GetDomainMessageHeader(); if (domain_message_header) { + // Set domain handlers in HLE context, used for domain objects (IPC interfaces) as inputs + context.SetDomainRequestHandlers(domain_request_handlers); + // If there is a DomainMessageHeader, then this is CommandType "Request" const u32 object_id{context.GetDomainMessageHeader()->object_id}; switch (domain_message_header->command) { |