[Glide64] Clean up GlideHQ/TxCache.cpp
This commit is contained in:
parent
612bbb71e5
commit
0ebcf6d608
|
@ -95,7 +95,8 @@ TxCache::add(uint64 checksum, GHQTexInfo *info, int dataSize)
|
||||||
if (compress2(dest, &destLen, info->data, dataSize, 1) != Z_OK) {
|
if (compress2(dest, &destLen, info->data, dataSize, 1) != Z_OK) {
|
||||||
dest = info->data;
|
dest = info->data;
|
||||||
DBG_INFO(80, L"Error: zlib compression failed!\n");
|
DBG_INFO(80, L"Error: zlib compression failed!\n");
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
DBG_INFO(80, L"zlib compressed: %.02fkb->%.02fkb\n", (float)dataSize / 1000, (float)destLen / 1000);
|
DBG_INFO(80, L"zlib compressed: %.02fkb->%.02fkb\n", (float)dataSize / 1000, (float)destLen / 1000);
|
||||||
dataSize = destLen;
|
dataSize = destLen;
|
||||||
format |= GR_TEXFMT_GZ;
|
format |= GR_TEXFMT_GZ;
|
||||||
|
@ -363,14 +364,14 @@ TxCache::load(const wchar_t *path, const wchar_t *filename, int config)
|
||||||
add(checksum, &tmpInfo, (tmpInfo.format & GR_TEXFMT_GZ) ? dataSize : 0);
|
add(checksum, &tmpInfo, (tmpInfo.format & GR_TEXFMT_GZ) ? dataSize : 0);
|
||||||
|
|
||||||
free(tmpInfo.data);
|
free(tmpInfo.data);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
gzseek(gzfp, dataSize, SEEK_CUR);
|
gzseek(gzfp, dataSize, SEEK_CUR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* skip in between to prevent the loop from being tied down to vsync */
|
/* skip in between to prevent the loop from being tied down to vsync */
|
||||||
if (_callback && (!(_cache.size() % 100) || gzeof(gzfp)))
|
if (_callback && (!(_cache.size() % 100) || gzeof(gzfp)))
|
||||||
(*_callback)(L"[%d] total mem:%.02fmb - %ls\n", _cache.size(), (float)_totalSize / 1000000, filename);
|
(*_callback)(L"[%d] total mem:%.02fmb - %ls\n", _cache.size(), (float)_totalSize / 1000000, filename);
|
||||||
|
|
||||||
} while (!gzeof(gzfp));
|
} while (!gzeof(gzfp));
|
||||||
gzclose(gzfp);
|
gzclose(gzfp);
|
||||||
}
|
}
|
||||||
|
@ -386,7 +387,6 @@ TxCache::del(uint64 checksum)
|
||||||
|
|
||||||
std::map<uint64, TXCACHE*>::iterator itMap = _cache.find(checksum);
|
std::map<uint64, TXCACHE*>::iterator itMap = _cache.find(checksum);
|
||||||
if (itMap != _cache.end()) {
|
if (itMap != _cache.end()) {
|
||||||
|
|
||||||
/* for texture cache (not hi-res cache) */
|
/* for texture cache (not hi-res cache) */
|
||||||
if (!_cachelist.empty()) _cachelist.erase(((*itMap).second)->it);
|
if (!_cachelist.empty()) _cachelist.erase(((*itMap).second)->it);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue