~sithlord48/hyne/master

2 by myst6re
First commit
1
/****************************************************************************
2
 ** Hyne Final Fantasy VIII Save Editor
124 by myst6re
Merging Qt5 branch in trunk:
3
 ** Copyright (C) 2009-2013 Arzel Jérôme <myst6re@gmail.com>
2 by myst6re
First commit
4
 **
5
 ** This program is free software: you can redistribute it and/or modify
6
 ** it under the terms of the GNU General Public License as published by
7
 ** the Free Software Foundation, either version 3 of the License, or
8
 ** (at your option) any later version.
9
 **
10
 ** This program is distributed in the hope that it will be useful,
11
 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 ** GNU General Public License for more details.
14
 **
15
 ** You should have received a copy of the GNU General Public License
16
 ** along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
 ****************************************************************************/
18
/***************************************************************
19
	4/6/1989 Haruhiko Okumura
20
	Use, distribute, and modify this program freely.
21
	Please send me your improved versions.
22
		PC-VAN		SCIENCE
23
		NIFTY-Serve	PAF01022
24
		CompuServe	74050,1022
25
**************************************************************/
26
27
#ifndef DEF_LZS
28
#define DEF_LZS
29
30
#include <QtCore>
31
32
class LZS
33
{
34
public:
13 by myst6re
BUG: when you save a "one-slot" file into "15-slots" file (like mcr), the 14 missing slots are not added in Hyne.
35
	static const QByteArray &decompress(const QByteArray &fileData, int max);
36
	static const QByteArray &decompressAll(const QByteArray &fileData);
37
	static const QByteArray &compress(const QByteArray &fileData);
40 by myst6re
Reduce used memory:
38
	static void clear();
2 by myst6re
First commit
39
private:
40
	static void InsertNode(qint32 r);
41
	static void DeleteNode(qint32 p);
42
	static qint32 match_length;//of longest match. These are set by the InsertNode() procedure.
43
	static qint32 match_position;
44
	static qint32 lson[4097];//left & right children & parents -- These constitute binary search trees.
45
	static qint32 rson[4353];
46
	static qint32 dad[4097];
47
	static unsigned char text_buf[4113];//ring buffer of size 4096, with extra 17 bytes to facilitate string comparison
48
	static QByteArray result;
49
};
50
51
#endif