diff options
Diffstat (limited to 'src/core/hle/kernel')
| -rw-r--r-- | src/core/hle/kernel/hle_ipc.cpp | 30 | ||||
| -rw-r--r-- | src/core/hle/kernel/hle_ipc.h | 8 |
2 files changed, 3 insertions, 35 deletions
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp index 494151eef..738b6d0f1 100644 --- a/src/core/hle/kernel/hle_ipc.cpp +++ b/src/core/hle/kernel/hle_ipc.cpp | |||
| @@ -11,7 +11,6 @@ | |||
| 11 | #include "common/common_funcs.h" | 11 | #include "common/common_funcs.h" |
| 12 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
| 13 | #include "common/logging/log.h" | 13 | #include "common/logging/log.h" |
| 14 | #include "common/scratch_buffer.h" | ||
| 15 | #include "core/hle/ipc_helpers.h" | 14 | #include "core/hle/ipc_helpers.h" |
| 16 | #include "core/hle/kernel/hle_ipc.h" | 15 | #include "core/hle/kernel/hle_ipc.h" |
| 17 | #include "core/hle/kernel/k_auto_object.h" | 16 | #include "core/hle/kernel/k_auto_object.h" |
| @@ -326,7 +325,7 @@ Result HLERequestContext::WriteToOutgoingCommandBuffer(KThread& requesting_threa | |||
| 326 | return ResultSuccess; | 325 | return ResultSuccess; |
| 327 | } | 326 | } |
| 328 | 327 | ||
| 329 | std::vector<u8> HLERequestContext::ReadBufferCopy(std::size_t buffer_index) const { | 328 | std::vector<u8> HLERequestContext::ReadBuffer(std::size_t buffer_index) const { |
| 330 | const bool is_buffer_a{BufferDescriptorA().size() > buffer_index && | 329 | const bool is_buffer_a{BufferDescriptorA().size() > buffer_index && |
| 331 | BufferDescriptorA()[buffer_index].Size()}; | 330 | BufferDescriptorA()[buffer_index].Size()}; |
| 332 | if (is_buffer_a) { | 331 | if (is_buffer_a) { |
| @@ -346,33 +345,6 @@ std::vector<u8> HLERequestContext::ReadBufferCopy(std::size_t buffer_index) cons | |||
| 346 | } | 345 | } |
| 347 | } | 346 | } |
| 348 | 347 | ||
| 349 | std::span<const u8> HLERequestContext::ReadBuffer(std::size_t buffer_index) const { | ||
| 350 | static thread_local std::array<Common::ScratchBuffer<u8>, 2> read_buffer_a; | ||
| 351 | static thread_local std::array<Common::ScratchBuffer<u8>, 2> read_buffer_x; | ||
| 352 | |||
| 353 | const bool is_buffer_a{BufferDescriptorA().size() > buffer_index && | ||
| 354 | BufferDescriptorA()[buffer_index].Size()}; | ||
| 355 | if (is_buffer_a) { | ||
| 356 | ASSERT_OR_EXECUTE_MSG( | ||
| 357 | BufferDescriptorA().size() > buffer_index, { return {}; }, | ||
| 358 | "BufferDescriptorA invalid buffer_index {}", buffer_index); | ||
| 359 | auto& read_buffer = read_buffer_a[buffer_index]; | ||
| 360 | read_buffer.resize_destructive(BufferDescriptorA()[buffer_index].Size()); | ||
| 361 | memory.ReadBlock(BufferDescriptorA()[buffer_index].Address(), read_buffer.data(), | ||
| 362 | read_buffer.size()); | ||
| 363 | return read_buffer; | ||
| 364 | } else { | ||
| 365 | ASSERT_OR_EXECUTE_MSG( | ||
| 366 | BufferDescriptorX().size() > buffer_index, { return {}; }, | ||
| 367 | "BufferDescriptorX invalid buffer_index {}", buffer_index); | ||
| 368 | auto& read_buffer = read_buffer_x[buffer_index]; | ||
| 369 | read_buffer.resize_destructive(BufferDescriptorX()[buffer_index].Size()); | ||
| 370 | memory.ReadBlock(BufferDescriptorX()[buffer_index].Address(), read_buffer.data(), | ||
| 371 | read_buffer.size()); | ||
| 372 | return read_buffer; | ||
| 373 | } | ||
| 374 | } | ||
| 375 | |||
| 376 | std::size_t HLERequestContext::WriteBuffer(const void* buffer, std::size_t size, | 348 | std::size_t HLERequestContext::WriteBuffer(const void* buffer, std::size_t size, |
| 377 | std::size_t buffer_index) const { | 349 | std::size_t buffer_index) const { |
| 378 | if (size == 0) { | 350 | if (size == 0) { |
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h index 5bf4f171b..e252b5f4b 100644 --- a/src/core/hle/kernel/hle_ipc.h +++ b/src/core/hle/kernel/hle_ipc.h | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | #include <functional> | 7 | #include <functional> |
| 8 | #include <memory> | 8 | #include <memory> |
| 9 | #include <optional> | 9 | #include <optional> |
| 10 | #include <span> | ||
| 11 | #include <string> | 10 | #include <string> |
| 12 | #include <type_traits> | 11 | #include <type_traits> |
| 13 | #include <vector> | 12 | #include <vector> |
| @@ -271,11 +270,8 @@ public: | |||
| 271 | return domain_message_header.has_value(); | 270 | return domain_message_header.has_value(); |
| 272 | } | 271 | } |
| 273 | 272 | ||
| 274 | /// Helper function to get a span of a buffer using the appropriate buffer descriptor | 273 | /// Helper function to read a buffer using the appropriate buffer descriptor |
| 275 | [[nodiscard]] std::span<const u8> ReadBuffer(std::size_t buffer_index = 0) const; | 274 | [[nodiscard]] std::vector<u8> ReadBuffer(std::size_t buffer_index = 0) const; |
| 276 | |||
| 277 | /// Helper function to read a copy of a buffer using the appropriate buffer descriptor | ||
| 278 | [[nodiscard]] std::vector<u8> ReadBufferCopy(std::size_t buffer_index = 0) const; | ||
| 279 | 275 | ||
| 280 | /// Helper function to write a buffer using the appropriate buffer descriptor | 276 | /// Helper function to write a buffer using the appropriate buffer descriptor |
| 281 | std::size_t WriteBuffer(const void* buffer, std::size_t size, | 277 | std::size_t WriteBuffer(const void* buffer, std::size_t size, |