mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-19 10:51:26 +00:00
627838f379
- fixed: The Dehacked parser could not parse flag values with the highest bit set because it used atoi to convert the string into a number. SVN r1624 (trunk)
117 lines
No EOL
2.4 KiB
C++
117 lines
No EOL
2.4 KiB
C++
|
|
|
|
#ifndef __RESFILE_H
|
|
#define __RESFILE_H
|
|
|
|
#include "files.h"
|
|
|
|
class FResourceFile;
|
|
|
|
struct FResourceLump
|
|
{
|
|
friend class FResourceFile;
|
|
|
|
int LumpSize;
|
|
char * FullName; // only valid for files loaded from a .zip file
|
|
char Name[9];
|
|
BYTE Flags;
|
|
SBYTE RefCount;
|
|
char * Cache;
|
|
FResourceFile * Owner;
|
|
int Namespace;
|
|
|
|
FResourceLump()
|
|
{
|
|
FullName = NULL;
|
|
Cache = NULL;
|
|
Owner = NULL;
|
|
Flags = 0;
|
|
RefCount = 0;
|
|
Namespace = 0; // ns_global
|
|
*Name = 0;
|
|
}
|
|
|
|
virtual ~FResourceLump();
|
|
virtual FileReader *GetReader();
|
|
virtual FileReader *NewReader();
|
|
virtual int GetFileOffset() { return -1; }
|
|
void LumpNameSetup(const char *iname);
|
|
void CheckEmbedded();
|
|
|
|
void *CacheLump();
|
|
int ReleaseCache();
|
|
|
|
protected:
|
|
virtual int FillCache() = 0;
|
|
|
|
};
|
|
|
|
class FResourceFile
|
|
{
|
|
public:
|
|
FileReader *Reader;
|
|
const char *Filename;
|
|
protected:
|
|
DWORD NumLumps;
|
|
|
|
FResourceFile(const char *filename, FileReader *r);
|
|
|
|
private:
|
|
DWORD FirstLump;
|
|
|
|
public:
|
|
static FResourceFile *OpenResourceFile(const char *filename, FileReader *file, bool quiet = false);
|
|
static FResourceFile *FResourceFile::OpenDirectory(const char *filename);
|
|
virtual ~FResourceFile();
|
|
FileReader *GetReader() const { return Reader; }
|
|
DWORD LumpCount() const { return NumLumps; }
|
|
DWORD GetFirstLump() const { return FirstLump; }
|
|
void SetFirstLump(DWORD f) { FirstLump = f; }
|
|
|
|
virtual void FindStrifeTeaserVoices ();
|
|
virtual bool Open(bool quiet) = 0;
|
|
virtual FResourceLump *GetLump(int no) = 0;
|
|
};
|
|
|
|
struct FUncompressedLump : public FResourceLump
|
|
{
|
|
int Position;
|
|
|
|
virtual FileReader *GetReader();
|
|
virtual int FillCache();
|
|
virtual int GetFileOffset() { return Position; }
|
|
|
|
};
|
|
|
|
|
|
// Base class for uncompressed resource files (WAD, GRP, PAK and single lumps)
|
|
class FUncompressedFile : public FResourceFile
|
|
{
|
|
protected:
|
|
FUncompressedLump * Lumps;
|
|
|
|
|
|
FUncompressedFile(const char *filename, FileReader *r);
|
|
virtual ~FUncompressedFile();
|
|
virtual FResourceLump *GetLump(int no) { return ((unsigned)no < NumLumps)? &Lumps[no] : NULL; }
|
|
|
|
public:
|
|
};
|
|
|
|
|
|
struct FExternalLump : public FResourceLump
|
|
{
|
|
const char *filename; // the actual file name. This is not necessarily the same as the lump name!
|
|
|
|
FExternalLump(const char *_filename, int filesize = -1);
|
|
~FExternalLump();
|
|
virtual int FillCache();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif |