2016-09-20 21:13:12 +00:00
|
|
|
#ifndef __FILE_ZIP_H
|
|
|
|
#define __FILE_ZIP_H
|
|
|
|
|
|
|
|
#include "resourcefile.h"
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
LUMPFZIP_NEEDFILESTART = 128
|
|
|
|
};
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// Zip Lump
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
struct FZipLump : public FResourceLump
|
|
|
|
{
|
2017-03-08 17:44:37 +00:00
|
|
|
uint16_t GPFlags;
|
|
|
|
uint8_t Method;
|
2016-09-20 21:13:12 +00:00
|
|
|
int CompressedSize;
|
|
|
|
int Position;
|
2016-09-21 15:37:56 +00:00
|
|
|
unsigned CRC32;
|
2016-09-20 21:13:12 +00:00
|
|
|
|
2018-03-11 17:32:00 +00:00
|
|
|
virtual FileReader *GetReader();
|
2016-09-20 21:13:12 +00:00
|
|
|
virtual int FillCache();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void SetLumpAddress();
|
|
|
|
virtual int GetFileOffset();
|
2016-09-21 23:28:05 +00:00
|
|
|
FCompressedBuffer GetRawData();
|
2016-09-20 21:13:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// Zip file
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
class FZipFile : public FResourceFile
|
|
|
|
{
|
|
|
|
FZipLump *Lumps;
|
|
|
|
|
|
|
|
public:
|
2018-03-11 17:32:00 +00:00
|
|
|
FZipFile(const char * filename, FileReader &file);
|
2016-09-20 21:13:12 +00:00
|
|
|
virtual ~FZipFile();
|
|
|
|
bool Open(bool quiet);
|
|
|
|
virtual FResourceLump *GetLump(int no) { return ((unsigned)no < NumLumps)? &Lumps[no] : NULL; }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|