mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-07 03:13:49 +00:00
Separate plugin path and texture pack path.
Texture pack searched by texture pack path. Texture cache saved in %plugin path%/cache
This commit is contained in:
parent
7ade71eb55
commit
a0ce2f93a4
|
@ -216,8 +216,7 @@ extern "C"{
|
|||
|
||||
TAPI boolean TAPIENTRY
|
||||
txfilter_init(int maxwidth, int maxheight, int maxbpp, int options, int cachesize,
|
||||
const wchar_t *path, const wchar_t*ident,
|
||||
dispInfoFuncExt callback);
|
||||
const wchar_t *path, const wchar_t * texPackPath, const wchar_t*ident, dispInfoFuncExt callback);
|
||||
|
||||
TAPI void TAPIENTRY
|
||||
txfilter_shutdown(void);
|
||||
|
|
|
@ -57,7 +57,7 @@ TxFilter::~TxFilter()
|
|||
}
|
||||
|
||||
TxFilter::TxFilter(int maxwidth, int maxheight, int maxbpp, int options,
|
||||
int cachesize, const wchar_t * path, const wchar_t * ident,
|
||||
int cachesize, const wchar_t * path, const wchar_t * texPackPath, const wchar_t * ident,
|
||||
dispInfoFuncExt callback) :
|
||||
_tex1(NULL), _tex2(NULL), _txQuantize(NULL), _txTexCache(NULL), _txHiResCache(NULL), _txUtil(NULL), _txImage(NULL)
|
||||
{
|
||||
|
@ -134,7 +134,7 @@ TxFilter::TxFilter(int maxwidth, int maxheight, int maxbpp, int options,
|
|||
|
||||
/* hires texture */
|
||||
#if HIRES_TEXTURE
|
||||
_txHiResCache = new TxHiResCache(_maxwidth, _maxheight, _maxbpp, _options, _path.c_str(), _ident.c_str(), callback);
|
||||
_txHiResCache = new TxHiResCache(_maxwidth, _maxheight, _maxbpp, _options, _path.c_str(), texPackPath, _ident.c_str(), callback);
|
||||
|
||||
if (_txHiResCache->empty())
|
||||
_options &= ~HIRESTEXTURES_MASK;
|
||||
|
|
|
@ -61,6 +61,7 @@ public:
|
|||
int options,
|
||||
int cachesize,
|
||||
const wchar_t *path,
|
||||
const wchar_t * texPackPath,
|
||||
const wchar_t *ident,
|
||||
dispInfoFuncExt callback);
|
||||
boolean filter(uint8 *src,
|
||||
|
|
|
@ -35,13 +35,13 @@ extern "C"{
|
|||
|
||||
TAPI boolean TAPIENTRY
|
||||
txfilter_init(int maxwidth, int maxheight, int maxbpp, int options, int cachesize,
|
||||
const wchar_t * path, const wchar_t * ident,
|
||||
dispInfoFuncExt callback)
|
||||
const wchar_t * path, const wchar_t * texPackPath, const wchar_t * ident,
|
||||
dispInfoFuncExt callback)
|
||||
{
|
||||
if (txFilter) return 0;
|
||||
|
||||
txFilter = new TxFilter(maxwidth, maxheight, maxbpp, options, cachesize,
|
||||
path, ident, callback);
|
||||
path, texPackPath, ident, callback);
|
||||
|
||||
return (txFilter ? 1 : 0);
|
||||
}
|
||||
|
|
|
@ -71,9 +71,9 @@ TxHiResCache::~TxHiResCache()
|
|||
}
|
||||
|
||||
TxHiResCache::TxHiResCache(int maxwidth, int maxheight, int maxbpp, int options,
|
||||
const wchar_t *path, const wchar_t *ident,
|
||||
dispInfoFuncExt callback
|
||||
) : TxCache((options & ~GZ_TEXCACHE), 0, path, ident, callback)
|
||||
const wchar_t *cachePath, const wchar_t *texPackPath, const wchar_t *ident,
|
||||
dispInfoFuncExt callback
|
||||
) : TxCache((options & ~GZ_TEXCACHE), 0, cachePath, ident, callback)
|
||||
{
|
||||
_txImage = new TxImage();
|
||||
_txQuantize = new TxQuantize();
|
||||
|
@ -85,6 +85,9 @@ TxHiResCache::TxHiResCache(int maxwidth, int maxheight, int maxbpp, int options,
|
|||
_abortLoad = 0;
|
||||
_haveCache = 0;
|
||||
|
||||
if (texPackPath)
|
||||
_texPackPath.assign(texPackPath);
|
||||
|
||||
if (_path.empty() || _ident.empty()) {
|
||||
_options &= ~DUMP_HIRESTEXCACHE;
|
||||
return;
|
||||
|
@ -116,11 +119,11 @@ TxHiResCache::empty()
|
|||
boolean
|
||||
TxHiResCache::load(boolean replace) /* 0 : reload, 1 : replace partial */
|
||||
{
|
||||
if (!_path.empty() && !_ident.empty()) {
|
||||
if (!_texPackPath.empty() && !_ident.empty()) {
|
||||
|
||||
if (!replace) TxCache::clear();
|
||||
|
||||
boost::filesystem::wpath dir_path(_path);
|
||||
boost::filesystem::wpath dir_path(_texPackPath);
|
||||
|
||||
switch (_options & HIRESTEXTURES_MASK) {
|
||||
case GHQ_HIRESTEXTURES:
|
||||
|
@ -137,7 +140,6 @@ TxHiResCache::load(boolean replace) /* 0 : reload, 1 : replace partial */
|
|||
INFO(80, L" usage of only 2) and 3) highly recommended!\n");
|
||||
INFO(80, L" folder names must be in US-ASCII characters!\n");
|
||||
|
||||
dir_path /= boost::filesystem::wpath(L"hires_texture");
|
||||
dir_path /= boost::filesystem::wpath(_ident);
|
||||
loadHiResTextures(dir_path, replace);
|
||||
break;
|
||||
|
|
|
@ -47,12 +47,13 @@ private:
|
|||
TxImage *_txImage;
|
||||
TxQuantize *_txQuantize;
|
||||
TxReSample *_txReSample;
|
||||
std::wstring _texPackPath;
|
||||
boolean loadHiResTextures(boost::filesystem::wpath dir_path, boolean replace);
|
||||
public:
|
||||
~TxHiResCache();
|
||||
TxHiResCache(int maxwidth, int maxheight, int maxbpp, int options,
|
||||
const wchar_t *path, const wchar_t *ident,
|
||||
dispInfoFuncExt callback);
|
||||
const wchar_t *cachePath, const wchar_t *texPackPath, const wchar_t *ident,
|
||||
dispInfoFuncExt callback);
|
||||
boolean empty();
|
||||
boolean load(boolean replace);
|
||||
};
|
||||
|
|
10
OpenGL.cpp
10
OpenGL.cpp
|
@ -1420,13 +1420,21 @@ void TextureFilterHandler::init()
|
|||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
|
||||
wchar_t wRomName[32];
|
||||
::mbstowcs(wRomName, RSP.romname, 32);
|
||||
wchar_t txPath[PLUGIN_PATH_SIZE+16];
|
||||
wchar_t * pTexPackPath = config.textureFilter.txPath;
|
||||
if (::wcslen(config.textureFilter.txPath) == 0) {
|
||||
wcscpy(txPath, RSP.pluginpath);
|
||||
wcscat(txPath, L"/hires_texture");
|
||||
pTexPackPath = txPath;
|
||||
}
|
||||
|
||||
m_inited = txfilter_init(maxTextureSize, // max texture width supported by hardware
|
||||
maxTextureSize, // max texture height supported by hardware
|
||||
32, // max texture bpp supported by hardware
|
||||
options,
|
||||
config.textureFilter.txCacheSize, // cache texture to system memory
|
||||
::wcslen(config.textureFilter.txPath) > 0 ? config.textureFilter.txPath : RSP.pluginpath, // path to texture packs folder
|
||||
RSP.pluginpath, // plugin path
|
||||
pTexPackPath, // path to texture packs folder
|
||||
wRomName, // name of ROM. must be no longer than 256 characters
|
||||
displayLoadProgress);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user