make virtual buffer become an optional

This commit is contained in:
lizzie 2025-12-01 20:21:16 +00:00
parent 6f3628b8e0
commit 1d4b0c5432
3 changed files with 6 additions and 4 deletions

View File

@ -713,7 +713,7 @@ private:
HostMemory::HostMemory(size_t backing_size_, size_t virtual_size_) : backing_size(backing_size_), virtual_size(virtual_size_) {
#ifdef __OPENORBIS__
LOG_WARNING(HW_Memory, "Platform doesn't support fastmem");
fallback_buffer = std::make_unique<Common::VirtualBuffer<u8>>(backing_size);
fallback_buffer.emplace(backing_size);
backing_base = fallback_buffer->data();
virtual_base = nullptr;
#else

View File

@ -7,6 +7,7 @@
#pragma once
#include <memory>
#include <optional>
#include "common/common_funcs.h"
#include "common/common_types.h"
#include "common/virtual_buffer.h"

View File

@ -32,9 +32,10 @@ public:
VirtualBuffer(const VirtualBuffer&) = delete;
VirtualBuffer& operator=(const VirtualBuffer&) = delete;
VirtualBuffer(VirtualBuffer&& other) noexcept
: alloc_size{std::exchange(other.alloc_size, 0)}, base_ptr{std::exchange(other.base_ptr),
nullptr} {}
VirtualBuffer(VirtualBuffer&& other) noexcept {
alloc_size = std::exchange(other.alloc_size, 0);
base_ptr = std::exchange(other.base_ptr, nullptr);
}
VirtualBuffer& operator=(VirtualBuffer&& other) noexcept {
alloc_size = std::exchange(other.alloc_size, 0);