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