Glide Plugin GLES2 port from mupen64plus-ae, but with special FrameSkip code
[mupen64plus-pandora.git] / source / gles2glide64 / src / GlideHQ / Ext_TxFilter.cpp
1 /*
2  * Texture Filtering
3  * Version:  1.0
4  *
5  * Copyright (C) 2007  Hiroshi Morii   All Rights Reserved.
6  * Email koolsmoky(at)users.sourceforge.net
7  * Web   http://www.3dfxzone.it/koolsmoky
8  *
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)
12  * any later version.
13  *
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.
18  *
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.
22  */
23
24 #include <memory.h>
25 #include <stdlib.h>
26 #include "Ext_TxFilter.h"
27
28 extern "C"{
29
30 boolean txfilter_init(int maxwidth, int maxheight, int maxbpp,
31                       int options, int cachesize,
32                       wchar_t *datapath, wchar_t *cachepath, wchar_t *ident,
33                       dispInfoFuncExt callback);
34
35 void txfilter_shutdown(void);
36
37 boolean txfilter(unsigned char *src, int srcwidth, int srcheight, unsigned short srcformat,
38                  uint64 g64crc, GHQTexInfo *info);
39
40 boolean txfilter_hirestex(uint64 g64crc, uint64 r_crc64, unsigned short *palette, GHQTexInfo *info);
41
42 uint64 txfilter_checksum(unsigned char *src, int width, int height, int size, int rowStride, unsigned char *palette);
43
44 boolean txfilter_dmptx(unsigned char *src, int width, int height, int rowStridePixel, unsigned short gfmt, unsigned short n64fmt, uint64 r_crc64);
45
46 boolean txfilter_reloadhirestex();
47
48 }
49
50 void ext_ghq_shutdown(void)
51 {
52   txfilter_shutdown();
53 }
54
55 boolean ext_ghq_init(int maxwidth, int maxheight, int maxbpp, int options, int cachesize,
56                      wchar_t *datapath, wchar_t *cachepath, wchar_t *ident,
57                      dispInfoFuncExt callback)
58 {
59   boolean bRet = 0;
60
61   bRet = txfilter_init(maxwidth, maxheight, maxbpp, options, cachesize, datapath, cachepath, ident, callback);
62
63   return bRet;
64 }
65
66 boolean ext_ghq_txfilter(unsigned char *src, int srcwidth, int srcheight, unsigned short srcformat,
67                                 uint64 g64crc, GHQTexInfo *info)
68 {
69   boolean ret = 0;
70
71   ret = txfilter(src, srcwidth, srcheight, srcformat,
72                  g64crc, info);
73
74   return ret;
75 }
76
77 boolean ext_ghq_hirestex(uint64 g64crc, uint64 r_crc64, unsigned short *palette, GHQTexInfo *info)
78 {
79   boolean ret = 0;
80
81   ret = txfilter_hirestex(g64crc, r_crc64, palette, info);
82
83   return ret;
84 }
85
86 uint64 ext_ghq_checksum(unsigned char *src, int width, int height, int size, int rowStride, unsigned char *palette)
87 {
88   uint64 ret = 0;
89
90   ret = txfilter_checksum(src, width, height, size, rowStride, palette);
91
92   return ret;
93 }
94
95 boolean ext_ghq_dmptx(unsigned char *src, int width, int height, int rowStridePixel, unsigned short gfmt, unsigned short n64fmt, uint64 r_crc64)
96 {
97   boolean ret = 0;
98
99   ret = txfilter_dmptx(src, width, height, rowStridePixel, gfmt, n64fmt, r_crc64);
100
101   return ret;
102 }
103
104 boolean ext_ghq_reloadhirestex()
105 {
106   boolean ret = 0;
107
108   ret = txfilter_reloadhirestex();
109
110   return ret;
111 }