29 #include "../idlib/precompiled.h"
33 idCVar idDemoFile::com_compressDemos(
"com_compressDemos",
"1",
CVAR_SYSTEM |
CVAR_INTEGER |
CVAR_ARCHIVE,
"Compression scheme for demo files\n0: None (Fast, large files)\n1: LZW (Fast to compress, Fast to decompress, medium/small files)\n2: LZSS (Slow to compress, Fast to decompress, small files)\n3: Huffman (Fast to compress, Slow to decompress, medium files)\nSee also: The 'CompressDemo' command" );
36 #define DEMO_MAGIC GAME_NAME " RDEMO"
83 char magicBuffer[magicLen];
109 f->
Read(magicBuffer, magicLen);
110 if ( memcmp(magicBuffer,
DEMO_MAGIC, magicLen) == 0 ) {
143 if (
fLog && p && *p ) {
216 const char *text =
va(
"%s > Reading hash string\n",
logStr.
c_str() );
250 const char *text =
va(
"%s > Writing hash string\n",
logStr.
c_str() );
281 for ( i = 0; i <
c; i++ ) {
284 dict.
Set( key, val );
298 for ( i = 0; i <
c; i++ ) {
311 if ( read == 0 && len >= 4 ) {
virtual idFile * OpenFileRead(const char *relativePath, bool allowCopyFiles=true, const char *gamedir=NULL)=0
static idCVar com_compressDemos
virtual int Read(void *outData, int outLength)=0
virtual int Write(const void *inData, int inLength)=0
virtual int virtual int ReadInt(int &value)
virtual void Rewind(void)
static idCompressor * AllocLZW(void)
const idStr & GetKey(void) const
idFileSystem * fileSystem
bool OpenForWriting(const char *fileName)
GLuint GLuint GLsizei GLenum type
void Set(const char *key, const char *value)
virtual void Init(idFile *f, bool compress, int wordLength)=0
static idCVar com_preloadDemos
static idCVar com_logDemos
virtual int WriteInt(const int value)
virtual int WriteString(const char *string)
GLsizei GLsizei GLenum GLenum const GLvoid * data
int GetInteger(void) const
virtual idFile * OpenFileWrite(const char *relativePath, const char *basePath="fs_savepath")=0
virtual int Read(void *buffer, int len)
const idStr & GetValue(void) const
void DeleteContents(bool clear)
virtual void FinishCompress(void)=0
static idCompressor * AllocHuffman(void)
int Append(const type &obj)
static idCompressor * AllocNoCompression(void)
int Write(const void *buffer, int len)
bool OpenForReading(const char *fileName)
void WriteDict(const idDict &dict)
virtual int Write(const void *buffer, int len)
void SetLog(bool b, const char *p)
idList< idStr * > demoStrings
idCompressor * compressor
static idCompressor * AllocLZSS(void)
const char * c_str(void) const
const idKeyValue * GetKeyVal(int index) const
const char * ReadHashString()
void * Mem_Alloc(const int size)
virtual int ReadString(idStr &string)
char * va(const char *fmt,...)
virtual void CloseFile(idFile *f)=0
virtual void Error(const char *fmt,...) id_attribute((format(printf
int GetNumKeyVals(void) const
int Read(void *buffer, int len)
void ReadDict(idDict &dict)
void WriteHashString(const char *str)
static idCompressor * AllocCompressor(int type)