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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
/*
* PSX-Tools Bundle Pack
* Copyright (C) 2002 Nicolas "Pixel" Noble
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __LZSS_H__
#define __LZSS_H__
#include <stdio.h>
#include "generic.h"
#include "Handle.h"
#define LZSS_VERSION String("3.0.0-pre1")
#define LZSS_NAME String("lzss")
class lzss : public Base {
public:
lzss();
typedef struct {
char * name;
int one_is_compressed, bitmap_inversed, one_jump, overlap_trick, negative_trick, sixteen_bits, ptrb, filling;
int window_start;
int l_mask_1, l_shft_1, l_mask_2, l_shft_2;
int j_mask_1, j_shft_1, j_mask_2, j_shft_2;
int f_mask_1, f_shft_1, f_mask_2, f_shft_2;
int v_mask_1, v_shft_1, v_mask_2, v_shft_2;
} scheme_t;
enum {
XENO = 0,
DBZ,
FF7,
LM,
MM,
OB,
LODOSS,
FF6,
VP_1,
VP_2,
END
};
static const scheme_t schemes[];
int tolerate, blockb;
long blk, bitmap_count;
unsigned long lzss_decomp(Handle * f_source, Handle * f_cible, long true_length = -1);
void lzss_comp(Handle * f_source, Handle * f_cible, long * delta = NULL);
Byte swap_bits(Byte);
void change_scheme(scheme_t);
scheme_t get_scheme();
private:
scheme_t scheme;
int lzss_maxsize, lzss_maxptr;
unsigned int shift(unsigned int, int);
void compute_limits(void);
unsigned char lzss_rd(unsigned char *, long);
long lzss_comp_strstr(unsigned char *, unsigned char *, long *, long);
unsigned char * lzss_memcomp(unsigned char *, long *, long *);
};
#endif
|