| 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 | #ifdef __MSC__ |
| 25 | #pragma warning(disable: 4786) |
| 26 | #endif |
| 27 | |
| 28 | #include "TxFilter.h" |
| 29 | |
| 30 | TxFilter *txFilter = NULL; |
| 31 | |
| 32 | #ifdef __cplusplus |
| 33 | extern "C"{ |
| 34 | #endif |
| 35 | |
| 36 | TAPI boolean TAPIENTRY |
| 37 | txfilter_init(int maxwidth, int maxheight, int maxbpp, int options, int cachesize, |
| 38 | wchar_t *datapath, wchar_t *cachepath, wchar_t*ident, |
| 39 | dispInfoFuncExt callback) |
| 40 | { |
| 41 | if (txFilter) return 0; |
| 42 | |
| 43 | txFilter = new TxFilter(maxwidth, maxheight, maxbpp, options, cachesize, |
| 44 | datapath, cachepath, ident, callback); |
| 45 | |
| 46 | return (txFilter ? 1 : 0); |
| 47 | } |
| 48 | |
| 49 | TAPI void TAPIENTRY |
| 50 | txfilter_shutdown(void) |
| 51 | { |
| 52 | if (txFilter) delete txFilter; |
| 53 | |
| 54 | txFilter = NULL; |
| 55 | } |
| 56 | |
| 57 | TAPI boolean TAPIENTRY |
| 58 | txfilter(uint8 *src, int srcwidth, int srcheight, uint16 srcformat, |
| 59 | uint64 g64crc, GHQTexInfo *info) |
| 60 | { |
| 61 | if (txFilter) |
| 62 | return txFilter->filter(src, srcwidth, srcheight, srcformat, |
| 63 | g64crc, info); |
| 64 | |
| 65 | return 0; |
| 66 | } |
| 67 | |
| 68 | TAPI boolean TAPIENTRY |
| 69 | txfilter_hirestex(uint64 g64crc, uint64 r_crc64, uint16 *palette, GHQTexInfo *info) |
| 70 | { |
| 71 | if (txFilter) |
| 72 | return txFilter->hirestex(g64crc, r_crc64, palette, info); |
| 73 | |
| 74 | return 0; |
| 75 | } |
| 76 | |
| 77 | TAPI uint64 TAPIENTRY |
| 78 | txfilter_checksum(uint8 *src, int width, int height, int size, int rowStride, uint8 *palette) |
| 79 | { |
| 80 | if (txFilter) |
| 81 | return txFilter->checksum64(src, width, height, size, rowStride, palette); |
| 82 | |
| 83 | return 0; |
| 84 | } |
| 85 | |
| 86 | TAPI boolean TAPIENTRY |
| 87 | txfilter_dmptx(uint8 *src, int width, int height, int rowStridePixel, uint16 gfmt, uint16 n64fmt, uint64 r_crc64) |
| 88 | { |
| 89 | if (txFilter) |
| 90 | return txFilter->dmptx(src, width, height, rowStridePixel, gfmt, n64fmt, r_crc64); |
| 91 | |
| 92 | return 0; |
| 93 | } |
| 94 | |
| 95 | TAPI boolean TAPIENTRY |
| 96 | txfilter_reloadhirestex() |
| 97 | { |
| 98 | if (txFilter) |
| 99 | return txFilter->reloadhirestex(); |
| 100 | |
| 101 | return 0; |
| 102 | } |
| 103 | |
| 104 | #ifdef __cplusplus |
| 105 | } |
| 106 | #endif |