DiscIO/DirectoryBlob: Add ContentSource that stores data locally in std::vector.
This commit is contained in:
parent
9e5bc98496
commit
f5c132580c
|
@ -134,6 +134,12 @@ bool DiscContent::Read(u64* offset, u64* length, u8** buffer) const
|
|||
const ContentFixedByte& source = std::get<ContentFixedByte>(m_content_source);
|
||||
std::fill_n(*buffer, bytes_to_read, source.m_byte);
|
||||
}
|
||||
else if (std::holds_alternative<ContentByteVector>(m_content_source))
|
||||
{
|
||||
const ContentByteVector& source = std::get<ContentByteVector>(m_content_source);
|
||||
std::copy(source.m_bytes.begin() + offset_in_content,
|
||||
source.m_bytes.begin() + offset_in_content + bytes_to_read, *buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
PanicAlertFmt("DirectoryBlob: Invalid content source in DiscContent.");
|
||||
|
|
|
@ -80,11 +80,18 @@ struct ContentFixedByte
|
|||
u8 m_byte;
|
||||
};
|
||||
|
||||
// Content chunk representing an arbitrary byte sequence that's stored within the struct itself.
|
||||
struct ContentByteVector
|
||||
{
|
||||
std::vector<u8> m_bytes;
|
||||
};
|
||||
|
||||
using ContentSource = std::variant<ContentFile, // File
|
||||
const u8*, // Memory
|
||||
ContentPartition, // Partition
|
||||
ContentVolume, // Volume
|
||||
ContentFixedByte // Fixed value padding
|
||||
ContentFixedByte, // Fixed value padding
|
||||
ContentByteVector // Byte sequence
|
||||
>;
|
||||
|
||||
struct BuilderContentSource
|
||||
|
|
Loading…
Reference in New Issue