summaryrefslogtreecommitdiffstats
path: root/src/core/hle
diff options
context:
space:
mode:
authorMorph <39850852+Morph1984@users.noreply.github.com>2023-07-01 03:50:44 +0200
committerMorph <39850852+Morph1984@users.noreply.github.com>2023-07-01 04:05:28 +0200
commit1a46823ec59b0ad4556e494c0488d5a8160aa19b (patch)
treed35b2c892a54b2a6d4645fe3de3a938c45e17766 /src/core/hle
parentmaxwell_dma: Specify dst_operand.pitch instead of a temp var (diff)
downloadyuzu-1a46823ec59b0ad4556e494c0488d5a8160aa19b.tar
yuzu-1a46823ec59b0ad4556e494c0488d5a8160aa19b.tar.gz
yuzu-1a46823ec59b0ad4556e494c0488d5a8160aa19b.tar.bz2
yuzu-1a46823ec59b0ad4556e494c0488d5a8160aa19b.tar.lz
yuzu-1a46823ec59b0ad4556e494c0488d5a8160aa19b.tar.xz
yuzu-1a46823ec59b0ad4556e494c0488d5a8160aa19b.tar.zst
yuzu-1a46823ec59b0ad4556e494c0488d5a8160aa19b.zip
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/service/nvnflinger/parcel.h24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/core/hle/service/nvnflinger/parcel.h b/src/core/hle/service/nvnflinger/parcel.h
index 23ba315a0..e2c9bbd50 100644
--- a/src/core/hle/service/nvnflinger/parcel.h
+++ b/src/core/hle/service/nvnflinger/parcel.h
@@ -6,6 +6,7 @@
#include <memory>
#include <span>
#include <vector>
+
#include <boost/container/small_vector.hpp>
#include "common/alignment.h"
@@ -148,9 +149,9 @@ public:
this->WriteImpl(0U, m_object_buffer);
}
- std::vector<u8> Serialize() const {
- std::vector<u8> output_buffer(sizeof(ParcelHeader) + m_data_buffer.size() +
- m_object_buffer.size());
+ std::span<u8> Serialize() {
+ m_output_buffer.resize(sizeof(ParcelHeader) + m_data_buffer.size() +
+ m_object_buffer.size());
ParcelHeader header{};
header.data_size = static_cast<u32>(m_data_buffer.size());
@@ -158,17 +159,17 @@ public:
header.objects_size = static_cast<u32>(m_object_buffer.size());
header.objects_offset = header.data_offset + header.data_size;
- std::memcpy(output_buffer.data(), &header, sizeof(header));
- std::ranges::copy(m_data_buffer, output_buffer.data() + header.data_offset);
- std::ranges::copy(m_object_buffer, output_buffer.data() + header.objects_offset);
+ std::memcpy(m_output_buffer.data(), &header, sizeof(ParcelHeader));
+ std::ranges::copy(m_data_buffer, m_output_buffer.data() + header.data_offset);
+ std::ranges::copy(m_object_buffer, m_output_buffer.data() + header.objects_offset);
- return output_buffer;
+ return m_output_buffer;
}
private:
- template <typename T>
+ template <typename T, size_t BufferSize>
requires(std::is_trivially_copyable_v<T>)
- void WriteImpl(const T& val, boost::container::small_vector<u8, 0x200>& buffer) {
+ void WriteImpl(const T& val, boost::container::small_vector<u8, BufferSize>& buffer) {
const size_t aligned_size = Common::AlignUp(sizeof(T), 4);
const size_t old_size = buffer.size();
buffer.resize(old_size + aligned_size);
@@ -177,8 +178,9 @@ private:
}
private:
- boost::container::small_vector<u8, 0x200> m_data_buffer;
- boost::container::small_vector<u8, 0x200> m_object_buffer;
+ boost::container::small_vector<u8, 0x1B0> m_data_buffer;
+ boost::container::small_vector<u8, 0x40> m_object_buffer;
+ boost::container::small_vector<u8, 0x200> m_output_buffer;
};
} // namespace Service::android