1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00
vcmi/CLodHandler.h
Michał W. Urbańczyk d3c8ef7809 Prawie działający CPCXConv.
Ale za to ma ładny, zgrabny interfejsik.
2007-07-01 12:54:59 +00:00

57 lines
1.4 KiB
C++

#ifndef CLODHANDLER_H
#define CLODHANDLER_H
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include "zlib.h"
#include "CDefHandler.h"
enum Epcxformat {PCX8B, PCX24B};
namespace NLoadHandlerHelp
{
const int dmHelp=0, dmNoExtractingMask=1;
//std::string P1,P2,CurDir;
const int fCHUNK = 50000;
};
struct Entry
{
unsigned char name[12], //filename
hlam_1[4], //
hlam_2[4]; //
int offset, //from beginning
realSize, //size without compression
size; //and with
};
class CPCXConv
{
public:
unsigned char * pcx, *bmp;
int pcxs, bmps;
void fromFile(std::string path);
void saveBMP(std::string path);
void openPCX(char * PCX, int len);
void openPCX();
void convert();
CPCXConv(){pcx=bmp=NULL;pcxs=bmps=0;};
~CPCXConv(){if (pcxs) delete pcx; if(bmps) delete bmp;}
};
class CLodHandler
{
public:
std::vector<Entry> entries;
unsigned int totalFiles;
int readNormalNr (unsigned char* bufor, int bytCon, bool cyclic=false); //lod header reading helper
int decompress (unsigned char * source, int size, int realSize, std::ofstream & dest); //main decompression function
int decompress (unsigned char * source, int size, int realSize, std::string & dest); //main decompression function
int infm(FILE *source, FILE *dest, int wBits = 15); //zlib handler
void extract(std::string FName);
void init(std::string lodFile);
};
#endif //CLODHANDLER_H