[Glide64] Make Hi Res logs use char instead of wchar_t
This commit is contained in:
parent
68a8ed0369
commit
043f0465cb
|
@ -160,7 +160,7 @@ struct GHQTexInfo {
|
|||
* }
|
||||
*/
|
||||
#define INFO_BUF 4095
|
||||
typedef void (*dispInfoFuncExt)(const wchar_t *format, ...);
|
||||
typedef void (*dispInfoFuncExt)(const char *format, ...);
|
||||
|
||||
#ifndef TXFILTER_DLL
|
||||
boolean ext_ghq_init(int maxwidth, /* maximum texture width supported by hardware */
|
||||
|
|
|
@ -103,11 +103,11 @@ TxCache::add(uint64 checksum, GHQTexInfo *info, int dataSize)
|
|||
if (compress2(dest, &destLen, info->data, dataSize, 1) != Z_OK)
|
||||
{
|
||||
dest = info->data;
|
||||
DBG_INFO(80, L"Error: zlib compression failed!\n");
|
||||
DBG_INFO(80, "Error: zlib compression failed!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
DBG_INFO(80, L"zlib compressed: %.02fkb->%.02fkb\n", (float)dataSize / 1000, (float)destLen / 1000);
|
||||
DBG_INFO(80, "zlib compressed: %.02fkb->%.02fkb\n", (float)dataSize / 1000, (float)destLen / 1000);
|
||||
dataSize = destLen;
|
||||
format |= GR_TEXFMT_GZ;
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ TxCache::add(uint64 checksum, GHQTexInfo *info, int dataSize)
|
|||
/* remove from _cachelist */
|
||||
_cachelist.erase(_cachelist.begin(), itList);
|
||||
|
||||
DBG_INFO(80, L"+++++++++\n");
|
||||
DBG_INFO(80, "+++++++++\n");
|
||||
}
|
||||
_totalSize -= dataSize;
|
||||
}
|
||||
|
@ -176,25 +176,25 @@ TxCache::add(uint64 checksum, GHQTexInfo *info, int dataSize)
|
|||
_cache.insert(std::map<uint64, TXCACHE*>::value_type(checksum, txCache));
|
||||
|
||||
#ifdef DEBUG
|
||||
DBG_INFO(80, L"[%5d] added!! crc:%08X %08X %d x %d gfmt:%x total:%.02fmb\n",
|
||||
DBG_INFO(80, "[%5d] added!! crc:%08X %08X %d x %d gfmt:%x total:%.02fmb\n",
|
||||
_cache.size(), (uint32)(checksum >> 32), (uint32)(checksum & 0xffffffff),
|
||||
info->width, info->height, info->format, (float)_totalSize / 1000000);
|
||||
|
||||
DBG_INFO(80, L"smalllodlog2:%d largelodlog2:%d aspectratiolog2:%d\n",
|
||||
DBG_INFO(80, "smalllodlog2:%d largelodlog2:%d aspectratiolog2:%d\n",
|
||||
txCache->info.smallLodLog2, txCache->info.largeLodLog2, txCache->info.aspectRatioLog2);
|
||||
|
||||
if (info->tiles)
|
||||
{
|
||||
DBG_INFO(80, L"tiles:%d un-tiled size:%d x %d\n", info->tiles, info->untiled_width, info->untiled_height);
|
||||
DBG_INFO(80, "tiles:%d un-tiled size:%d x %d\n", info->tiles, info->untiled_width, info->untiled_height);
|
||||
}
|
||||
|
||||
if (_cacheSize > 0)
|
||||
{
|
||||
DBG_INFO(80, L"cache max config:%.02fmb\n", (float)_cacheSize / 1000000);
|
||||
DBG_INFO(80, "cache max config:%.02fmb\n", (float)_cacheSize / 1000000);
|
||||
|
||||
if (_cache.size() != _cachelist.size())
|
||||
{
|
||||
DBG_INFO(80, L"Error: cache/cachelist mismatch! (%d/%d)\n", _cache.size(), _cachelist.size());
|
||||
DBG_INFO(80, "Error: cache/cachelist mismatch! (%d/%d)\n", _cache.size(), _cachelist.size());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -237,12 +237,12 @@ TxCache::get(uint64 checksum, GHQTexInfo *info)
|
|||
uint8 *dest = (_gzdest0 == info->data) ? _gzdest1 : _gzdest0;
|
||||
if (uncompress(dest, &destLen, info->data, ((*itMap).second)->size) != Z_OK)
|
||||
{
|
||||
DBG_INFO(80, L"Error: zlib decompression failed!\n");
|
||||
DBG_INFO(80, "Error: zlib decompression failed!\n");
|
||||
return 0;
|
||||
}
|
||||
info->data = dest;
|
||||
info->format &= ~GR_TEXFMT_GZ;
|
||||
DBG_INFO(80, L"zlib decompressed: %.02fkb->%.02fkb\n", (float)(((*itMap).second)->size) / 1000, (float)destLen / 1000);
|
||||
DBG_INFO(80, "zlib decompressed: %.02fkb->%.02fkb\n", (float)(((*itMap).second)->size) / 1000, (float)destLen / 1000);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ boolean TxCache::save(const char *path, const char *filename, int config)
|
|||
CPath(path, "").DirectoryCreate();
|
||||
|
||||
gzFile gzfp = gzopen(CPath(path, filename), "wb1");
|
||||
DBG_INFO(80, L"gzfp:%x file:%ls\n", gzfp, filename);
|
||||
DBG_INFO(80, "gzfp:%x file:%ls\n", gzfp, filename);
|
||||
if (gzfp)
|
||||
{
|
||||
/* write header to determine config match */
|
||||
|
@ -314,7 +314,7 @@ boolean TxCache::save(const char *path, const char *filename, int config)
|
|||
|
||||
/* not ready yet */
|
||||
/*if (_callback)
|
||||
(*_callback)(L"Total textures saved to HDD: %d\n", std::distance(itMap, _cache.begin()));*/
|
||||
(*_callback)("Total textures saved to HDD: %d\n", std::distance(itMap, _cache.begin()));*/
|
||||
}
|
||||
gzclose(gzfp);
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ boolean TxCache::load(const char *path, const char *filename, int config)
|
|||
CPath cbuf(path, filename);
|
||||
|
||||
gzFile gzfp = gzopen(cbuf, "rb");
|
||||
DBG_INFO(80, L"gzfp:%x file:%ls\n", gzfp, filename);
|
||||
DBG_INFO(80, "gzfp:%x file:%ls\n", gzfp, filename);
|
||||
if (gzfp)
|
||||
{
|
||||
/* yep, we have it. load it into memory cache. */
|
||||
|
@ -380,7 +380,7 @@ boolean TxCache::load(const char *path, const char *filename, int config)
|
|||
|
||||
/* skip in between to prevent the loop from being tied down to vsync */
|
||||
if (_callback && (!(_cache.size() % 100) || gzeof(gzfp)))
|
||||
(*_callback)(L"[%d] total mem:%.02fmb - %ls\n", _cache.size(), (float)_totalSize / 1000000, filename);
|
||||
(*_callback)("[%d] total mem:%.02fmb - %ls\n", _cache.size(), (float)_totalSize / 1000000, filename);
|
||||
} while (!gzeof(gzfp));
|
||||
gzclose(gzfp);
|
||||
}
|
||||
|
@ -404,7 +404,7 @@ boolean TxCache::del(uint64 checksum)
|
|||
delete (*itMap).second;
|
||||
_cache.erase(itMap);
|
||||
|
||||
DBG_INFO(80, L"removed from cache: checksum = %08X %08X\n", (uint32)(checksum & 0xffffffff), (uint32)(checksum >> 32));
|
||||
DBG_INFO(80, "removed from cache: checksum = %08X %08X\n", (uint32)(checksum & 0xffffffff), (uint32)(checksum >> 32));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -28,18 +28,26 @@
|
|||
#include <stdarg.h>
|
||||
#include <Common/StdString.h>
|
||||
#include <Common/path.h>
|
||||
#include <Glide64/Config.h>
|
||||
#include <Settings/Settings.h>
|
||||
|
||||
TxDbg::TxDbg()
|
||||
{
|
||||
|
||||
char log_dir[260];
|
||||
memset(log_dir, 0, sizeof(log_dir));
|
||||
if (Set_log_dir != 0)
|
||||
{
|
||||
GetSystemSettingSz(Set_log_dir, log_dir, sizeof(log_dir));
|
||||
}
|
||||
|
||||
_level = DBG_LEVEL;
|
||||
CPath Dir(CPath::MODULE_DIRECTORY, "");
|
||||
Dir.AppendDirectory("Logs");
|
||||
|
||||
if (!_dbgfile)
|
||||
#ifdef GHQCHK
|
||||
_dbgfile = fopen(CPath(Dir,"ghqchk.txt"), "w");
|
||||
_dbgfile = fopen(CPath(log_dir, "ghqchk.txt"), "w");
|
||||
#else
|
||||
_dbgfile = fopen(CPath((LPCSTR)Dir, "glidehq.dbg"), "w");
|
||||
_dbgfile = fopen(CPath((LPCSTR)log_dir, "glidehq.dbg"), "w");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -54,16 +62,16 @@ TxDbg::~TxDbg()
|
|||
}
|
||||
|
||||
void
|
||||
TxDbg::output(const int level, const wchar_t *format, ...)
|
||||
TxDbg::output(const int level, const char *format, ...)
|
||||
{
|
||||
if (level > _level)
|
||||
return;
|
||||
|
||||
stdstr_f newformat("%d:\t%s", level, stdstr().FromUTF16(format).c_str());
|
||||
stdstr_f newformat("%d:\t%s", level, format);
|
||||
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vfwprintf(_dbgfile, newformat.ToUTF16().c_str(), args);
|
||||
vfprintf(_dbgfile, newformat.c_str(), args);
|
||||
fflush(_dbgfile);
|
||||
va_end(args);
|
||||
}
|
|
@ -39,7 +39,7 @@ public:
|
|||
return &txDbg;
|
||||
}
|
||||
~TxDbg();
|
||||
void output(const int level, const wchar_t *format, ...);
|
||||
void output(const int level, const char *format, ...);
|
||||
};
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
|
@ -82,18 +82,18 @@ TxFilter::TxFilter(int maxwidth, int maxheight, int maxbpp, int options,
|
|||
|
||||
/* shamelessness :P this first call to the debug output message creates
|
||||
* a file in the executable directory. */
|
||||
INFO(0, L"------------------------------------------------------------------\n");
|
||||
INFO(0, "------------------------------------------------------------------\n");
|
||||
#ifdef GHQCHK
|
||||
INFO(0, L" GlideHQ Hires Texture Checker 1.02.00.%d\n", 0);
|
||||
INFO(0, " GlideHQ Hires Texture Checker 1.02.00.%d\n", 0);
|
||||
#else
|
||||
INFO(0, L" GlideHQ version 1.02.00.%d\n", 0);
|
||||
INFO(0, " GlideHQ version 1.02.00.%d\n", 0);
|
||||
#endif
|
||||
INFO(0, L" Copyright (C) 2010 Hiroshi Morii All Rights Reserved\n");
|
||||
INFO(0, L" email : koolsmoky(at)users.sourceforge.net\n");
|
||||
INFO(0, L" website : http://www.3dfxzone.it/koolsmoky\n");
|
||||
INFO(0, L"\n");
|
||||
INFO(0, L" Glide64 official website : http://glide64.emuxhaven.net\n");
|
||||
INFO(0, L"------------------------------------------------------------------\n");
|
||||
INFO(0, " Copyright (C) 2010 Hiroshi Morii All Rights Reserved\n");
|
||||
INFO(0, " email : koolsmoky(at)users.sourceforge.net\n");
|
||||
INFO(0, " website : http://www.3dfxzone.it/koolsmoky\n");
|
||||
INFO(0, "\n");
|
||||
INFO(0, " Glide64 official website : http://glide64.emuxhaven.net\n");
|
||||
INFO(0, "------------------------------------------------------------------\n");
|
||||
|
||||
_options = options;
|
||||
|
||||
|
@ -189,14 +189,14 @@ TxFilter::filter(uint8 *src, int srcwidth, int srcheight, uint16 srcformat, uint
|
|||
if (!g64crc)
|
||||
g64crc = (uint64)(_txUtil->checksumTx(texture, srcwidth, srcheight, srcformat));
|
||||
|
||||
DBG_INFO(80, L"filter: crc:%08X %08X %d x %d gfmt:%x\n",
|
||||
DBG_INFO(80, "filter: crc:%08X %08X %d x %d gfmt:%x\n",
|
||||
(uint32)(g64crc >> 32), (uint32)(g64crc & 0xffffffff), srcwidth, srcheight, srcformat);
|
||||
|
||||
#if 0 /* use hirestex to retrieve cached textures. */
|
||||
/* check if we have it in cache */
|
||||
if (!(g64crc & 0xffffffff00000000) && /* we reach here only when there is no hires texture for this crc */
|
||||
_txTexCache->get(g64crc, info)) {
|
||||
DBG_INFO(80, L"cache hit: %d x %d gfmt:%x\n", info->width, info->height, info->format);
|
||||
DBG_INFO(80, "cache hit: %d x %d gfmt:%x\n", info->width, info->height, info->format);
|
||||
return 1; /* yep, we've got it */
|
||||
}
|
||||
#endif
|
||||
|
@ -215,7 +215,7 @@ TxFilter::filter(uint8 *src, int srcwidth, int srcheight, uint16 srcformat, uint
|
|||
#endif
|
||||
if (srcformat != GR_TEXFMT_ARGB_8888) {
|
||||
if (!_txQuantize->quantize(texture, tmptex, srcwidth, srcheight, srcformat, GR_TEXFMT_ARGB_8888)) {
|
||||
DBG_INFO(80, L"Error: unsupported format! gfmt:%x\n", srcformat);
|
||||
DBG_INFO(80, "Error: unsupported format! gfmt:%x\n", srcformat);
|
||||
return 0;
|
||||
}
|
||||
texture = tmptex;
|
||||
|
@ -336,7 +336,7 @@ TxFilter::filter(uint8 *src, int srcwidth, int srcheight, uint16 srcformat, uint
|
|||
if (srcformat != GR_TEXFMT_ARGB_8888) {
|
||||
tmptex = (texture == _tex1) ? _tex2 : _tex1;
|
||||
if (!_txQuantize->quantize(texture, tmptex, srcwidth, srcheight, GR_TEXFMT_ARGB_8888, srcformat)) {
|
||||
DBG_INFO(80, L"Error: unsupported format! gfmt:%x\n", srcformat);
|
||||
DBG_INFO(80, "Error: unsupported format! gfmt:%x\n", srcformat);
|
||||
return 0;
|
||||
}
|
||||
texture = tmptex;
|
||||
|
@ -437,7 +437,7 @@ TxFilter::filter(uint8 *src, int srcwidth, int srcheight, uint16 srcformat, uint
|
|||
/* cache the texture. */
|
||||
if (_cacheSize) _txTexCache->add(g64crc, info);
|
||||
|
||||
DBG_INFO(80, L"filtered texture: %d x %d gfmt:%x\n", info->width, info->height, info->format);
|
||||
DBG_INFO(80, "filtered texture: %d x %d gfmt:%x\n", info->width, info->height, info->format);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -455,7 +455,7 @@ TxFilter::hirestex(uint64 g64crc, uint64 r_crc64, uint16 *palette, GHQTexInfo *i
|
|||
* (can be any other crc if robust)
|
||||
*/
|
||||
|
||||
DBG_INFO(80, L"hirestex: r_crc64:%08X %08X, g64crc:%08X %08X\n",
|
||||
DBG_INFO(80, "hirestex: r_crc64:%08X %08X, g64crc:%08X %08X\n",
|
||||
(uint32)(r_crc64 >> 32), (uint32)(r_crc64 & 0xffffffff),
|
||||
(uint32)(g64crc >> 32), (uint32)(g64crc & 0xffffffff));
|
||||
|
||||
|
@ -463,7 +463,7 @@ TxFilter::hirestex(uint64 g64crc, uint64 r_crc64, uint16 *palette, GHQTexInfo *i
|
|||
/* check if we have it in hires memory cache. */
|
||||
if ((_options & HIRESTEXTURES_MASK) && r_crc64) {
|
||||
if (_txHiResCache->get(r_crc64, info)) {
|
||||
DBG_INFO(80, L"hires hit: %d x %d gfmt:%x\n", info->width, info->height, info->format);
|
||||
DBG_INFO(80, "hires hit: %d x %d gfmt:%x\n", info->width, info->height, info->format);
|
||||
|
||||
/* TODO: Enable emulation for special N64 combiner modes. There are few ways
|
||||
* to get this done. Also applies for CI textures below.
|
||||
|
@ -490,7 +490,7 @@ TxFilter::hirestex(uint64 g64crc, uint64 r_crc64, uint16 *palette, GHQTexInfo *i
|
|||
return 1; /* yep, got it */
|
||||
}
|
||||
if (_txHiResCache->get((r_crc64 & 0xffffffff), info)) {
|
||||
DBG_INFO(80, L"hires hit: %d x %d gfmt:%x\n", info->width, info->height, info->format);
|
||||
DBG_INFO(80, "hires hit: %d x %d gfmt:%x\n", info->width, info->height, info->format);
|
||||
|
||||
/* for true CI textures, we use the passed in palette to convert to
|
||||
* ARGB1555 and add it to memory cache.
|
||||
|
@ -502,7 +502,7 @@ TxFilter::hirestex(uint64 g64crc, uint64 r_crc64, uint16 *palette, GHQTexInfo *i
|
|||
* A comp comes before RGB comp.
|
||||
*/
|
||||
if (palette && info->format == GR_TEXFMT_P_8) {
|
||||
DBG_INFO(80, L"found GR_TEXFMT_P_8 format. Need conversion!!\n");
|
||||
DBG_INFO(80, "found GR_TEXFMT_P_8 format. Need conversion!!\n");
|
||||
|
||||
int width = info->width;
|
||||
int height = info->height;
|
||||
|
@ -534,7 +534,7 @@ TxFilter::hirestex(uint64 g64crc, uint64 r_crc64, uint16 *palette, GHQTexInfo *i
|
|||
}
|
||||
else {
|
||||
/*if (!_txQuantize->quantize(texture, tmptex, info->width, info->height, GR_TEXFMT_ARGB_8888, GR_TEXFMT_ARGB_1555)) {
|
||||
DBG_INFO(80, L"Error: unsupported format! gfmt:%x\n", format);
|
||||
DBG_INFO(80, "Error: unsupported format! gfmt:%x\n", format);
|
||||
return 0;
|
||||
}*/
|
||||
texture = tmptex;
|
||||
|
@ -557,7 +557,7 @@ TxFilter::hirestex(uint64 g64crc, uint64 r_crc64, uint16 *palette, GHQTexInfo *i
|
|||
/* XXX: add to hires texture cache!!! */
|
||||
_txHiResCache->add(r_crc64, info);
|
||||
|
||||
DBG_INFO(80, L"GR_TEXFMT_P_8 loaded as gfmt:%x!\n", format);
|
||||
DBG_INFO(80, "GR_TEXFMT_P_8 loaded as gfmt:%x!\n", format);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -570,12 +570,12 @@ TxFilter::hirestex(uint64 g64crc, uint64 r_crc64, uint16 *palette, GHQTexInfo *i
|
|||
{
|
||||
if (_txTexCache->get(g64crc, info))
|
||||
{
|
||||
DBG_INFO(80, L"cache hit: %d x %d gfmt:%x\n", info->width, info->height, info->format);
|
||||
DBG_INFO(80, "cache hit: %d x %d gfmt:%x\n", info->width, info->height, info->format);
|
||||
return 1; /* yep, we've got it */
|
||||
}
|
||||
}
|
||||
|
||||
DBG_INFO(80, L"no cache hits.\n");
|
||||
DBG_INFO(80, "no cache hits.\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -601,8 +601,8 @@ TxFilter::dmptx(uint8 *src, int width, int height, int rowStridePixel, uint16 gf
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
DBG_INFO(80, L"gfmt = %02x n64fmt = %02x\n", gfmt, n64fmt);
|
||||
DBG_INFO(80, L"hirestex: r_crc64:%08X %08X\n",
|
||||
DBG_INFO(80, "gfmt = %02x n64fmt = %02x\n", gfmt, n64fmt);
|
||||
DBG_INFO(80, "hirestex: r_crc64:%08X %08X\n",
|
||||
(uint32)(r_crc64 >> 32), (uint32)(r_crc64 & 0xffffffff));
|
||||
|
||||
if (!_txQuantize->quantize(src, _tex1, rowStridePixel, height, (gfmt & 0x00ff), GR_TEXFMT_ARGB_8888))
|
||||
|
@ -659,7 +659,7 @@ TxFilter::dmptx(uint8 *src, int width, int height, int rowStridePixel, uint16 gf
|
|||
|
||||
boolean TxFilter::reloadhirestex()
|
||||
{
|
||||
DBG_INFO(80, L"Reload hires textures from texture pack.\n");
|
||||
DBG_INFO(80, "Reload hires textures from texture pack.\n");
|
||||
|
||||
if (_txHiResCache->load(0)) {
|
||||
if (_txHiResCache->empty()) _options &= ~HIRESTEXTURES_MASK;
|
||||
|
|
|
@ -149,16 +149,16 @@ TxHiResCache::load(boolean replace) /* 0 : reload, 1 : replace partial */
|
|||
case GHQ_HIRESTEXTURES:
|
||||
break;
|
||||
case RICE_HIRESTEXTURES:
|
||||
INFO(80, L"-----\n");
|
||||
INFO(80, L"using Rice hires texture format...\n");
|
||||
INFO(80, L" must be one of the following;\n");
|
||||
INFO(80, L" 1) *_rgb.png + *_a.png\n");
|
||||
INFO(80, L" 2) *_all.png\n");
|
||||
INFO(80, L" 3) *_ciByRGBA.png\n");
|
||||
INFO(80, L" 4) *_allciByRGBA.png\n");
|
||||
INFO(80, L" 5) *_ci.bmp\n");
|
||||
INFO(80, L" usage of only 2) and 3) highly recommended!\n");
|
||||
INFO(80, L" folder names must be in US-ASCII characters!\n");
|
||||
INFO(80, "-----\n");
|
||||
INFO(80, "using Rice hires texture format...\n");
|
||||
INFO(80, " must be one of the following;\n");
|
||||
INFO(80, " 1) *_rgb.png + *_a.png\n");
|
||||
INFO(80, " 2) *_all.png\n");
|
||||
INFO(80, " 3) *_ciByRGBA.png\n");
|
||||
INFO(80, " 4) *_allciByRGBA.png\n");
|
||||
INFO(80, " 5) *_ci.bmp\n");
|
||||
INFO(80, " usage of only 2) and 3) highly recommended!\n");
|
||||
INFO(80, " folder names must be in US-ASCII characters!\n");
|
||||
|
||||
dir_path.AppendDirectory(_ident.c_str());
|
||||
loadHiResTextures(dir_path, replace);
|
||||
|
@ -175,15 +175,15 @@ TxHiResCache::load(boolean replace) /* 0 : reload, 1 : replace partial */
|
|||
boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
DBG_INFO(80, L"-----\n");
|
||||
DBG_INFO(80, L"path: %s\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
DBG_INFO(80, "-----\n");
|
||||
DBG_INFO(80, "path: %s\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
|
||||
CPath TextureDir(dir_path, "");
|
||||
|
||||
/* find it on disk */
|
||||
if (!TextureDir.DirectoryExists())
|
||||
{
|
||||
INFO(80, L"Error: path not found!\n");
|
||||
INFO(80, "Error: path not found!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -205,13 +205,13 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
if (KBHIT(0x1B))
|
||||
{
|
||||
_abortLoad = 1;
|
||||
if (_callback) (*_callback)(L"Aborted loading hiresolution texture!\n");
|
||||
INFO(80, L"Error: aborted loading hiresolution texture!\n");
|
||||
if (_callback) (*_callback)("Aborted loading hiresolution texture!\n");
|
||||
INFO(80, "Error: aborted loading hiresolution texture!\n");
|
||||
}
|
||||
if (_abortLoad) break;
|
||||
|
||||
DBG_INFO(80, L"-----\n");
|
||||
DBG_INFO(80, L"file: %ls\n", stdstr(TextureDir.GetNameExtension().c_str()).ToUTF16().c_str());
|
||||
DBG_INFO(80, "-----\n");
|
||||
DBG_INFO(80, "file: %ls\n", stdstr(TextureDir.GetNameExtension().c_str()).ToUTF16().c_str());
|
||||
|
||||
int width = 0, height = 0;
|
||||
uint16 format = 0;
|
||||
|
@ -260,11 +260,11 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
pfname == strstr(fname, ".dds")))
|
||||
{
|
||||
#if !DEBUG
|
||||
INFO(80, L"-----\n");
|
||||
INFO(80, L"path: %ls\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
INFO(80, L"file: %ls\n", TextureDir.GetNameExtension().ToUTF16().c_str());
|
||||
INFO(80, "-----\n");
|
||||
INFO(80, "path: %ls\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
INFO(80, "file: %ls\n", TextureDir.GetNameExtension().ToUTF16().c_str());
|
||||
#endif
|
||||
INFO(80, L"Error: not png or bmp or dds!\n");
|
||||
INFO(80, "Error: not png or bmp or dds!\n");
|
||||
continue;
|
||||
}
|
||||
pfname = strstr(fname, ident.c_str());
|
||||
|
@ -279,20 +279,20 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
}
|
||||
if (!pfname) {
|
||||
#if !DEBUG
|
||||
INFO(80, L"-----\n");
|
||||
INFO(80, L"path: %ls\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
INFO(80, L"file: %ls\n", TextureDir.GetNameExtension().ToUTF16().c_str());
|
||||
INFO(80, "-----\n");
|
||||
INFO(80, "path: %ls\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
INFO(80, "file: %ls\n", TextureDir.GetNameExtension().ToUTF16().c_str());
|
||||
#endif
|
||||
INFO(80, L"Error: not Rice texture naming convention!\n");
|
||||
INFO(80, "Error: not Rice texture naming convention!\n");
|
||||
continue;
|
||||
}
|
||||
if (!chksum) {
|
||||
#if !DEBUG
|
||||
INFO(80, L"-----\n");
|
||||
INFO(80, L"path: %ls\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
INFO(80, L"file: %ls\n", TextureDir.GetNameExtension().ToUTF16().c_str());
|
||||
INFO(80, "-----\n");
|
||||
INFO(80, "path: %ls\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
INFO(80, "file: %ls\n", TextureDir.GetNameExtension().ToUTF16().c_str());
|
||||
#endif
|
||||
INFO(80, L"Error: crc32 = 0!\n");
|
||||
INFO(80, "Error: crc32 = 0!\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -303,16 +303,16 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
chksum64 |= (uint64)chksum;
|
||||
if (TxCache::is_cached(chksum64)) {
|
||||
#if !DEBUG
|
||||
INFO(80, L"-----\n");
|
||||
INFO(80, L"path: %ls\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
INFO(80, L"file: %ls\n", TextureDir.GetNameExtension().ToUTF16().c_str());
|
||||
INFO(80, "-----\n");
|
||||
INFO(80, "path: %ls\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
INFO(80, "file: %ls\n", TextureDir.GetNameExtension().ToUTF16().c_str());
|
||||
#endif
|
||||
INFO(80, L"Error: already cached! duplicate texture!\n");
|
||||
INFO(80, "Error: already cached! duplicate texture!\n");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
DBG_INFO(80, L"rom: %ls chksum:%08X %08X fmt:%x size:%x\n", _ident.c_str(), chksum, palchksum, fmt, siz);
|
||||
DBG_INFO(80, "rom: %ls chksum:%08X %08X fmt:%x size:%x\n", _ident.c_str(), chksum, palchksum, fmt, siz);
|
||||
|
||||
/* Deal with the wackiness some texture packs utilize Rice format.
|
||||
* Read in the following order: _a.* + _rgb.*, _all.png _ciByRGBA.png,
|
||||
|
@ -343,11 +343,11 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
if (!TargetFile.Exists())
|
||||
{
|
||||
#if !DEBUG
|
||||
INFO(80, L"-----\n");
|
||||
INFO(80, L"path: %ls\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
INFO(80, L"file: %ls\n", TextureDir.GetNameExtension().ToUTF16().c_str());
|
||||
INFO(80, "-----\n");
|
||||
INFO(80, "path: %ls\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
INFO(80, "file: %ls\n", TextureDir.GetNameExtension().ToUTF16().c_str());
|
||||
#endif
|
||||
INFO(80, L"Error: missing _rgb.*! _a.* must be paired with _rgb.*!\n");
|
||||
INFO(80, "Error: missing _rgb.*! _a.* must be paired with _rgb.*!\n");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -388,18 +388,18 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
if (!tex || width != tmpwidth || height != tmpheight ||
|
||||
format != GR_TEXFMT_ARGB_8888 || tmpformat != GR_TEXFMT_ARGB_8888) {
|
||||
#if !DEBUG
|
||||
INFO(80, L"-----\n");
|
||||
INFO(80, L"path: %ls\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
INFO(80, L"file: %ls\n", TextureDir.GetNameExtension().ToUTF16().c_str());
|
||||
INFO(80, "-----\n");
|
||||
INFO(80, "path: %ls\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
INFO(80, "file: %ls\n", TextureDir.GetNameExtension().ToUTF16().c_str());
|
||||
#endif
|
||||
if (!tex) {
|
||||
INFO(80, L"Error: missing _rgb.*!\n");
|
||||
INFO(80, "Error: missing _rgb.*!\n");
|
||||
}
|
||||
else if (width != tmpwidth || height != tmpheight) {
|
||||
INFO(80, L"Error: _rgb.* and _a.* have mismatched width or height!\n");
|
||||
INFO(80, "Error: _rgb.* and _a.* have mismatched width or height!\n");
|
||||
}
|
||||
else if (format != GR_TEXFMT_ARGB_8888 || tmpformat != GR_TEXFMT_ARGB_8888) {
|
||||
INFO(80, L"Error: _rgb.* or _a.* not in 32bit color!\n");
|
||||
INFO(80, "Error: _rgb.* or _a.* not in 32bit color!\n");
|
||||
}
|
||||
if (tex) free(tex);
|
||||
if (tmptex) free(tmptex);
|
||||
|
@ -412,7 +412,7 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
if (tex) {
|
||||
if (tmptex) {
|
||||
/* merge (A)RGB and A comp */
|
||||
DBG_INFO(80, L"merge (A)RGB and A comp\n");
|
||||
DBG_INFO(80, "merge (A)RGB and A comp\n");
|
||||
int i;
|
||||
for (i = 0; i < height * width; i++) {
|
||||
#if 1
|
||||
|
@ -443,11 +443,11 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
else {
|
||||
/* clobber A comp. never a question of alpha. only RGB used. */
|
||||
#if !DEBUG
|
||||
INFO(80, L"-----\n");
|
||||
INFO(80, L"path: %ls\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
INFO(80, L"file: %ls\n", TextureDir.GetNameExtension().ToUTF16().c_str());
|
||||
INFO(80, "-----\n");
|
||||
INFO(80, "path: %ls\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
INFO(80, "file: %ls\n", TextureDir.GetNameExtension().ToUTF16().c_str());
|
||||
#endif
|
||||
INFO(80, L"Warning: missing _a.*! only using _rgb.*. treat as opaque texture.\n");
|
||||
INFO(80, "Warning: missing _a.*! only using _rgb.*. treat as opaque texture.\n");
|
||||
int i;
|
||||
for (i = 0; i < height * width; i++) {
|
||||
((uint32*)tex)[i] |= 0xff000000;
|
||||
|
@ -492,11 +492,11 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
free(tex);
|
||||
tex = NULL;
|
||||
#if !DEBUG
|
||||
INFO(80, L"-----\n");
|
||||
INFO(80, L"path: %ls\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
INFO(80, L"file: %ls\n", TextureDir.GetNameExtension().ToUTF16().c_str());
|
||||
INFO(80, "-----\n");
|
||||
INFO(80, "path: %ls\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
INFO(80, "file: %ls\n", TextureDir.GetNameExtension().ToUTF16().c_str());
|
||||
#endif
|
||||
INFO(80, L"Error: W:H aspect ratio range not 8:1 - 1:8!\n");
|
||||
INFO(80, "Error: W:H aspect ratio range not 8:1 - 1:8!\n");
|
||||
continue;
|
||||
}
|
||||
if (width != _txReSample->nextPow2(width) ||
|
||||
|
@ -504,11 +504,11 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
free(tex);
|
||||
tex = NULL;
|
||||
#if !DEBUG
|
||||
INFO(80, L"-----\n");
|
||||
INFO(80, L"path: %ls\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
INFO(80, L"file: %ls\n", TextureDir.GetNameExtension().ToUTF16().c_str());
|
||||
INFO(80, "-----\n");
|
||||
INFO(80, "path: %ls\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
INFO(80, "file: %ls\n", TextureDir.GetNameExtension().ToUTF16().c_str());
|
||||
#endif
|
||||
INFO(80, L"Error: not power of 2 size!\n");
|
||||
INFO(80, "Error: not power of 2 size!\n");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -517,14 +517,14 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
/* if we do not have a texture at this point we are screwed */
|
||||
if (!tex) {
|
||||
#if !DEBUG
|
||||
INFO(80, L"-----\n");
|
||||
INFO(80, L"path: %ls\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
INFO(80, L"file: %ls\n", TextureDir.GetNameExtension().ToUTF16().c_str());
|
||||
INFO(80, "-----\n");
|
||||
INFO(80, "path: %ls\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
INFO(80, "file: %ls\n", TextureDir.GetNameExtension().ToUTF16().c_str());
|
||||
#endif
|
||||
INFO(80, L"Error: load failed!\n");
|
||||
INFO(80, "Error: load failed!\n");
|
||||
continue;
|
||||
}
|
||||
DBG_INFO(80, L"read in as %d x %d gfmt:%x\n", tmpwidth, tmpheight, tmpformat);
|
||||
DBG_INFO(80, "read in as %d x %d gfmt:%x\n", tmpwidth, tmpheight, tmpformat);
|
||||
|
||||
/* check if size and format are OK */
|
||||
if (!(format == GR_TEXFMT_ARGB_8888 ||
|
||||
|
@ -536,11 +536,11 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
free(tex);
|
||||
tex = NULL;
|
||||
#if !DEBUG
|
||||
INFO(80, L"-----\n");
|
||||
INFO(80, L"path: %ls\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
INFO(80, L"file: %ls\n", TextureDir.GetNameExtension().ToUTF16().c_str());
|
||||
INFO(80, "-----\n");
|
||||
INFO(80, "path: %ls\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
INFO(80, "file: %ls\n", TextureDir.GetNameExtension().ToUTF16().c_str());
|
||||
#endif
|
||||
INFO(80, L"Error: not width * height > 4 or 8bit palette color or 32bpp or dxt1 or dxt3 or dxt5!\n");
|
||||
INFO(80, "Error: not width * height > 4 or 8bit palette color or 32bpp or dxt1 or dxt3 or dxt5!\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -560,7 +560,7 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
* meter. The same goes for fmt:2 textures. See Mollymutt's
|
||||
* PaperMario text. */
|
||||
if ((fmt == 0 && siz == 2) || fmt == 2) {
|
||||
DBG_INFO(80, L"Remove black, white, etc borders along the alpha edges.\n");
|
||||
DBG_INFO(80, "Remove black, white, etc borders along the alpha edges.\n");
|
||||
/* round A comp */
|
||||
for (i = 0; i < height * width; i++) {
|
||||
uint32 texel = ((uint32*)tex)[i];
|
||||
|
@ -647,7 +647,7 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
}
|
||||
if (!intensity && alphabits == 8) break;
|
||||
}
|
||||
DBG_INFO(80, L"required alpha bits:%d zero acomp texels:%d rgb as intensity:%d\n", alphabits, fullalpha, intensity);
|
||||
DBG_INFO(80, "required alpha bits:%d zero acomp texels:%d rgb as intensity:%d\n", alphabits, fullalpha, intensity);
|
||||
|
||||
/* preparations based on above analysis */
|
||||
#if !REDUCE_TEXTURE_FOOTPRINT
|
||||
|
@ -683,7 +683,7 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
}
|
||||
}
|
||||
|
||||
DBG_INFO(80, L"best gfmt:%x\n", destformat);
|
||||
DBG_INFO(80, "best gfmt:%x\n", destformat);
|
||||
}
|
||||
/*
|
||||
* Rice hi-res textures: end */
|
||||
|
@ -706,26 +706,26 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
/* minification to enable glide64 style texture tiling */
|
||||
/* determine the minification ratio to tile the texture into 256x256 size */
|
||||
if ((_options & TILE_HIRESTEX) && _maxwidth >= 256 && _maxheight >= 256) {
|
||||
DBG_INFO(80, L"determine minification ratio to tile\n");
|
||||
DBG_INFO(80, "determine minification ratio to tile\n");
|
||||
tmpwidth = width;
|
||||
tmpheight = height;
|
||||
if (height > 256) {
|
||||
ratio = ((height - 1) >> 8) + 1;
|
||||
tmpwidth = width / ratio;
|
||||
tmpheight = height / ratio;
|
||||
DBG_INFO(80, L"height > 256, minification ratio:%d %d x %d -> %d x %d\n",
|
||||
DBG_INFO(80, "height > 256, minification ratio:%d %d x %d -> %d x %d\n",
|
||||
ratio, width, height, tmpwidth, tmpheight);
|
||||
}
|
||||
if (tmpwidth > 256 && (((tmpwidth - 1) >> 8) + 1) * tmpheight > 256) {
|
||||
ratio *= ((((((tmpwidth - 1) >> 8) + 1) * tmpheight) - 1) >> 8) + 1;
|
||||
DBG_INFO(80, L"width > 256, minification ratio:%d %d x %d -> %d x %d\n",
|
||||
DBG_INFO(80, "width > 256, minification ratio:%d %d x %d -> %d x %d\n",
|
||||
ratio, width, height, width / ratio, height / ratio);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* normal minification to fit max texture size */
|
||||
if (width > _maxwidth || height > _maxheight) {
|
||||
DBG_INFO(80, L"determine minification ratio to fit max texture size\n");
|
||||
DBG_INFO(80, "determine minification ratio to fit max texture size\n");
|
||||
tmpwidth = width;
|
||||
tmpheight = height;
|
||||
while (tmpwidth > _maxwidth) {
|
||||
|
@ -738,7 +738,7 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
tmpwidth >>= 1;
|
||||
ratio <<= 1;
|
||||
}
|
||||
DBG_INFO(80, L"minification ratio:%d %d x %d -> %d x %d\n",
|
||||
DBG_INFO(80, "minification ratio:%d %d x %d -> %d x %d\n",
|
||||
ratio, width, height, tmpwidth, tmpheight);
|
||||
}
|
||||
}
|
||||
|
@ -747,7 +747,7 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
if (!_txReSample->minify(&tex, &width, &height, ratio)) {
|
||||
free(tex);
|
||||
tex = NULL;
|
||||
DBG_INFO(80, L"Error: minification failed!\n");
|
||||
DBG_INFO(80, "Error: minification failed!\n");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -796,7 +796,7 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
|
||||
/* tile it! do the actual tiling into 256x256 size */
|
||||
if (usetile) {
|
||||
DBG_INFO(80, L"Glide64 style texture tiling\n");
|
||||
DBG_INFO(80, "Glide64 style texture tiling\n");
|
||||
|
||||
int x, y, z, ratio, offset;
|
||||
offset = 0;
|
||||
|
@ -825,7 +825,7 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
untiled_height = height;
|
||||
width = 256;
|
||||
height *= ratio;
|
||||
DBG_INFO(80, L"Tiled: %d x %d -> %d x %d\n", untiled_width, untiled_height, width, height);
|
||||
DBG_INFO(80, "Tiled: %d x %d -> %d x %d\n", untiled_width, untiled_height, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -843,7 +843,7 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
if (!_txReSample->minify(&tex, &width, &height, ratio)) {
|
||||
free(tex);
|
||||
tex = NULL;
|
||||
DBG_INFO(80, L"Error: minification failed!\n");
|
||||
DBG_INFO(80, "Error: minification failed!\n");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -876,7 +876,7 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
#endif
|
||||
free(tex);
|
||||
tex = NULL;
|
||||
DBG_INFO(80, L"Error: aspect ratio adjustment failed!\n");
|
||||
DBG_INFO(80, "Error: aspect ratio adjustment failed!\n");
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
@ -960,7 +960,7 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
#endif
|
||||
free(tex);
|
||||
tex = NULL;
|
||||
DBG_INFO(80, L"Error: aspect ratio adjustment failed!\n");
|
||||
DBG_INFO(80, "Error: aspect ratio adjustment failed!\n");
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
@ -1016,17 +1016,17 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
/* last minute validations */
|
||||
if (!tex || !chksum || !width || !height || !format || width > _maxwidth || height > _maxheight) {
|
||||
#if !DEBUG
|
||||
INFO(80, L"-----\n");
|
||||
INFO(80, L"path: %ls\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
INFO(80, L"file: %ls\n", TextureDir.GetNameExtension().ToUTF16().c_str());
|
||||
INFO(80, "-----\n");
|
||||
INFO(80, "path: %ls\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
INFO(80, "file: %ls\n", TextureDir.GetNameExtension().ToUTF16().c_str());
|
||||
#endif
|
||||
if (tex) {
|
||||
free(tex);
|
||||
tex = NULL;
|
||||
INFO(80, L"Error: bad format or size! %d x %d gfmt:%x\n", width, height, format);
|
||||
INFO(80, "Error: bad format or size! %d x %d gfmt:%x\n", width, height, format);
|
||||
}
|
||||
else {
|
||||
INFO(80, L"Error: load failed!!\n");
|
||||
INFO(80, "Error: load failed!!\n");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -1060,7 +1060,7 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
|
||||
/* remove redundant in cache */
|
||||
if (replace && TxCache::del(chksum64)) {
|
||||
DBG_INFO(80, L"removed duplicate old cache.\n");
|
||||
DBG_INFO(80, "removed duplicate old cache.\n");
|
||||
}
|
||||
|
||||
/* add to cache */
|
||||
|
@ -1070,9 +1070,9 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
if (_callback) {
|
||||
wchar_t tmpbuf[MAX_PATH];
|
||||
mbstowcs(tmpbuf, fname, MAX_PATH);
|
||||
(*_callback)(L"[%d] total mem:%.2fmb - %ls\n", _cache.size(), (float)_totalSize / 1000000, tmpbuf);
|
||||
(*_callback)("[%d] total mem:%.2fmb - %ls\n", _cache.size(), (float)_totalSize / 1000000, tmpbuf);
|
||||
}
|
||||
DBG_INFO(80, L"texture loaded!\n");
|
||||
DBG_INFO(80, "texture loaded!\n");
|
||||
}
|
||||
free(tex);
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ TxImage::getPNGInfo(FILE *fp, png_structp *png_ptr, png_infop *info_ptr)
|
|||
}
|
||||
|
||||
if (setjmp(png_jmpbuf(*png_ptr))) {
|
||||
DBG_INFO(80, L"error reading png!\n");
|
||||
DBG_INFO(80, "error reading png!\n");
|
||||
png_destroy_read_struct(png_ptr, info_ptr, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
@ -93,8 +93,9 @@ TxImage::readPNG(FILE* fp, int* width, int* height, uint16* format)
|
|||
if (!fp)
|
||||
return NULL;
|
||||
|
||||
if (!getPNGInfo(fp, &png_ptr, &info_ptr)) {
|
||||
INFO(80, L"error reading png file! png image is corrupt.\n");
|
||||
if (!getPNGInfo(fp, &png_ptr, &info_ptr))
|
||||
{
|
||||
INFO(80, "error reading png file! png image is corrupt.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -102,7 +103,7 @@ TxImage::readPNG(FILE* fp, int* width, int* height, uint16* format)
|
|||
(png_uint_32*)&o_width, (png_uint_32*)&o_height, &bit_depth, &color_type,
|
||||
&interlace_type, &compression_type, &filter_type);
|
||||
|
||||
DBG_INFO(80, L"png format %d x %d bitdepth:%d color:%x interlace:%x compression:%x filter:%x\n",
|
||||
DBG_INFO(80, "png format %d x %d bitdepth:%d color:%x interlace:%x compression:%x filter:%x\n",
|
||||
o_width, o_height, bit_depth, color_type,
|
||||
interlace_type, compression_type, filter_type);
|
||||
|
||||
|
@ -158,7 +159,7 @@ TxImage::readPNG(FILE* fp, int* width, int* height, uint16* format)
|
|||
/* punt invalid formats */
|
||||
if (color_type != PNG_COLOR_TYPE_RGB_ALPHA) {
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||
DBG_INFO(80, L"Error: not PNG_COLOR_TYPE_RGB_ALPHA format!\n");
|
||||
DBG_INFO(80, "Error: not PNG_COLOR_TYPE_RGB_ALPHA format!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -236,7 +237,7 @@ TxImage::readPNG(FILE* fp, int* width, int* height, uint16* format)
|
|||
|
||||
#ifdef DEBUG
|
||||
if (!image) {
|
||||
DBG_INFO(80, L"Error: failed to load png image!\n");
|
||||
DBG_INFO(80, "Error: failed to load png image!\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -512,11 +513,11 @@ TxImage::readBMP(FILE* fp, int* width, int* height, uint16* format)
|
|||
return NULL;
|
||||
|
||||
if (!getBMPInfo(fp, &bmp_fhdr, &bmp_ihdr)) {
|
||||
INFO(80, L"error reading bitmap file! bitmap image is corrupt.\n");
|
||||
INFO(80, "error reading bitmap file! bitmap image is corrupt.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DBG_INFO(80, L"bmp format %d x %d bitdepth:%d compression:%x offset:%d\n",
|
||||
DBG_INFO(80, "bmp format %d x %d bitdepth:%d compression:%x offset:%d\n",
|
||||
bmp_ihdr.biWidth, bmp_ihdr.biHeight, bmp_ihdr.biBitCount,
|
||||
bmp_ihdr.biCompression, bmp_fhdr.bfOffBits);
|
||||
|
||||
|
@ -528,7 +529,7 @@ TxImage::readBMP(FILE* fp, int* width, int* height, uint16* format)
|
|||
/* Rice hi-res textures */
|
||||
if (!(bmp_ihdr.biBitCount == 8 || bmp_ihdr.biBitCount == 4 || bmp_ihdr.biBitCount == 32 || bmp_ihdr.biBitCount == 24) ||
|
||||
bmp_ihdr.biCompression != 0) {
|
||||
DBG_INFO(80, L"Error: incompatible bitmap format!\n");
|
||||
DBG_INFO(80, "Error: incompatible bitmap format!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -647,7 +648,7 @@ TxImage::readBMP(FILE* fp, int* width, int* height, uint16* format)
|
|||
|
||||
#ifdef DEBUG
|
||||
if (!image) {
|
||||
DBG_INFO(80, L"Error: failed to load bmp image!\n");
|
||||
DBG_INFO(80, "Error: failed to load bmp image!\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -745,43 +746,43 @@ TxImage::readDDS(FILE* fp, int* width, int* height, uint16* format)
|
|||
return NULL;
|
||||
|
||||
if (!getDDSInfo(fp, &dds_fhdr)) {
|
||||
INFO(80, L"error reading dds file! dds image is corrupt.\n");
|
||||
INFO(80, "error reading dds file! dds image is corrupt.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DBG_INFO(80, L"dds format %d x %d HeaderSize %d LinearSize %d\n",
|
||||
DBG_INFO(80, "dds format %d x %d HeaderSize %d LinearSize %d\n",
|
||||
dds_fhdr.dwWidth, dds_fhdr.dwHeight, dds_fhdr.dwSize, dds_fhdr.dwLinearSize);
|
||||
|
||||
if (!(dds_fhdr.dwFlags & (DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PIXELFORMAT|DDSD_LINEARSIZE))) {
|
||||
DBG_INFO(80, L"Error: incompatible dds format!\n");
|
||||
DBG_INFO(80, "Error: incompatible dds format!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((dds_fhdr.dwFlags & DDSD_MIPMAPCOUNT) && dds_fhdr.dwMipMapCount != 1) {
|
||||
DBG_INFO(80, L"Error: mipmapped dds not supported!\n");
|
||||
DBG_INFO(80, "Error: mipmapped dds not supported!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!((dds_fhdr.ddpf.dwFlags & DDPF_FOURCC) && dds_fhdr.dwCaps2 == 0)) {
|
||||
DBG_INFO(80, L"Error: not fourcc standard texture!\n");
|
||||
DBG_INFO(80, "Error: not fourcc standard texture!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (memcmp(&dds_fhdr.ddpf.dwFourCC, "DXT1", 4) == 0) {
|
||||
DBG_INFO(80, L"DXT1 format\n");
|
||||
DBG_INFO(80, "DXT1 format\n");
|
||||
/* compensate for missing LinearSize */
|
||||
dds_fhdr.dwLinearSize = (dds_fhdr.dwWidth * dds_fhdr.dwHeight) >> 1;
|
||||
tmpformat = GR_TEXFMT_ARGB_CMP_DXT1;
|
||||
} else if (memcmp(&dds_fhdr.ddpf.dwFourCC, "DXT3", 4) == 0) {
|
||||
DBG_INFO(80, L"DXT3 format\n");
|
||||
DBG_INFO(80, "DXT3 format\n");
|
||||
dds_fhdr.dwLinearSize = dds_fhdr.dwWidth * dds_fhdr.dwHeight;
|
||||
tmpformat = GR_TEXFMT_ARGB_CMP_DXT3;
|
||||
} else if (memcmp(&dds_fhdr.ddpf.dwFourCC, "DXT5", 4) == 0) {
|
||||
DBG_INFO(80, L"DXT5 format\n");
|
||||
DBG_INFO(80, "DXT5 format\n");
|
||||
dds_fhdr.dwLinearSize = dds_fhdr.dwWidth * dds_fhdr.dwHeight;
|
||||
tmpformat = GR_TEXFMT_ARGB_CMP_DXT5;
|
||||
} else {
|
||||
DBG_INFO(80, L"Error: not DXT1 or DXT3 or DXT5 format!\n");
|
||||
DBG_INFO(80, "Error: not DXT1 or DXT3 or DXT5 format!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -91,15 +91,14 @@ TxReSample::nextPow2(uint8** image, int* width, int* height, int bpp, boolean us
|
|||
row_bytes = (n_width * bpp) >> 3;
|
||||
}
|
||||
}
|
||||
DBG_INFO(80, L"using 3dfx W:H aspect ratio range (8:1 - 1:8).\n");
|
||||
DBG_INFO(80, "using 3dfx W:H aspect ratio range (8:1 - 1:8).\n");
|
||||
}
|
||||
|
||||
/* do we really need to do this ? */
|
||||
if (o_width == n_width && o_height == n_height)
|
||||
return 1; /* nope */
|
||||
|
||||
DBG_INFO(80, L"expand image to next power of 2 dimensions. %d x %d -> %d x %d\n",
|
||||
o_width, o_height, n_width, n_height);
|
||||
DBG_INFO(80, "expand image to next power of 2 dimensions. %d x %d -> %d x %d\n", o_width, o_height, n_width, n_height);
|
||||
|
||||
if (o_width > n_width)
|
||||
o_width = n_width;
|
||||
|
@ -410,7 +409,7 @@ TxReSample::minify(uint8 **src, int *width, int *height, int ratio)
|
|||
*width = tmpwidth;
|
||||
*height = tmpheight;
|
||||
|
||||
DBG_INFO(80, L"minification ratio:%d -> %d x %d\n", ratio, *width, *height);
|
||||
DBG_INFO(80, "minification ratio:%d -> %d x %d\n", ratio, *width, *height);
|
||||
|
||||
return 1;
|
||||
#endif
|
||||
|
|
|
@ -126,7 +126,7 @@ TxUtil::sizeofTx(int width, int height, uint16 format)
|
|||
break;
|
||||
default:
|
||||
/* unsupported format */
|
||||
DBG_INFO(80, L"Error: cannot get size. unsupported gfmt:%x\n", format);
|
||||
DBG_INFO(80, "Error: cannot get size. unsupported gfmt:%x\n", format);
|
||||
;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue