mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-15 17:40:05 +00:00
hle_ipc: Add Can(Read, Write)Buffer
Allows us to test whether a buffer can be read from or written to memory
This commit is contained in:
parent
45b13c3037
commit
008afa5d59
@ -338,6 +338,28 @@ std::size_t HLERequestContext::GetWriteBufferSize(std::size_t buffer_index) cons
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HLERequestContext::CanReadBuffer(std::size_t buffer_index) const {
|
||||||
|
const bool is_buffer_a{BufferDescriptorA().size() > buffer_index &&
|
||||||
|
BufferDescriptorA()[buffer_index].Size()};
|
||||||
|
|
||||||
|
if (is_buffer_a) {
|
||||||
|
return BufferDescriptorA().size() > buffer_index;
|
||||||
|
} else {
|
||||||
|
return BufferDescriptorX().size() > buffer_index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool HLERequestContext::CanWriteBuffer(std::size_t buffer_index) const {
|
||||||
|
const bool is_buffer_b{BufferDescriptorB().size() > buffer_index &&
|
||||||
|
BufferDescriptorB()[buffer_index].Size()};
|
||||||
|
|
||||||
|
if (is_buffer_b) {
|
||||||
|
return BufferDescriptorB().size() > buffer_index;
|
||||||
|
} else {
|
||||||
|
return BufferDescriptorC().size() > buffer_index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string HLERequestContext::Description() const {
|
std::string HLERequestContext::Description() const {
|
||||||
if (!command_header) {
|
if (!command_header) {
|
||||||
return "No command header available";
|
return "No command header available";
|
||||||
|
@ -207,6 +207,12 @@ public:
|
|||||||
/// Helper function to get the size of the output buffer
|
/// Helper function to get the size of the output buffer
|
||||||
std::size_t GetWriteBufferSize(std::size_t buffer_index = 0) const;
|
std::size_t GetWriteBufferSize(std::size_t buffer_index = 0) const;
|
||||||
|
|
||||||
|
/// Helper function to test whether the input buffer at buffer_index can be read
|
||||||
|
bool CanReadBuffer(std::size_t buffer_index = 0) const;
|
||||||
|
|
||||||
|
/// Helper function to test whether the output buffer at buffer_index can be written
|
||||||
|
bool CanWriteBuffer(std::size_t buffer_index = 0) const;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
std::shared_ptr<T> GetCopyObject(std::size_t index) {
|
std::shared_ptr<T> GetCopyObject(std::size_t index) {
|
||||||
return DynamicObjectCast<T>(copy_objects.at(index));
|
return DynamicObjectCast<T>(copy_objects.at(index));
|
||||||
|
Loading…
Reference in New Issue
Block a user