summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/hle/ipc_helpers.h1
-rw-r--r--src/core/hle/kernel/hle_ipc.cpp14
-rw-r--r--src/core/hle/kernel/hle_ipc.h1
3 files changed, 15 insertions, 1 deletions
diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h
index f235153c3..5fed3dbf5 100644
--- a/src/core/hle/ipc_helpers.h
+++ b/src/core/hle/ipc_helpers.h
@@ -108,6 +108,7 @@ public:
108 header.type.Assign(ctx.GetCommandType()); 108 header.type.Assign(ctx.GetCommandType());
109 } 109 }
110 110
111 ctx.data_size = static_cast<u32>(raw_data_size);
111 header.data_size.Assign(static_cast<u32>(raw_data_size)); 112 header.data_size.Assign(static_cast<u32>(raw_data_size));
112 if (num_handles_to_copy || num_handles_to_move) { 113 if (num_handles_to_copy || num_handles_to_move) {
113 header.enable_handle_descriptor.Assign(1); 114 header.enable_handle_descriptor.Assign(1);
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp
index edb3f8d98..ce3466df8 100644
--- a/src/core/hle/kernel/hle_ipc.cpp
+++ b/src/core/hle/kernel/hle_ipc.cpp
@@ -186,6 +186,18 @@ ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(KThread& requesting_t
186 auto& owner_process = *requesting_thread.GetOwnerProcess(); 186 auto& owner_process = *requesting_thread.GetOwnerProcess();
187 auto& handle_table = owner_process.GetHandleTable(); 187 auto& handle_table = owner_process.GetHandleTable();
188 188
189 // The data_size already includes the payload header, the padding and the domain header.
190 std::size_t size{};
191
192 if (IsTipc()) {
193 size = cmd_buf.size();
194 } else {
195 size = data_payload_offset + data_size - sizeof(IPC::DataPayloadHeader) / sizeof(u32) - 4;
196 if (Session()->IsDomain()) {
197 size -= sizeof(IPC::DomainMessageHeader) / sizeof(u32);
198 }
199 }
200
189 for (auto& object : copy_objects) { 201 for (auto& object : copy_objects) {
190 Handle handle{}; 202 Handle handle{};
191 if (object) { 203 if (object) {
@@ -218,7 +230,7 @@ ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(KThread& requesting_t
218 230
219 // Copy the translated command buffer back into the thread's command buffer area. 231 // Copy the translated command buffer back into the thread's command buffer area.
220 memory.WriteBlock(owner_process, requesting_thread.GetTLSAddress(), cmd_buf.data(), 232 memory.WriteBlock(owner_process, requesting_thread.GetTLSAddress(), cmd_buf.data(),
221 cmd_buf.size() * sizeof(u32)); 233 size * sizeof(u32));
222 234
223 return RESULT_SUCCESS; 235 return RESULT_SUCCESS;
224} 236}
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h
index 3e66e5542..4fba300dc 100644
--- a/src/core/hle/kernel/hle_ipc.h
+++ b/src/core/hle/kernel/hle_ipc.h
@@ -308,6 +308,7 @@ private:
308 u32 data_payload_offset{}; 308 u32 data_payload_offset{};
309 u32 handles_offset{}; 309 u32 handles_offset{};
310 u32 domain_offset{}; 310 u32 domain_offset{};
311 u32 data_size{};
311 u32_le command{}; 312 u32_le command{};
312 313
313 std::vector<std::shared_ptr<SessionRequestHandler>> domain_request_handlers; 314 std::vector<std::shared_ptr<SessionRequestHandler>> domain_request_handlers;