dolphin/Source/Core/DiscIO/Src/Blob.h
hrydgard 775dc8a9c0 Initial megacommit.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4 8ced0084-cf51-0410-be5f-012b33b47a6e
2008-07-12 17:40:22 +00:00

64 lines
1.4 KiB
C++

#ifndef _BLOB_H
#define _BLOB_H
/*
Code not big-endian safe.
BLOB
Blobs are Binary Large OBjects. For example, a typical DVD image.
Often, you may want to store these things in a highly compressed format, but still
allow random access.
Always read your BLOBs using an interface returned by CreateBlobReader(). It will
detect whether the file is a compressed blob, or just a big hunk of data, and
automatically do the right thing.
To create new BLOBs, use CompressFileToBlob.
Right now caching of decompressed chunks doesn't work, so it's a bit slow.
*/
#include "Common.h"
namespace DiscIO
{
class IBlobReader
{
public:
virtual ~IBlobReader() {}
virtual u64 GetRawSize() const = 0;
virtual u64 GetDataSize() const = 0;
virtual bool Read(u64 offset, u64 size, u8* out_ptr) = 0;
virtual bool IsValid() const = 0;
protected:
IBlobReader() {}
private:
IBlobReader(const IBlobReader& other) {}
};
IBlobReader* CreateBlobReader(const char* filename);
bool IsCompressedBlob(const char* filename);
typedef void (*CompressCB)(const char* text, float percent, void* arg);
bool CompressFileToBlob(const char* infile, const char* outfile, u32 sub_type = 0, int sector_size = 16384,
CompressCB callback = 0, void* arg = 0);
bool DecompressBlobToFile(const char* infile, const char* outfile,
CompressCB callback = 0, void* arg = 0);
}
#endif