summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/hle_ipc.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-05-11 21:27:43 +0200
committerbunnei <bunneidev@gmail.com>2021-05-11 21:27:43 +0200
commit12d569e483834c74613a744abee7f277cc3d4e16 (patch)
tree663ca7c22302b96d2984d273ec487b1cf0e8db65 /src/core/hle/kernel/hle_ipc.cpp
parentWORKAROUND: temp. disable session resource limits while we work out issues (diff)
downloadyuzu-12d569e483834c74613a744abee7f277cc3d4e16.tar
yuzu-12d569e483834c74613a744abee7f277cc3d4e16.tar.gz
yuzu-12d569e483834c74613a744abee7f277cc3d4e16.tar.bz2
yuzu-12d569e483834c74613a744abee7f277cc3d4e16.tar.lz
yuzu-12d569e483834c74613a744abee7f277cc3d4e16.tar.xz
yuzu-12d569e483834c74613a744abee7f277cc3d4e16.tar.zst
yuzu-12d569e483834c74613a744abee7f277cc3d4e16.zip
Diffstat (limited to 'src/core/hle/kernel/hle_ipc.cpp')
-rw-r--r--src/core/hle/kernel/hle_ipc.cpp14
1 files changed, 13 insertions, 1 deletions
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
auto& owner_process = *requesting_thread.GetOwnerProcess();
auto& handle_table = owner_process.GetHandleTable();
+ // The data_size already includes the payload header, the padding and the domain header.
+ std::size_t size{};
+
+ if (IsTipc()) {
+ size = cmd_buf.size();
+ } else {
+ size = data_payload_offset + data_size - sizeof(IPC::DataPayloadHeader) / sizeof(u32) - 4;
+ if (Session()->IsDomain()) {
+ size -= sizeof(IPC::DomainMessageHeader) / sizeof(u32);
+ }
+ }
+
for (auto& object : copy_objects) {
Handle handle{};
if (object) {
@@ -218,7 +230,7 @@ ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(KThread& requesting_t
// Copy the translated command buffer back into the thread's command buffer area.
memory.WriteBlock(owner_process, requesting_thread.GetTLSAddress(), cmd_buf.data(),
- cmd_buf.size() * sizeof(u32));
+ size * sizeof(u32));
return RESULT_SUCCESS;
}