From b1802f6daa65e8617b26c4b47d94813242fb7945 Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Wed, 22 Sep 2021 03:02:39 +0200 Subject: [PATCH] DiscIO/DirectoryBlob: Add a content source representing a run of padding bytes. --- Source/Core/DiscIO/DirectoryBlob.cpp | 5 +++++ Source/Core/DiscIO/DirectoryBlob.h | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Source/Core/DiscIO/DirectoryBlob.cpp b/Source/Core/DiscIO/DirectoryBlob.cpp index c86b0396a2..356416b076 100644 --- a/Source/Core/DiscIO/DirectoryBlob.cpp +++ b/Source/Core/DiscIO/DirectoryBlob.cpp @@ -132,6 +132,11 @@ bool DiscContent::Read(u64* offset, u64* length, u8** buffer) const return false; } } + else if (std::holds_alternative(m_content_source)) + { + const ContentFixedByte& source = std::get(m_content_source); + std::fill_n(*buffer, bytes_to_read, source.m_byte); + } else { PanicAlertFmt("DirectoryBlob: Invalid content source in DiscContent."); diff --git a/Source/Core/DiscIO/DirectoryBlob.h b/Source/Core/DiscIO/DirectoryBlob.h index e942c14a94..5ab03137e5 100644 --- a/Source/Core/DiscIO/DirectoryBlob.h +++ b/Source/Core/DiscIO/DirectoryBlob.h @@ -71,10 +71,18 @@ struct ContentVolume 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; class DiscContent