diff options
author | Kelebek1 <eeeedddccc@hotmail.co.uk> | 2023-05-29 01:35:51 +0200 |
---|---|---|
committer | Kelebek1 <eeeedddccc@hotmail.co.uk> | 2023-07-03 00:09:48 +0200 |
commit | 6f7cb69c94bef0795f054d881e061745f69d1eda (patch) | |
tree | cc0bec2fed92a5645886dde773add00c84d8b9f4 /src/core/hle/service/hle_ipc.cpp | |
parent | Merge pull request #10998 from Morph1984/qt-stop-messing-with-me (diff) | |
download | yuzu-6f7cb69c94bef0795f054d881e061745f69d1eda.tar yuzu-6f7cb69c94bef0795f054d881e061745f69d1eda.tar.gz yuzu-6f7cb69c94bef0795f054d881e061745f69d1eda.tar.bz2 yuzu-6f7cb69c94bef0795f054d881e061745f69d1eda.tar.lz yuzu-6f7cb69c94bef0795f054d881e061745f69d1eda.tar.xz yuzu-6f7cb69c94bef0795f054d881e061745f69d1eda.tar.zst yuzu-6f7cb69c94bef0795f054d881e061745f69d1eda.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/hle_ipc.cpp | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/src/core/hle/service/hle_ipc.cpp b/src/core/hle/service/hle_ipc.cpp index 2290df705..f6a1e54f2 100644 --- a/src/core/hle/service/hle_ipc.cpp +++ b/src/core/hle/service/hle_ipc.cpp @@ -329,8 +329,22 @@ std::vector<u8> HLERequestContext::ReadBufferCopy(std::size_t buffer_index) cons } std::span<const u8> HLERequestContext::ReadBuffer(std::size_t buffer_index) const { - static thread_local std::array<Common::ScratchBuffer<u8>, 2> read_buffer_a; - static thread_local std::array<Common::ScratchBuffer<u8>, 2> read_buffer_x; + static thread_local std::array read_buffer_a{ + Core::Memory::CpuGuestMemory<u8, Core::Memory::GuestMemoryFlags::SafeRead>(memory, 0, 0), + Core::Memory::CpuGuestMemory<u8, Core::Memory::GuestMemoryFlags::SafeRead>(memory, 0, 0), + }; + static thread_local std::array read_buffer_data_a{ + Common::ScratchBuffer<u8>(), + Common::ScratchBuffer<u8>(), + }; + static thread_local std::array read_buffer_x{ + Core::Memory::CpuGuestMemory<u8, Core::Memory::GuestMemoryFlags::SafeRead>(memory, 0, 0), + Core::Memory::CpuGuestMemory<u8, Core::Memory::GuestMemoryFlags::SafeRead>(memory, 0, 0), + }; + static thread_local std::array read_buffer_data_x{ + Common::ScratchBuffer<u8>(), + Common::ScratchBuffer<u8>(), + }; const bool is_buffer_a{BufferDescriptorA().size() > buffer_index && BufferDescriptorA()[buffer_index].Size()}; @@ -339,19 +353,17 @@ std::span<const u8> HLERequestContext::ReadBuffer(std::size_t buffer_index) cons BufferDescriptorA().size() > buffer_index, { return {}; }, "BufferDescriptorA invalid buffer_index {}", buffer_index); auto& read_buffer = read_buffer_a[buffer_index]; - read_buffer.resize_destructive(BufferDescriptorA()[buffer_index].Size()); - memory.ReadBlock(BufferDescriptorA()[buffer_index].Address(), read_buffer.data(), - read_buffer.size()); - return read_buffer; + return read_buffer.Read(BufferDescriptorA()[buffer_index].Address(), + BufferDescriptorA()[buffer_index].Size(), + &read_buffer_data_a[buffer_index]); } else { ASSERT_OR_EXECUTE_MSG( BufferDescriptorX().size() > buffer_index, { return {}; }, "BufferDescriptorX invalid buffer_index {}", buffer_index); auto& read_buffer = read_buffer_x[buffer_index]; - read_buffer.resize_destructive(BufferDescriptorX()[buffer_index].Size()); - memory.ReadBlock(BufferDescriptorX()[buffer_index].Address(), read_buffer.data(), - read_buffer.size()); - return read_buffer; + return read_buffer.Read(BufferDescriptorX()[buffer_index].Address(), + BufferDescriptorX()[buffer_index].Size(), + &read_buffer_data_x[buffer_index]); } } |