summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2022-12-17 16:21:30 +0100
committerGitHub <noreply@github.com>2022-12-17 16:21:30 +0100
commit4faea2bbf46bbfc7b69ce2c56cd2eb274be49d70 (patch)
tree331baa41f2a6d3e0d7647e85791e87084047967d /src/core
parentMerge pull request #9455 from Kelebek1/audio_signal (diff)
parenthle_ipc: Refactor ReadBuffer to set buffer size upon initialization (diff)
downloadyuzu-4faea2bbf46bbfc7b69ce2c56cd2eb274be49d70.tar
yuzu-4faea2bbf46bbfc7b69ce2c56cd2eb274be49d70.tar.gz
yuzu-4faea2bbf46bbfc7b69ce2c56cd2eb274be49d70.tar.bz2
yuzu-4faea2bbf46bbfc7b69ce2c56cd2eb274be49d70.tar.lz
yuzu-4faea2bbf46bbfc7b69ce2c56cd2eb274be49d70.tar.xz
yuzu-4faea2bbf46bbfc7b69ce2c56cd2eb274be49d70.tar.zst
yuzu-4faea2bbf46bbfc7b69ce2c56cd2eb274be49d70.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/kernel/hle_ipc.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp
index e6479c131..738b6d0f1 100644
--- a/src/core/hle/kernel/hle_ipc.cpp
+++ b/src/core/hle/kernel/hle_ipc.cpp
@@ -326,25 +326,23 @@ Result HLERequestContext::WriteToOutgoingCommandBuffer(KThread& requesting_threa
}
std::vector<u8> HLERequestContext::ReadBuffer(std::size_t buffer_index) const {
- std::vector<u8> buffer{};
const bool is_buffer_a{BufferDescriptorA().size() > buffer_index &&
BufferDescriptorA()[buffer_index].Size()};
-
if (is_buffer_a) {
ASSERT_OR_EXECUTE_MSG(
- BufferDescriptorA().size() > buffer_index, { return buffer; },
+ BufferDescriptorA().size() > buffer_index, { return {}; },
"BufferDescriptorA invalid buffer_index {}", buffer_index);
- buffer.resize(BufferDescriptorA()[buffer_index].Size());
+ std::vector<u8> buffer(BufferDescriptorA()[buffer_index].Size());
memory.ReadBlock(BufferDescriptorA()[buffer_index].Address(), buffer.data(), buffer.size());
+ return buffer;
} else {
ASSERT_OR_EXECUTE_MSG(
- BufferDescriptorX().size() > buffer_index, { return buffer; },
+ BufferDescriptorX().size() > buffer_index, { return {}; },
"BufferDescriptorX invalid buffer_index {}", buffer_index);
- buffer.resize(BufferDescriptorX()[buffer_index].Size());
+ std::vector<u8> buffer(BufferDescriptorX()[buffer_index].Size());
memory.ReadBlock(BufferDescriptorX()[buffer_index].Address(), buffer.data(), buffer.size());
+ return buffer;
}
-
- return buffer;
}
std::size_t HLERequestContext::WriteBuffer(const void* buffer, std::size_t size,