summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorAdmiral H. Curtiss <pikachu025@gmail.com>2022-06-09 00:17:20 +0200
committerAdmiral H. Curtiss <pikachu025@gmail.com>2022-07-19 00:55:03 +0200
commitf5c132580ced295a5e795be8cf4c65de7d4624a3 (patch)
tree9fc1c3bebe22f34e333bd46912ea8f081a97bfdc /Source/Core
parent9e5bc98496ef59bd2e30e7157b1d33a363ac538f (diff)
DiscIO/DirectoryBlob: Add ContentSource that stores data locally in std::vector.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/DiscIO/DirectoryBlob.cpp6
-rw-r--r--Source/Core/DiscIO/DirectoryBlob.h9
2 files changed, 14 insertions, 1 deletions
diff --git a/Source/Core/DiscIO/DirectoryBlob.cpp b/Source/Core/DiscIO/DirectoryBlob.cpp
index 86de55595a..c8facd37de 100644
--- a/Source/Core/DiscIO/DirectoryBlob.cpp
+++ b/Source/Core/DiscIO/DirectoryBlob.cpp
@@ -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.");
diff --git a/Source/Core/DiscIO/DirectoryBlob.h b/Source/Core/DiscIO/DirectoryBlob.h
index 3e8c4d9292..31e3650b08 100644
--- a/Source/Core/DiscIO/DirectoryBlob.h
+++ b/Source/Core/DiscIO/DirectoryBlob.h
@@ -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