mirror of
https://github.com/ZDoom/Raze.git
synced 2024-12-04 01:51:25 +00:00
261af9e401
Made more efficient by basing the lookup on names, not strings and some additions for acting as a stand-in for Blood's resource manager.
53 lines
1 KiB
C++
53 lines
1 KiB
C++
#ifndef __FILE_ZIP_H
|
|
#define __FILE_ZIP_H
|
|
|
|
#include "resourcefile.h"
|
|
|
|
enum
|
|
{
|
|
LUMPFZIP_NEEDFILESTART = 128
|
|
};
|
|
|
|
//==========================================================================
|
|
//
|
|
// Zip Lump
|
|
//
|
|
//==========================================================================
|
|
|
|
struct FZipLump : public FResourceLump
|
|
{
|
|
uint16_t GPFlags;
|
|
uint8_t Method;
|
|
int CompressedSize;
|
|
int Position;
|
|
unsigned CRC32;
|
|
|
|
virtual FileReader *GetReader();
|
|
virtual int ValidateCache() override;
|
|
|
|
private:
|
|
void SetLumpAddress();
|
|
virtual int GetFileOffset();
|
|
FCompressedBuffer GetRawData();
|
|
};
|
|
|
|
|
|
//==========================================================================
|
|
//
|
|
// Zip file
|
|
//
|
|
//==========================================================================
|
|
|
|
class FZipFile : public FResourceFile
|
|
{
|
|
FZipLump *Lumps;
|
|
|
|
public:
|
|
FZipFile(const char * filename, FileReader &file);
|
|
virtual ~FZipFile();
|
|
bool Open(bool quiet);
|
|
virtual FResourceLump *GetLump(int no) { return ((unsigned)no < NumLumps)? &Lumps[no] : NULL; }
|
|
};
|
|
|
|
|
|
#endif
|