aboutsummaryrefslogtreecommitdiff
path: root/include/smdatapack.hpp
blob: 2689eb310c722b91dd45fcf84f1073d62834bf9e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// -*- C++ -*-
/*
 * Simple MultimEdia LiTerator(SMELT)
 * by Chris Xiong 2015
 * DaTaPack format support header
 *
 * WARNING: This library is in development and interfaces would be very
 * unstable.
 *
 */
#ifndef SMDTP_H
#define SMDTP_H
#include "smelt.hpp"
#include <cstdlib>
#include <zlib.h>
#include <string>
#include <map>
class smFileInfo
{
public:
	char *path,*data;
	DWORD size,offset,crc;
};
class smDtpFileR
{
private:
	int fcnt;
	gzFile file;
	std::map<std::string,smFileInfo> m;

	bool enmemory;
	DWORD msize;
	const char *cp,*bp;
public:
	bool openDtp(const char* path);
	bool openDtpFromMemory(const char* ptr,DWORD size);
	void closeDtp();
	char* getFirstFile();
	char* getLastFile();
	char* getNextFile(const char* path);
	char* getPrevFile(const char* path);
	char* getFilePtr(const char* path);
	void releaseFilePtr(const char* path);
	DWORD getFileSize(const char* path);
};
class smDtpFileW
{
private:
	smFileInfo files[256];
	int fcnt;
public:
	smDtpFileW();
	bool addFile(const char* path,const char* realpath);
	bool writeDtp(const char* path);
};
#endif