summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorGravatar LC2021-01-28 10:52:44 -0500
committerGravatar GitHub2021-01-28 10:52:44 -0500
commit9f6290d2078424dce4206cd29a5709492c11c5f9 (patch)
tree488dc7decfcb459e5335fba8f3e9146b2f62bfa5 /src/core/hle/kernel
parentMerge pull request #5835 from Morph1984/cleanup-sixaxis-fusion (diff)
parentprepo: Fix BufferDescriptorX invalid buffer errors and add "New" variants of ... (diff)
downloadyuzu-9f6290d2078424dce4206cd29a5709492c11c5f9.tar.gz
yuzu-9f6290d2078424dce4206cd29a5709492c11c5f9.tar.xz
yuzu-9f6290d2078424dce4206cd29a5709492c11c5f9.zip
Merge pull request #5840 from Morph1984/prepo-fix
prepo: Fix BufferDescriptorX invalid buffer index errors and add New variants of SaveReport
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/hle_ipc.cpp22
-rw-r--r--src/core/hle/kernel/hle_ipc.h6
2 files changed, 28 insertions, 0 deletions
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp
index 83decf6cf..a419f9602 100644
--- a/src/core/hle/kernel/hle_ipc.cpp
+++ b/src/core/hle/kernel/hle_ipc.cpp
@@ -338,6 +338,28 @@ std::size_t HLERequestContext::GetWriteBufferSize(std::size_t buffer_index) cons
338 return 0; 338 return 0;
339} 339}
340 340
341bool HLERequestContext::CanReadBuffer(std::size_t buffer_index) const {
342 const bool is_buffer_a{BufferDescriptorA().size() > buffer_index &&
343 BufferDescriptorA()[buffer_index].Size()};
344
345 if (is_buffer_a) {
346 return BufferDescriptorA().size() > buffer_index;
347 } else {
348 return BufferDescriptorX().size() > buffer_index;
349 }
350}
351
352bool HLERequestContext::CanWriteBuffer(std::size_t buffer_index) const {
353 const bool is_buffer_b{BufferDescriptorB().size() > buffer_index &&
354 BufferDescriptorB()[buffer_index].Size()};
355
356 if (is_buffer_b) {
357 return BufferDescriptorB().size() > buffer_index;
358 } else {
359 return BufferDescriptorC().size() > buffer_index;
360 }
361}
362
341std::string HLERequestContext::Description() const { 363std::string HLERequestContext::Description() const {
342 if (!command_header) { 364 if (!command_header) {
343 return "No command header available"; 365 return "No command header available";
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h
index b112e1ebd..698f607e6 100644
--- a/src/core/hle/kernel/hle_ipc.h
+++ b/src/core/hle/kernel/hle_ipc.h
@@ -207,6 +207,12 @@ public:
207 /// Helper function to get the size of the output buffer 207 /// Helper function to get the size of the output buffer
208 std::size_t GetWriteBufferSize(std::size_t buffer_index = 0) const; 208 std::size_t GetWriteBufferSize(std::size_t buffer_index = 0) const;
209 209
210 /// Helper function to test whether the input buffer at buffer_index can be read
211 bool CanReadBuffer(std::size_t buffer_index = 0) const;
212
213 /// Helper function to test whether the output buffer at buffer_index can be written
214 bool CanWriteBuffer(std::size_t buffer_index = 0) const;
215
210 template <typename T> 216 template <typename T>
211 std::shared_ptr<T> GetCopyObject(std::size_t index) { 217 std::shared_ptr<T> GetCopyObject(std::size_t index) {
212 return DynamicObjectCast<T>(copy_objects.at(index)); 218 return DynamicObjectCast<T>(copy_objects.at(index));