summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2023-07-11 03:54:19 +0200
committerGitHub <noreply@github.com>2023-07-11 03:54:19 +0200
commitce7c418e0cc05d92c18ad69c7cb37fecfa71b037 (patch)
treeea1852111c1b3c3c340608ae518fc8711a4fcfe3 /src/core/hle/service
parentMerge pull request #11050 from SuperSamus/sdl-button-labels (diff)
parentFix ScratchBuffer moves (diff)
downloadyuzu-ce7c418e0cc05d92c18ad69c7cb37fecfa71b037.tar
yuzu-ce7c418e0cc05d92c18ad69c7cb37fecfa71b037.tar.gz
yuzu-ce7c418e0cc05d92c18ad69c7cb37fecfa71b037.tar.bz2
yuzu-ce7c418e0cc05d92c18ad69c7cb37fecfa71b037.tar.lz
yuzu-ce7c418e0cc05d92c18ad69c7cb37fecfa71b037.tar.xz
yuzu-ce7c418e0cc05d92c18ad69c7cb37fecfa71b037.tar.zst
yuzu-ce7c418e0cc05d92c18ad69c7cb37fecfa71b037.zip
Diffstat (limited to 'src/core/hle/service')
-rw-r--r--src/core/hle/service/hle_ipc.cpp32
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]);
}
}