DiscIO: Allow converting from formats other than ISO and GCZ

The constant DESIRED_BUFFER_SIZE was determined by multiplying the
old hardcoded value 32 with the default GCZ block size 16 KiB.
Not sure if it actually is the best value, but it seems fine.
This commit is contained in:
JosJuice
2020-04-04 20:56:20 +02:00
parent 0a71dda8a0
commit 8a9597e32e
10 changed files with 80 additions and 96 deletions

View File

@ -41,11 +41,16 @@ class BlobReader
{
public:
virtual ~BlobReader() {}
virtual BlobType GetBlobType() const = 0;
virtual u64 GetRawSize() const = 0;
virtual u64 GetDataSize() const = 0;
virtual bool IsDataSizeAccurate() const = 0;
// Returns 0 if the format does not use blocks
virtual u64 GetBlockSize() const { return 0; }
// NOT thread-safe - can't call this from multiple threads.
virtual bool Read(u64 offset, u64 size, u8* out_ptr) = 0;
template <typename T>
@ -160,10 +165,9 @@ std::unique_ptr<BlobReader> CreateBlobReader(const std::string& filename);
typedef bool (*CompressCB)(const std::string& text, float percent, void* arg);
bool CompressFileToBlob(const std::string& infile_path, const std::string& outfile_path,
u32 sub_type = 0, int sector_size = 16384, CompressCB callback = nullptr,
void* arg = nullptr);
bool DecompressBlobToFile(const std::string& infile_path, const std::string& outfile_path,
CompressCB callback = nullptr, void* arg = nullptr);
bool ConvertToGCZ(const std::string& infile_path, const std::string& outfile_path, u32 sub_type = 0,
int sector_size = 16384, CompressCB callback = nullptr, void* arg = nullptr);
bool ConvertToPlain(const std::string& infile_path, const std::string& outfile_path,
CompressCB callback = nullptr, void* arg = nullptr);
} // namespace DiscIO