Path: blob/master/libmupen64plus/mupen64plus-video-glide64mk2/src/GlideHQ/TxTexCache.cpp
2 views
/*1* Texture Filtering2* Version: 1.03*4* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.5* Email koolsmoky(at)users.sourceforge.net6* Web http://www.3dfxzone.it/koolsmoky7*8* this is free software; you can redistribute it and/or modify9* it under the terms of the GNU General Public License as published by10* the Free Software Foundation; either version 2, or (at your option)11* any later version.12*13* this is distributed in the hope that it will be useful,14* but WITHOUT ANY WARRANTY; without even the implied warranty of15* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16* GNU General Public License for more details.17*18* You should have received a copy of the GNU General Public License19* along with GNU Make; see the file COPYING. If not, write to20* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.21*/2223#ifdef __MSC__24#pragma warning(disable: 4786)25#endif2627#include "TxTexCache.h"28#include "TxDbg.h"29#include <zlib.h>30#include <string>31#include <boost/filesystem.hpp>3233TxTexCache::~TxTexCache()34{35#ifdef DUMP_CACHE36if (_options & DUMP_TEXCACHE) {37/* dump cache to disk */38std::wstring filename = _ident + L"_MEMORYCACHE.dat";39boost::filesystem::wpath cachepath(_cachepath);40cachepath /= boost::filesystem::wpath(L"glidehq");41int config = _options & (FILTER_MASK|ENHANCEMENT_MASK|COMPRESS_TEX|COMPRESSION_MASK|FORCE16BPP_TEX|GZ_TEXCACHE);4243TxCache::save(cachepath.wstring().c_str(), filename.c_str(), config);44}45#endif46}4748TxTexCache::TxTexCache(int options, int cachesize, const wchar_t *datapath, const wchar_t *cachepath,49const wchar_t *ident, dispInfoFuncExt callback50) : TxCache((options & ~GZ_HIRESTEXCACHE), cachesize, datapath, cachepath, ident, callback)51{52/* assert local options */53if (_cachepath.empty() || _ident.empty() || !_cacheSize)54_options &= ~DUMP_TEXCACHE;5556#ifdef DUMP_CACHE57if (_options & DUMP_TEXCACHE) {58/* find it on disk */59std::wstring filename = _ident + L"_MEMORYCACHE.dat";60boost::filesystem::wpath cachepath(_cachepath);61cachepath /= boost::filesystem::wpath(L"glidehq");62int config = _options & (FILTER_MASK|ENHANCEMENT_MASK|COMPRESS_TEX|COMPRESSION_MASK|FORCE16BPP_TEX|GZ_TEXCACHE);6364TxCache::load(cachepath.wstring().c_str(), filename.c_str(), config);65}66#endif67}6869boolean70TxTexCache::add(uint64 checksum, GHQTexInfo *info)71{72if (_cacheSize <= 0) return 0;7374return TxCache::add(checksum, info);75}767778