X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=source%2Fgles2glide64%2Fsrc%2FGlideHQ%2FTxDbg.cpp;fp=source%2Fgles2glide64%2Fsrc%2FGlideHQ%2FTxDbg.cpp;h=fbd757d278c91f2cf6ec040a6215fd533fa23bc6;hb=98e75f2d18c02c233da543560f76282f04fc796c;hp=0000000000000000000000000000000000000000;hpb=0ced54f867d36e8b324155bef49e8abfebfc3237;p=mupen64plus-pandora.git diff --git a/source/gles2glide64/src/GlideHQ/TxDbg.cpp b/source/gles2glide64/src/GlideHQ/TxDbg.cpp new file mode 100755 index 0000000..fbd757d --- /dev/null +++ b/source/gles2glide64/src/GlideHQ/TxDbg.cpp @@ -0,0 +1,84 @@ +/* + * Texture Filtering + * Version: 1.0 + * + * Copyright (C) 2007 Hiroshi Morii All Rights Reserved. + * Email koolsmoky(at)users.sourceforge.net + * Web http://www.3dfxzone.it/koolsmoky + * + * this is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * this is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#define DBG_LEVEL 80 + +#include "TxDbg.h" +#include +#include +#include + +#define _GLIBCXX_HAVE_BROKEN_VSWPRINTF 1 + +TxDbg::TxDbg() +{ + _level = DBG_LEVEL; + + if (!_dbgfile) +#ifdef GHQCHK + _dbgfile = fopen("ghqchk.txt", "w"); +#else + _dbgfile = fopen("glidehq.dbg", "w"); +#endif +} + +TxDbg::~TxDbg() +{ + if (_dbgfile) { + fclose(_dbgfile); + _dbgfile = 0; + } + + _level = DBG_LEVEL; +} + +void +TxDbg::output(const int level, const wchar_t *format, ...) +{ +#ifdef _GLIBCXX_HAVE_BROKEN_VSWPRINTF + wchar_t newformat[4095]; +#else + std::wstring newformat; +#endif + + va_list args; + + if (level > _level) + return; + + va_start(args, format); +#ifdef _GLIBCXX_HAVE_BROKEN_VSWPRINTF + swprintf(newformat, L"%d:\t", level); + wcscat(newformat, format); + vfwprintf(_dbgfile, newformat, args); +#else + newformat = std::to_wstring(level) + L":\t" + format; + vfwprintf(_dbgfile, newformat.c_str(), args); +#endif + fflush(_dbgfile); +#ifdef GHQCHK + //vwprintf(newformat, args); + vwprintf(newformat.c_str(), args); +#endif + va_end(args); +}