Path: blob/master/libmupen64plus/mupen64plus-video-glide64mk2/src/GlideHQ/TxDbg.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#define DBG_LEVEL 802425#include "TxDbg.h"26#include <string.h>27#include <stdarg.h>28#include <string>2930TxDbg::TxDbg()31{32_level = DBG_LEVEL;3334if (!_dbgfile)35#ifdef GHQCHK36_dbgfile = fopen("ghqchk.txt", "w");37#else38_dbgfile = fopen("glidehq.dbg", "w");39#endif40}4142TxDbg::~TxDbg()43{44if (_dbgfile) {45fclose(_dbgfile);46_dbgfile = 0;47}4849_level = DBG_LEVEL;50}5152void53TxDbg::output(const int level, const wchar_t *format, ...)54{55#ifdef _GLIBCXX_HAVE_BROKEN_VSWPRINTF56wchar_t newformat[4095];57#else58std::wstring newformat;59#endif6061va_list args;6263if (level > _level)64return;6566va_start(args, format);67#ifdef _GLIBCXX_HAVE_BROKEN_VSWPRINTF68swprintf(newformat, L"%d:\t", level);69wcscat(newformat, format);70vfwprintf(_dbgfile, newformat, args);71#else72newformat = std::to_wstring(level) + L":\t" + format;73vfwprintf(_dbgfile, newformat.c_str(), args);74#endif75fflush(_dbgfile);76#ifdef GHQCHK77//vwprintf(newformat, args);78vwprintf(newformat.c_str(), args);79#endif80va_end(args);81}828384