5 * Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
6 * Email koolsmoky(at)users.sourceforge.net
7 * Web http://www.3dfxzone.it/koolsmoky
9 * this is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2, or (at your option)
14 * this is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with GNU Make; see the file COPYING. If not, write to
21 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24 #ifndef __EXT_TXFILTER_H__
25 #define __EXT_TXFILTER_H__
29 #define TXHMODULE HMODULE
30 #define DLOPEN(a) LoadLibraryW(a)
31 #define DLCLOSE(a) FreeLibrary(a)
32 #define DLSYM(a, b) GetProcAddress(a, b)
33 #define GETCWD(a, b) GetCurrentDirectoryW(a, b)
34 #define CHDIR(a) SetCurrentDirectoryW(a)
39 #define TXHMODULE void*
40 #define DLOPEN(a) dlopen(a, RTLD_LAZY|RTLD_GLOBAL)
41 #define DLCLOSE(a) dlclose(a)
42 #define DLSYM(a, b) dlsym(a, b)
43 #define GETCWD(a, b) getcwd(b, a)
44 #define CHDIR(a) chdir(a)
48 typedef __int64 int64;
49 typedef unsigned __int64 uint64;
52 typedef int64_t int64;
53 typedef uint64_t uint64;
54 typedef unsigned char boolean;
57 #define NO_OPTIONS 0x00000000
59 #define FILTER_MASK 0x000000ff
60 #define NO_FILTER 0x00000000
61 #define SMOOTH_FILTER_MASK 0x0000000f
62 #define NO_SMOOTH_FILTER 0x00000000
63 #define SMOOTH_FILTER_1 0x00000001
64 #define SMOOTH_FILTER_2 0x00000002
65 #define SMOOTH_FILTER_3 0x00000003
66 #define SMOOTH_FILTER_4 0x00000004
67 #define SHARP_FILTER_MASK 0x000000f0
68 #define NO_SHARP_FILTER 0x00000000
69 #define SHARP_FILTER_1 0x00000010
70 #define SHARP_FILTER_2 0x00000020
72 #define ENHANCEMENT_MASK 0x00000f00
73 #define NO_ENHANCEMENT 0x00000000
74 #define X2_ENHANCEMENT 0x00000100
75 #define X2SAI_ENHANCEMENT 0x00000200
76 #define HQ2X_ENHANCEMENT 0x00000300
77 #define LQ2X_ENHANCEMENT 0x00000400
78 #define HQ4X_ENHANCEMENT 0x00000500
79 #define HQ2XS_ENHANCEMENT 0x00000600
80 #define LQ2XS_ENHANCEMENT 0x00000700
82 #define COMPRESSION_MASK 0x0000f000
83 #define NO_COMPRESSION 0x00000000
84 #define FXT1_COMPRESSION 0x00001000
85 #define NCC_COMPRESSION 0x00002000
86 #define S3TC_COMPRESSION 0x00003000
88 #define HIRESTEXTURES_MASK 0x000f0000
89 #define NO_HIRESTEXTURES 0x00000000
90 #define GHQ_HIRESTEXTURES 0x00010000
91 #define RICE_HIRESTEXTURES 0x00020000
92 #define JABO_HIRESTEXTURES 0x00030000
94 #define COMPRESS_TEX 0x00100000
95 #define COMPRESS_HIRESTEX 0x00200000
96 #define GZ_TEXCACHE 0x00400000
97 #define GZ_HIRESTEXCACHE 0x00800000
98 #define DUMP_TEXCACHE 0x01000000
99 #define DUMP_HIRESTEXCACHE 0x02000000
100 #define TILE_HIRESTEX 0x04000000
101 #define UNDEFINED_0 0x08000000
102 #define FORCE16BPP_HIRESTEX 0x10000000
103 #define FORCE16BPP_TEX 0x20000000
104 #define LET_TEXARTISTS_FLY 0x40000000 /* a little freedom for texture artists */
105 #define DUMP_TEX 0x80000000
107 #ifndef __GLIDE_H__ /* GLIDE3 */
108 /* from 3Dfx Interactive Inc. glide.h */
109 #define GR_TEXFMT_ALPHA_8 0x2
110 #define GR_TEXFMT_INTENSITY_8 0x3
112 #define GR_TEXFMT_ALPHA_INTENSITY_44 0x4
113 #define GR_TEXFMT_P_8 0x5
115 #define GR_TEXFMT_RGB_565 0xa
116 #define GR_TEXFMT_ARGB_1555 0xb
117 #define GR_TEXFMT_ARGB_4444 0xc
118 #define GR_TEXFMT_ALPHA_INTENSITY_88 0xd
120 /* from 3Dfx Interactive Inc. g3ext.h */
121 #define GR_TEXFMT_ARGB_CMP_FXT1 0x11
123 #define GR_TEXFMT_ARGB_8888 0x12
125 #define GR_TEXFMT_ARGB_CMP_DXT1 0x16
126 #define GR_TEXFMT_ARGB_CMP_DXT3 0x18
127 #define GR_TEXFMT_ARGB_CMP_DXT5 0x1A
145 unsigned short format;
147 unsigned char is_hires_tex;
150 /* Callback to display hires texture info.
151 * Gonetz <gonetz(at)ngs.ru>
153 * void DispInfo(const char *format, ...)
156 * char buf[INFO_BUF];
158 * va_start(args, format);
159 * vsprintf(buf, format, args);
165 #define INFO_BUF 4095
166 typedef void (*dispInfoFuncExt)(const wchar_t *format, ...);
169 boolean ext_ghq_init(int maxwidth, /* maximum texture width supported by hardware */
170 int maxheight,/* maximum texture height supported by hardware */
171 int maxbpp, /* maximum texture bpp supported by hardware */
172 int options, /* options */
173 int cachesize,/* cache textures to system memory */
174 wchar_t *datapath, /* user data directory. must be smaller than MAX_PATH */
175 wchar_t *cachepath, /* user cache directory. must be smaller than MAX_PATH */
176 wchar_t *ident, /* name of ROM. must be no longer than 64 in character. */
177 dispInfoFuncExt callback /* callback function to display info */
180 void ext_ghq_shutdown(void);
182 boolean ext_ghq_txfilter(unsigned char *src, /* input texture */
183 int srcwidth, /* width of input texture */
184 int srcheight, /* height of input texture */
185 unsigned short srcformat, /* format of input texture */
186 uint64 g64crc, /* glide64 crc */
187 GHQTexInfo *info /* output */
190 boolean ext_ghq_hirestex(uint64 g64crc, /* glide64 crc */
191 uint64 r_crc64, /* checksum hi:palette low:texture */
192 unsigned short *palette, /* palette for CI textures */
193 GHQTexInfo *info /* output */
196 uint64 ext_ghq_checksum(unsigned char *src, /* input texture */
197 int width, /* width of texture */
198 int height, /* height of texture */
199 int size, /* type of texture pixel */
200 int rowStride, /* row stride in bytes */
201 unsigned char *palette /* palette */
204 boolean ext_ghq_dmptx(unsigned char *src, /* input texture (must be in 3Dfx Glide format) */
205 int width, /* width of texture */
206 int height, /* height of texture */
207 int rowStridePixel, /* row stride of input texture in pixels */
208 unsigned short gfmt, /* glide format of input texture */
209 unsigned short n64fmt,/* N64 format hi:format low:size */
210 uint64 r_crc64 /* checksum hi:palette low:texture */
213 boolean ext_ghq_reloadhirestex();
214 #endif /* TXFILTER_DLL */
216 #endif /* __EXT_TXFILTER_H__ */