annotate system/file.h @ 51:cbb301016a4e

* oops... finishing what was started and not said with the other patch: fixing memory leaks
author thib
date Fri, 17 Apr 2009 18:40:39 +0000
parents 5f548e5957a8
children 15a18fbe6f21
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
223b71206888 Initial import
thib
parents:
diff changeset
1 /* file.h : KANON ¤Î°µ½Ì¥Õ¥¡¥¤¥ë¡¦PDT ¥Õ¥¡¥¤¥ë¡Ê²èÁü¥Õ¥¡¥¤¥ë¡Ë¤ÎŸ³«¤Î
223b71206888 Initial import
thib
parents:
diff changeset
2 * ¤¿¤á¤Î¥¯¥é¥¹
223b71206888 Initial import
thib
parents:
diff changeset
3 * class FILESEARCH : ¥Õ¥¡¥¤¥ë¤Î´ÉÍý¤ò¹Ô¤¦
223b71206888 Initial import
thib
parents:
diff changeset
4 * class ARCINFO : ½ñ¸Ë¥Õ¥¡¥¤¥ë¤ÎÃæ¤Î£±¤Ä¤Î¥Õ¥¡¥¤¥ë¤ò°·¤¦¥¯¥é¥¹
223b71206888 Initial import
thib
parents:
diff changeset
5 * class PDTCONV : PDT ¥Õ¥¡¥¤¥ë¤ÎŸ³«¤ò¹Ô¤¦¡£
223b71206888 Initial import
thib
parents:
diff changeset
6 */
223b71206888 Initial import
thib
parents:
diff changeset
7
223b71206888 Initial import
thib
parents:
diff changeset
8 /*
223b71206888 Initial import
thib
parents:
diff changeset
9 *
223b71206888 Initial import
thib
parents:
diff changeset
10 * Copyright (C) 2000- Kazunori Ueno(JAGARL) <jagarl@creator.club.ne.jp>
223b71206888 Initial import
thib
parents:
diff changeset
11 *
223b71206888 Initial import
thib
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
223b71206888 Initial import
thib
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
223b71206888 Initial import
thib
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
223b71206888 Initial import
thib
parents:
diff changeset
15 * (at your option) any later version.
223b71206888 Initial import
thib
parents:
diff changeset
16 *
223b71206888 Initial import
thib
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
223b71206888 Initial import
thib
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
223b71206888 Initial import
thib
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
223b71206888 Initial import
thib
parents:
diff changeset
20 * GNU General Public License for more details.
223b71206888 Initial import
thib
parents:
diff changeset
21 *
27
3a6aaeab7b4e * Fixed a typo in Jagarl's name
thib
parents: 0
diff changeset
22 * You should have received a copy of the GNU General Public License along
3a6aaeab7b4e * Fixed a typo in Jagarl's name
thib
parents: 0
diff changeset
23 * with this program; if not, write to the Free Software Foundation, Inc.,
3a6aaeab7b4e * Fixed a typo in Jagarl's name
thib
parents: 0
diff changeset
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
0
223b71206888 Initial import
thib
parents:
diff changeset
25 *
223b71206888 Initial import
thib
parents:
diff changeset
26 */
223b71206888 Initial import
thib
parents:
diff changeset
27
223b71206888 Initial import
thib
parents:
diff changeset
28 #ifndef __KANON_FILE_H__
223b71206888 Initial import
thib
parents:
diff changeset
29 #define __KANON_FILE_H__
223b71206888 Initial import
thib
parents:
diff changeset
30
223b71206888 Initial import
thib
parents:
diff changeset
31 #ifndef DIR_SPLIT
223b71206888 Initial import
thib
parents:
diff changeset
32 #define DIR_SPLIT '/' /* UNIX */
223b71206888 Initial import
thib
parents:
diff changeset
33 #endif
223b71206888 Initial import
thib
parents:
diff changeset
34
223b71206888 Initial import
thib
parents:
diff changeset
35 // read 'KANON' compressed file
223b71206888 Initial import
thib
parents:
diff changeset
36
223b71206888 Initial import
thib
parents:
diff changeset
37 #include<stdio.h>
223b71206888 Initial import
thib
parents:
diff changeset
38 #include<stdlib.h>
223b71206888 Initial import
thib
parents:
diff changeset
39 #include<string.h>
223b71206888 Initial import
thib
parents:
diff changeset
40 #include<sys/types.h>
223b71206888 Initial import
thib
parents:
diff changeset
41
223b71206888 Initial import
thib
parents:
diff changeset
42 #ifdef HAVE_CONFIG_H
223b71206888 Initial import
thib
parents:
diff changeset
43 # include "config.h"
223b71206888 Initial import
thib
parents:
diff changeset
44 #endif
223b71206888 Initial import
thib
parents:
diff changeset
45
223b71206888 Initial import
thib
parents:
diff changeset
46 #if defined(__sparc) || defined(sparc)
223b71206888 Initial import
thib
parents:
diff changeset
47 # if !defined(WORDS_BIGENDIAN)
223b71206888 Initial import
thib
parents:
diff changeset
48 # define WORDS_BIGENDIAN 1
223b71206888 Initial import
thib
parents:
diff changeset
49 # endif
223b71206888 Initial import
thib
parents:
diff changeset
50 #endif
223b71206888 Initial import
thib
parents:
diff changeset
51
223b71206888 Initial import
thib
parents:
diff changeset
52 #define INT_SIZE 4
223b71206888 Initial import
thib
parents:
diff changeset
53
223b71206888 Initial import
thib
parents:
diff changeset
54 static int read_little_endian_int(const char* buf) {
223b71206888 Initial import
thib
parents:
diff changeset
55 const unsigned char *p = (const unsigned char *) buf;
223b71206888 Initial import
thib
parents:
diff changeset
56 return (p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0];
223b71206888 Initial import
thib
parents:
diff changeset
57 }
223b71206888 Initial import
thib
parents:
diff changeset
58
223b71206888 Initial import
thib
parents:
diff changeset
59 static int read_little_endian_short(const char* buf) {
223b71206888 Initial import
thib
parents:
diff changeset
60 const unsigned char *p = (const unsigned char *) buf;
223b71206888 Initial import
thib
parents:
diff changeset
61 return (p[1] << 8) | p[0];
223b71206888 Initial import
thib
parents:
diff changeset
62 }
223b71206888 Initial import
thib
parents:
diff changeset
63
223b71206888 Initial import
thib
parents:
diff changeset
64 static int write_little_endian_int(char* buf, int number) {
223b71206888 Initial import
thib
parents:
diff changeset
65 int c = read_little_endian_int(buf);
223b71206888 Initial import
thib
parents:
diff changeset
66 unsigned char *p = (unsigned char *) buf;
223b71206888 Initial import
thib
parents:
diff changeset
67 unsigned int unum = (unsigned int) number;
223b71206888 Initial import
thib
parents:
diff changeset
68 p[0] = unum & 255;
223b71206888 Initial import
thib
parents:
diff changeset
69 unum >>= 8;
223b71206888 Initial import
thib
parents:
diff changeset
70 p[1] = unum & 255;
223b71206888 Initial import
thib
parents:
diff changeset
71 unum >>= 8;
223b71206888 Initial import
thib
parents:
diff changeset
72 p[2] = unum & 255;
223b71206888 Initial import
thib
parents:
diff changeset
73 unum >>= 8;
223b71206888 Initial import
thib
parents:
diff changeset
74 p[3] = unum & 255;
223b71206888 Initial import
thib
parents:
diff changeset
75 return c;
223b71206888 Initial import
thib
parents:
diff changeset
76 }
223b71206888 Initial import
thib
parents:
diff changeset
77
223b71206888 Initial import
thib
parents:
diff changeset
78 static int write_little_endian_short(char* buf, int number) {
223b71206888 Initial import
thib
parents:
diff changeset
79 int c = read_little_endian_short(buf);
223b71206888 Initial import
thib
parents:
diff changeset
80 unsigned char *p = (unsigned char *) buf;
223b71206888 Initial import
thib
parents:
diff changeset
81 unsigned int unum = (unsigned int) number;
223b71206888 Initial import
thib
parents:
diff changeset
82 p[0] = unum & 255;
223b71206888 Initial import
thib
parents:
diff changeset
83 unum >>= 8;
223b71206888 Initial import
thib
parents:
diff changeset
84 p[1] = unum & 255;
223b71206888 Initial import
thib
parents:
diff changeset
85 return c;
223b71206888 Initial import
thib
parents:
diff changeset
86 }
223b71206888 Initial import
thib
parents:
diff changeset
87
223b71206888 Initial import
thib
parents:
diff changeset
88
223b71206888 Initial import
thib
parents:
diff changeset
89 /*********************************************
223b71206888 Initial import
thib
parents:
diff changeset
90 ** FILESEARCH:
223b71206888 Initial import
thib
parents:
diff changeset
91 ** ½ñ¸Ë¥Õ¥¡¥¤¥ë¡¿¥Ç¥£¥ì¥¯¥È¥ê¤ò´Þ¤á¡¢
223b71206888 Initial import
thib
parents:
diff changeset
92 ** Á´¥Õ¥¡¥¤¥ë¤Î´ÉÍý¤ò¹Ô¤¦¡£
223b71206888 Initial import
thib
parents:
diff changeset
93 **
223b71206888 Initial import
thib
parents:
diff changeset
94 ** ºÇ½é¤Ë¡¢ÀßÄê¥Õ¥¡¥¤¥ë¤«¤é¥Õ¥¡¥¤¥ë¤Î¼ïÎऴ¤È¤Ë
223b71206888 Initial import
thib
parents:
diff changeset
95 ** ¼ÂºÝ¤ËÆþ¤Ã¤Æ¤¤¤ë¥Ç¥£¥ì¥¯¥È¥ê¡¢½ñ¸Ë¤òÀßÄꤹ¤ë
223b71206888 Initial import
thib
parents:
diff changeset
96 **
223b71206888 Initial import
thib
parents:
diff changeset
97 ** °Ê¹ß¤ÏFind() ¥á¥½¥Ã¥É¤Ç¼ÂºÝ¤Î¥Õ¥¡¥¤¥ë¤ÎÆâÍƤòÆÀ¤ë
223b71206888 Initial import
thib
parents:
diff changeset
98 **
223b71206888 Initial import
thib
parents:
diff changeset
99 */
223b71206888 Initial import
thib
parents:
diff changeset
100
223b71206888 Initial import
thib
parents:
diff changeset
101 /* ARCFILE ¤È DIRFILE ¤Ï¥Õ¥¡¥¤¥ë¼ïÎऴ¤È¤Î¾ðÊó */
223b71206888 Initial import
thib
parents:
diff changeset
102 class ARCFILE;
223b71206888 Initial import
thib
parents:
diff changeset
103 class DIRFILE;
223b71206888 Initial import
thib
parents:
diff changeset
104 class SCN2kFILE;
223b71206888 Initial import
thib
parents:
diff changeset
105 /* ARCINFO ¤Ï¥Õ¥¡¥¤¥ë¤òÆɤ߹þ¤à¤¿¤á¤ËɬÍ× */
223b71206888 Initial import
thib
parents:
diff changeset
106 class ARCINFO;
223b71206888 Initial import
thib
parents:
diff changeset
107 class ARCFILE_ATOM;
35
2c574c3d50a9 * Moved XOR key related things to a proper location
thib
parents: 30
diff changeset
108
2c574c3d50a9 * Moved XOR key related things to a proper location
thib
parents: 30
diff changeset
109 class KEYHOLDER {
2c574c3d50a9 * Moved XOR key related things to a proper location
thib
parents: 30
diff changeset
110 public:
2c574c3d50a9 * Moved XOR key related things to a proper location
thib
parents: 30
diff changeset
111 void SetKey(char[16]);
2c574c3d50a9 * Moved XOR key related things to a proper location
thib
parents: 30
diff changeset
112 void SetKey2(char[33]);
2c574c3d50a9 * Moved XOR key related things to a proper location
thib
parents: 30
diff changeset
113 void GuessKey(char*);
2c574c3d50a9 * Moved XOR key related things to a proper location
thib
parents: 30
diff changeset
114 const char* GetKey(void);
2c574c3d50a9 * Moved XOR key related things to a proper location
thib
parents: 30
diff changeset
115 private:
2c574c3d50a9 * Moved XOR key related things to a proper location
thib
parents: 30
diff changeset
116 char key[16];
2c574c3d50a9 * Moved XOR key related things to a proper location
thib
parents: 30
diff changeset
117 };
2c574c3d50a9 * Moved XOR key related things to a proper location
thib
parents: 30
diff changeset
118
0
223b71206888 Initial import
thib
parents:
diff changeset
119 class FILESEARCH {
223b71206888 Initial import
thib
parents:
diff changeset
120 public:
223b71206888 Initial import
thib
parents:
diff changeset
121 #define TYPEMAX 14
223b71206888 Initial import
thib
parents:
diff changeset
122 enum FILETYPE {
223b71206888 Initial import
thib
parents:
diff changeset
123 /* °ì±þ¡¢0 - 15 ¤Þ¤Ç reserved */
223b71206888 Initial import
thib
parents:
diff changeset
124 ALL = 1, /* dat/ °Ê²¼¤Î¥Õ¥¡¥¤¥ë(¥Ç¥Õ¥©¥ë¥È¤Î¸¡º÷Àè) */
223b71206888 Initial import
thib
parents:
diff changeset
125 ROOT= 2, /* ¥²¡¼¥à¤Î¥¤¥ó¥¹¥È¡¼¥ë¥Ç¥£¥ì¥¯¥È¥ê */
223b71206888 Initial import
thib
parents:
diff changeset
126 PDT = 3, /* default: PDT/ */
223b71206888 Initial import
thib
parents:
diff changeset
127 SCN = 4, /* default: DAT/SEEN.TXT */
223b71206888 Initial import
thib
parents:
diff changeset
128 ANM = 5, /* default: DAT/ALLANM.ANL */
223b71206888 Initial import
thib
parents:
diff changeset
129 ARD = 6, /* default: DAT/ALLARD.ARD */
223b71206888 Initial import
thib
parents:
diff changeset
130 CUR = 7, /* default: DAT/ALLCUR.CUR */
223b71206888 Initial import
thib
parents:
diff changeset
131 MID = 8, /* default: ALL */
223b71206888 Initial import
thib
parents:
diff changeset
132 WAV = 9, /* default: ALL */
223b71206888 Initial import
thib
parents:
diff changeset
133 KOE = 10, /* default: KOE/ */
223b71206888 Initial import
thib
parents:
diff changeset
134 BGM = 11, /* default: BGM */
223b71206888 Initial import
thib
parents:
diff changeset
135 MOV = 12, /* default : MOV */
223b71206888 Initial import
thib
parents:
diff changeset
136 GAN = 13 /* default : MOV */
223b71206888 Initial import
thib
parents:
diff changeset
137 };
223b71206888 Initial import
thib
parents:
diff changeset
138 enum ARCTYPE {ATYPE_DIR, ATYPE_ARC, ATYPE_SCN2k};
223b71206888 Initial import
thib
parents:
diff changeset
139 private:
223b71206888 Initial import
thib
parents:
diff changeset
140 /* InitRoot() ¤Î»þÅÀ¤Ç½é´ü²½¤µ¤ì¤ëÊÑ¿ô */
223b71206888 Initial import
thib
parents:
diff changeset
141 DIRFILE* root_dir;
223b71206888 Initial import
thib
parents:
diff changeset
142 DIRFILE* dat_dir;
223b71206888 Initial import
thib
parents:
diff changeset
143 ARCFILE* searcher[TYPEMAX];
223b71206888 Initial import
thib
parents:
diff changeset
144 /* ¥Õ¥¡¥¤¥ë¤Î¸ºß°ÌÃ֤Πinformation */
223b71206888 Initial import
thib
parents:
diff changeset
145 ARCTYPE is_archived[TYPEMAX];
47
5f548e5957a8 * get rid of the "deprecated conversion from string constant to ‘char*’" warnings
thib
parents: 35
diff changeset
146 const char* filenames[TYPEMAX];
0
223b71206888 Initial import
thib
parents:
diff changeset
147 /* ¥Ç¥Õ¥©¥ë¥È¤Î information */
223b71206888 Initial import
thib
parents:
diff changeset
148 static ARCTYPE default_is_archived[TYPEMAX];
47
5f548e5957a8 * get rid of the "deprecated conversion from string constant to ‘char*’" warnings
thib
parents: 35
diff changeset
149 static const char* default_dirnames[TYPEMAX];
0
223b71206888 Initial import
thib
parents:
diff changeset
150 public:
223b71206888 Initial import
thib
parents:
diff changeset
151 FILESEARCH(void);
223b71206888 Initial import
thib
parents:
diff changeset
152 ~FILESEARCH();
223b71206888 Initial import
thib
parents:
diff changeset
153 /* ½é¤á¤Ë¥²¡¼¥à¤Î¥Ç¡¼¥¿¤¬¤¢¤ë¥Ç¥£¥ì¥¯¥È¥ê¤òÀßÄꤹ¤ëɬÍפ¬¤¢¤ë */
223b71206888 Initial import
thib
parents:
diff changeset
154 int InitRoot(char* root);
223b71206888 Initial import
thib
parents:
diff changeset
155 /* ¥Õ¥¡¥¤¥ë¤Î·¿¤´¤È¤Î¾ðÊó¤ò¥»¥Ã¥È¤¹¤ë */
223b71206888 Initial import
thib
parents:
diff changeset
156 void SetFileInformation(FILETYPE type, ARCTYPE is_arc,
223b71206888 Initial import
thib
parents:
diff changeset
157 char* filename);
223b71206888 Initial import
thib
parents:
diff changeset
158 /* Ê£¿ô¤Î¥Õ¥¡¥¤¥ë¤ò°ì¤Ä¤Î·¿¤Ë´ØÏ¢¤Å¤±¤ë */
223b71206888 Initial import
thib
parents:
diff changeset
159 void AppendFileInformation(FILETYPE type, ARCTYPE is_arc,
223b71206888 Initial import
thib
parents:
diff changeset
160 char* filename);
47
5f548e5957a8 * get rid of the "deprecated conversion from string constant to ‘char*’" warnings
thib
parents: 35
diff changeset
161 ARCFILE* MakeARCFILE(ARCTYPE tp, const char* filename);
0
223b71206888 Initial import
thib
parents:
diff changeset
162 /* fname ¤Ç»ØÄꤵ¤ì¤¿Ì¾Á°¤Î¥Õ¥¡¥¤¥ë¤ò¸¡º÷ */
223b71206888 Initial import
thib
parents:
diff changeset
163 class ARCINFO* Find(FILETYPE type, const char* fname, const char* ext=0);
223b71206888 Initial import
thib
parents:
diff changeset
164 /* ¤¢¤ë¼ïÎà¤Î¥Õ¥¡¥¤¥ë¤ò¤¹¤Ù¤Æ¥ê¥¹¥È¥¢¥Ã¥×
223b71206888 Initial import
thib
parents:
diff changeset
165 ** ËöÈø¤Ï NULL pointer
223b71206888 Initial import
thib
parents:
diff changeset
166 */
223b71206888 Initial import
thib
parents:
diff changeset
167 char** ListAll(FILETYPE type);
223b71206888 Initial import
thib
parents:
diff changeset
168 };
223b71206888 Initial import
thib
parents:
diff changeset
169
223b71206888 Initial import
thib
parents:
diff changeset
170 class ARCINFO {
223b71206888 Initial import
thib
parents:
diff changeset
171 protected:
223b71206888 Initial import
thib
parents:
diff changeset
172 /* ¥Õ¥¡¥¤¥ë¤½¤Î¤â¤Î¤Î¾ðÊó */
223b71206888 Initial import
thib
parents:
diff changeset
173 ARCFILE_ATOM& info;
223b71206888 Initial import
thib
parents:
diff changeset
174 char* arcfile;
223b71206888 Initial import
thib
parents:
diff changeset
175 /* mmap ¤·¤Æ¤¤¤ë¾ì¹ç¡¢¤½¤Î¾ðÊó */
223b71206888 Initial import
thib
parents:
diff changeset
176 bool use_mmap;
223b71206888 Initial import
thib
parents:
diff changeset
177 char* mmapped_memory;
223b71206888 Initial import
thib
parents:
diff changeset
178 int fd;
223b71206888 Initial import
thib
parents:
diff changeset
179 /* ¥Õ¥¡¥¤¥ëÆâÍƤÎÆþ¤Ã¤Æ¤¤¤ë¥Ð¥Ã¥Õ¥¡ */
223b71206888 Initial import
thib
parents:
diff changeset
180 const char* data;
223b71206888 Initial import
thib
parents:
diff changeset
181
223b71206888 Initial import
thib
parents:
diff changeset
182 protected:
223b71206888 Initial import
thib
parents:
diff changeset
183 ARCINFO(const char* arcfile, ARCFILE_ATOM& from); // only from ARCFILE
223b71206888 Initial import
thib
parents:
diff changeset
184 friend class ARCFILE;
223b71206888 Initial import
thib
parents:
diff changeset
185 friend class DIRFILE;
223b71206888 Initial import
thib
parents:
diff changeset
186
223b71206888 Initial import
thib
parents:
diff changeset
187 virtual bool ExecExtract(void);
223b71206888 Initial import
thib
parents:
diff changeset
188 public:
223b71206888 Initial import
thib
parents:
diff changeset
189 /* dest ¤Ï256byte ÄøÅÙ¤Î;͵¤¬¤¢¤ë¤³¤È */
223b71206888 Initial import
thib
parents:
diff changeset
190 static void Extract(char*& dest, char*& src, char* destend, char* srcend);
223b71206888 Initial import
thib
parents:
diff changeset
191 static void Extract2k(char*& dest, char*& src, char* destend, char* srcend);
223b71206888 Initial import
thib
parents:
diff changeset
192 virtual ~ARCINFO();
223b71206888 Initial import
thib
parents:
diff changeset
193 /* ɬÍפʤé Read Á°¤Ë¸Æ¤Ö¤³¤È¤Ç½èÍý¤òʬ³ä¤Ç¤­¤ë */
223b71206888 Initial import
thib
parents:
diff changeset
194 int Size(void) const;
223b71206888 Initial import
thib
parents:
diff changeset
195 char* CopyRead(void); /* Read() ¤·¤ÆÆâÍƤΥ³¥Ô¡¼¤òÊÖ¤¹ */
223b71206888 Initial import
thib
parents:
diff changeset
196 const char* Read(void);
223b71206888 Initial import
thib
parents:
diff changeset
197 /* ¥Õ¥¡¥¤¥ë¤¬ regular file ¤Î¾ì¹ç¡¢¥Õ¥¡¥¤¥ë̾¤òµ¢¤¹ */
223b71206888 Initial import
thib
parents:
diff changeset
198 /* ¤½¤¦¤Ç¤Ê¤¤¤Ê¤é 0 ¤òµ¢¤¹ */
223b71206888 Initial import
thib
parents:
diff changeset
199 const char* Path(void) const;
223b71206888 Initial import
thib
parents:
diff changeset
200 FILE* OpenFile(int* length=0) const; /* ¸ß´¹À­¤Î¤¿¤á¡§raw file ¤Î¾ì¹ç¡¢¥Õ¥¡¥¤¥ë¤ò³«¤¯ */
223b71206888 Initial import
thib
parents:
diff changeset
201 };
223b71206888 Initial import
thib
parents:
diff changeset
202
223b71206888 Initial import
thib
parents:
diff changeset
203 class GRPCONV {
223b71206888 Initial import
thib
parents:
diff changeset
204 public:
223b71206888 Initial import
thib
parents:
diff changeset
205 int width;
223b71206888 Initial import
thib
parents:
diff changeset
206 int height;
223b71206888 Initial import
thib
parents:
diff changeset
207 bool is_mask;
223b71206888 Initial import
thib
parents:
diff changeset
208
223b71206888 Initial import
thib
parents:
diff changeset
209 const char* filename;
223b71206888 Initial import
thib
parents:
diff changeset
210 const char* data;
223b71206888 Initial import
thib
parents:
diff changeset
211 int datalen;
223b71206888 Initial import
thib
parents:
diff changeset
212
223b71206888 Initial import
thib
parents:
diff changeset
213 int Width(void) { return width;}
223b71206888 Initial import
thib
parents:
diff changeset
214 int Height(void) { return height;}
223b71206888 Initial import
thib
parents:
diff changeset
215 bool IsMask(void) { return is_mask;}
223b71206888 Initial import
thib
parents:
diff changeset
216
223b71206888 Initial import
thib
parents:
diff changeset
217 GRPCONV(void);
223b71206888 Initial import
thib
parents:
diff changeset
218 virtual ~GRPCONV();
223b71206888 Initial import
thib
parents:
diff changeset
219 void Init(const char* fname, const char* data, int dlen, int width, int height, bool is_mask);
223b71206888 Initial import
thib
parents:
diff changeset
220
223b71206888 Initial import
thib
parents:
diff changeset
221 virtual bool Read(char* image) = 0;
223b71206888 Initial import
thib
parents:
diff changeset
222 static GRPCONV* AssignConverter(const char* inbuf, int inlen, const char* fname);
223b71206888 Initial import
thib
parents:
diff changeset
223 static GRPCONV* AssignConverter(ARCINFO* info) {
223b71206888 Initial import
thib
parents:
diff changeset
224 const char* dat = info->Read();
223b71206888 Initial import
thib
parents:
diff changeset
225 if (dat == 0) return 0;
223b71206888 Initial import
thib
parents:
diff changeset
226 return AssignConverter(dat, info->Size(), "???");
223b71206888 Initial import
thib
parents:
diff changeset
227 }
223b71206888 Initial import
thib
parents:
diff changeset
228 void CopyRGBA(char* image, const char* from);
223b71206888 Initial import
thib
parents:
diff changeset
229 void CopyRGB(char* image, const char* from);
223b71206888 Initial import
thib
parents:
diff changeset
230 void CopyRGBA_rev(char* image, const char* from);
223b71206888 Initial import
thib
parents:
diff changeset
231 void CopyRGB_rev(char* image, const char* from);
223b71206888 Initial import
thib
parents:
diff changeset
232 };
223b71206888 Initial import
thib
parents:
diff changeset
233
223b71206888 Initial import
thib
parents:
diff changeset
234 extern FILESEARCH file_searcher;
35
2c574c3d50a9 * Moved XOR key related things to a proper location
thib
parents: 30
diff changeset
235 extern KEYHOLDER key_holder;
0
223b71206888 Initial import
thib
parents:
diff changeset
236
223b71206888 Initial import
thib
parents:
diff changeset
237 #endif // !defined(__KANON_FILE_H__)