DiscIO/DirectoryBlob: Add a content source representing a run of padding bytes.

This commit is contained in:
Admiral H. Curtiss 2021-09-22 03:02:39 +02:00
parent f8611f7139
commit b1802f6daa
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
2 changed files with 14 additions and 1 deletions

View File

@ -132,6 +132,11 @@ bool DiscContent::Read(u64* offset, u64* length, u8** buffer) const
return false; return false;
} }
} }
else if (std::holds_alternative<ContentFixedByte>(m_content_source))
{
const ContentFixedByte& source = std::get<ContentFixedByte>(m_content_source);
std::fill_n(*buffer, bytes_to_read, source.m_byte);
}
else else
{ {
PanicAlertFmt("DirectoryBlob: Invalid content source in DiscContent."); PanicAlertFmt("DirectoryBlob: Invalid content source in DiscContent.");

View File

@ -71,10 +71,18 @@ struct ContentVolume
Partition m_partition; Partition m_partition;
}; };
// Content chunk representing a run of identical bytes.
// Useful for padding between chunks within a file.
struct ContentFixedByte
{
u8 m_byte;
};
using ContentSource = std::variant<ContentFile, // File using ContentSource = std::variant<ContentFile, // File
const u8*, // Memory const u8*, // Memory
ContentPartition, // Partition ContentPartition, // Partition
ContentVolume // Volume ContentVolume, // Volume
ContentFixedByte // Fixed value padding
>; >;
class DiscContent class DiscContent