2007-06-30 19:24:05 +03:00
|
|
|
#ifndef CLODHANDLER_H
|
|
|
|
#define CLODHANDLER_H
|
2008-06-12 09:45:51 +03:00
|
|
|
#include "../global.h"
|
2007-06-30 19:24:05 +03:00
|
|
|
#include <fstream>
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
2007-08-30 13:11:53 +03:00
|
|
|
#include "../nodrze.h"
|
2008-01-09 19:21:31 +02:00
|
|
|
|
2008-06-12 09:45:51 +03:00
|
|
|
struct SDL_Surface;
|
2008-01-09 19:21:31 +02:00
|
|
|
class CDefHandler;
|
|
|
|
class CDefEssential;
|
2008-06-16 13:51:14 +03:00
|
|
|
namespace boost
|
|
|
|
{class mutex;};
|
2007-06-30 19:24:05 +03:00
|
|
|
namespace NLoadHandlerHelp
|
|
|
|
{
|
|
|
|
const int dmHelp=0, dmNoExtractingMask=1;
|
|
|
|
//std::string P1,P2,CurDir;
|
|
|
|
const int fCHUNK = 50000;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Entry
|
|
|
|
{
|
|
|
|
unsigned char name[12], //filename
|
2008-03-21 02:03:31 +02:00
|
|
|
hlam_1[4], //???
|
|
|
|
hlam_2[4]; //probably type of file
|
2007-07-07 14:09:25 +03:00
|
|
|
std::string nameStr;
|
2007-06-30 19:24:05 +03:00
|
|
|
int offset, //from beginning
|
|
|
|
realSize, //size without compression
|
|
|
|
size; //and with
|
2008-02-03 07:10:33 +02:00
|
|
|
bool operator<(const std::string & comp) const
|
|
|
|
{
|
|
|
|
return nameStr<comp;
|
|
|
|
}
|
2007-07-07 14:09:25 +03:00
|
|
|
bool operator<(const Entry & comp) const
|
|
|
|
{
|
2007-07-17 23:51:49 +03:00
|
|
|
return nameStr<comp.nameStr;
|
2007-07-07 14:09:25 +03:00
|
|
|
}
|
|
|
|
Entry(std::string con): nameStr(con){};
|
2007-07-17 23:51:49 +03:00
|
|
|
//Entry(unsigned char ): nameStr(con){};
|
2007-07-07 14:09:25 +03:00
|
|
|
Entry(){};
|
2007-06-30 19:24:05 +03:00
|
|
|
};
|
2008-06-13 00:08:04 +03:00
|
|
|
class DLL_EXPORT CLodHandler
|
2007-06-30 19:24:05 +03:00
|
|
|
{
|
|
|
|
public:
|
2008-06-12 09:45:51 +03:00
|
|
|
FILE* FLOD;
|
2007-07-17 23:51:49 +03:00
|
|
|
nodrze<Entry> entries;
|
2007-06-30 19:24:05 +03:00
|
|
|
unsigned int totalFiles;
|
2008-06-16 13:51:14 +03:00
|
|
|
boost::mutex *mutex;
|
2007-06-30 19:24:05 +03:00
|
|
|
|
2008-06-13 00:08:04 +03:00
|
|
|
int readNormalNr (unsigned char* bufor, int bytCon, bool cyclic=false); //lod header reading helper
|
|
|
|
int infs(unsigned char * in, int size, int realSize, std::ofstream & out, int wBits=15); //zlib fast handler
|
|
|
|
int infs2(unsigned char * in, int size, int realSize, unsigned char*& out, int wBits=15); //zlib fast handler
|
|
|
|
unsigned char * giveFile(std::string defName, int * length=NULL); //returns pointer to the decompressed data - it must be deleted when no longer needed!
|
|
|
|
std::string getTextFile(std::string name); //extracts one file
|
|
|
|
void extract(std::string FName);
|
|
|
|
void extractFile(std::string FName, std::string name); //extracts a specific file
|
2008-06-14 13:20:18 +03:00
|
|
|
void init(std::string lodFile, std::string dirName);
|
2007-06-30 19:24:05 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif //CLODHANDLER_H
|