summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2021-05-08 02:50:47 -0700
committerGravatar bunnei2021-05-10 15:05:10 -0700
commited25191ee634c3cd0df11b25407809c2ba4fe422 (patch)
tree45811424eed998ac573477cf16c92d43d05c7819 /src
parenthle: ipc_helpers: Update IPC response generation for TIPC. (diff)
downloadyuzu-ed25191ee634c3cd0df11b25407809c2ba4fe422.tar.gz
yuzu-ed25191ee634c3cd0df11b25407809c2ba4fe422.tar.xz
yuzu-ed25191ee634c3cd0df11b25407809c2ba4fe422.zip
hle: kernel: Further cleanup and add TIPC helpers.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/kernel/hle_ipc.cpp2
-rw-r--r--src/core/hle/kernel/hle_ipc.h14
2 files changed, 12 insertions, 4 deletions
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp
index 93907f75e..d6929d2c0 100644
--- a/src/core/hle/kernel/hle_ipc.cpp
+++ b/src/core/hle/kernel/hle_ipc.cpp
@@ -99,7 +99,7 @@ void HLERequestContext::ParseCommandBuffer(const KHandleTable& handle_table, u32
99 buffer_w_desciptors.push_back(rp.PopRaw<IPC::BufferDescriptorABW>()); 99 buffer_w_desciptors.push_back(rp.PopRaw<IPC::BufferDescriptorABW>());
100 } 100 }
101 101
102 buffer_c_offset = rp.GetCurrentOffset() + command_header->data_size; 102 const auto buffer_c_offset = rp.GetCurrentOffset() + command_header->data_size;
103 103
104 // Padding to align to 16 bytes 104 // Padding to align to 16 bytes
105 rp.AlignWithPadding(); 105 rp.AlignWithPadding();
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h
index 7cdde2294..07360629e 100644
--- a/src/core/hle/kernel/hle_ipc.h
+++ b/src/core/hle/kernel/hle_ipc.h
@@ -128,10 +128,19 @@ public:
128 /// Writes data from this context back to the requesting process/thread. 128 /// Writes data from this context back to the requesting process/thread.
129 ResultCode WriteToOutgoingCommandBuffer(KThread& requesting_thread); 129 ResultCode WriteToOutgoingCommandBuffer(KThread& requesting_thread);
130 130
131 u32_le GetCommand() const { 131 u32_le GetHipcCommand() const {
132 return command; 132 return command;
133 } 133 }
134 134
135 u32_le GetTipcCommand() const {
136 return static_cast<u32_le>(command_header->type.Value()) -
137 static_cast<u32_le>(IPC::CommandType::TIPC_CommandRegion);
138 }
139
140 u32_le GetCommand() const {
141 return command_header->IsTipc() ? GetTipcCommand() : GetHipcCommand();
142 }
143
135 bool IsTipc() const { 144 bool IsTipc() const {
136 return command_header->IsTipc(); 145 return command_header->IsTipc();
137 } 146 }
@@ -140,7 +149,7 @@ public:
140 return command_header->type; 149 return command_header->type;
141 } 150 }
142 151
143 unsigned GetDataPayloadOffset() const { 152 u32 GetDataPayloadOffset() const {
144 return data_payload_offset; 153 return data_payload_offset;
145 } 154 }
146 155
@@ -296,7 +305,6 @@ private:
296 std::vector<IPC::BufferDescriptorC> buffer_c_desciptors; 305 std::vector<IPC::BufferDescriptorC> buffer_c_desciptors;
297 306
298 u32 data_payload_offset{}; 307 u32 data_payload_offset{};
299 u32 buffer_c_offset{};
300 u32 handles_offset{}; 308 u32 handles_offset{};
301 u32 domain_offset{}; 309 u32 domain_offset{};
302 u32_le command{}; 310 u32_le command{};