dolphin/Source/Core/DiscIO/ScrubbedBlob.h
Pierre Bourdon e149ad4f0a
treewide: convert GPLv2+ license info to SPDX tags
SPDX standardizes how source code conveys its copyright and licensing
information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX
tags are adopted in many large projects, including things like the Linux
kernel.
2021-07-05 04:35:56 +02:00

47 lines
1.3 KiB
C++

// Copyright 2020 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <memory>
#include <string>
#include "DiscIO/Blob.h"
#include "DiscIO/DiscScrubber.h"
namespace DiscIO
{
// This class wraps another BlobReader and zeroes out data that has been
// identified by DiscScrubber as unused.
class ScrubbedBlob : public BlobReader
{
public:
static std::unique_ptr<ScrubbedBlob> Create(const std::string& path);
BlobType GetBlobType() const override { return m_blob_reader->GetBlobType(); }
u64 GetRawSize() const override { return m_blob_reader->GetRawSize(); }
u64 GetDataSize() const override { return m_blob_reader->GetDataSize(); }
bool IsDataSizeAccurate() const override { return m_blob_reader->IsDataSizeAccurate(); }
u64 GetBlockSize() const override { return m_blob_reader->GetBlockSize(); }
bool HasFastRandomAccessInBlock() const override
{
return m_blob_reader->HasFastRandomAccessInBlock();
}
std::string GetCompressionMethod() const override
{
return m_blob_reader->GetCompressionMethod();
}
bool Read(u64 offset, u64 size, u8* out_ptr) override;
private:
ScrubbedBlob(std::unique_ptr<BlobReader> blob_reader, DiscScrubber scrubber);
std::unique_ptr<BlobReader> m_blob_reader;
DiscScrubber m_scrubber;
};
} // namespace DiscIO