| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <memory> |
| 7 |
#include <string> |
| 8 |
|
| 9 |
#include "Common/CommonTypes.h" |
| 10 |
#include "Common/DirectIOFile.h" |
| 11 |
#include "DiscIO/Blob.h" |
| 12 |
|
| 13 |
namespace DiscIO |
| 14 |
{ |
| 15 |
class PlainFileReader final : public BlobReader |
| 16 |
{ |
| 17 |
public: |
| 18 |
static std::unique_ptr<PlainFileReader> Create(File::DirectIOFile file); |
| 19 |
|
| 20 |
BlobType GetBlobType() const override { return BlobType::PLAIN; } |
| 21 |
std::unique_ptr<BlobReader> CopyReader() const override; |
| 22 |
|
| 23 |
u64 GetRawSize() const override { return m_size; } |
| 24 |
u64 GetDataSize() const override { return m_size; } |
| 25 |
DataSizeType GetDataSizeType() const override { return DataSizeType::Accurate; } |
| 26 |
|
| 27 |
u64 GetBlockSize() const override { return 0; } |
| 28 |
bool HasFastRandomAccessInBlock() const override { return true; } |
| 29 |
std::string GetCompressionMethod() const override { return {}; } |
| 30 |
std::optional<int> GetCompressionLevel() const override { return std::nullopt; } |
| 31 |
|
| 32 |
bool Read(u64 offset, u64 nbytes, u8* out_ptr) override; |
| 33 |
|
| 34 |
private: |
| 35 |
PlainFileReader(File::DirectIOFile file); |
| 36 |
|
| 37 |
File::DirectIOFile m_file; |
| 38 |
u64 m_size; |
| 39 |
}; |
| 40 |
|
| 41 |
} |