Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/libmupen64plus/mupen64plus-video-glide64mk2/src/GlideHQ/TxDbg.cpp
2 views
1
/*
2
* Texture Filtering
3
* Version: 1.0
4
*
5
* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
6
* Email koolsmoky(at)users.sourceforge.net
7
* Web http://www.3dfxzone.it/koolsmoky
8
*
9
* this is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; either version 2, or (at your option)
12
* any later version.
13
*
14
* this is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
18
*
19
* You should have received a copy of the GNU General Public License
20
* along with GNU Make; see the file COPYING. If not, write to
21
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
22
*/
23
24
#define DBG_LEVEL 80
25
26
#include "TxDbg.h"
27
#include <string.h>
28
#include <stdarg.h>
29
#include <string>
30
31
TxDbg::TxDbg()
32
{
33
_level = DBG_LEVEL;
34
35
if (!_dbgfile)
36
#ifdef GHQCHK
37
_dbgfile = fopen("ghqchk.txt", "w");
38
#else
39
_dbgfile = fopen("glidehq.dbg", "w");
40
#endif
41
}
42
43
TxDbg::~TxDbg()
44
{
45
if (_dbgfile) {
46
fclose(_dbgfile);
47
_dbgfile = 0;
48
}
49
50
_level = DBG_LEVEL;
51
}
52
53
void
54
TxDbg::output(const int level, const wchar_t *format, ...)
55
{
56
#ifdef _GLIBCXX_HAVE_BROKEN_VSWPRINTF
57
wchar_t newformat[4095];
58
#else
59
std::wstring newformat;
60
#endif
61
62
va_list args;
63
64
if (level > _level)
65
return;
66
67
va_start(args, format);
68
#ifdef _GLIBCXX_HAVE_BROKEN_VSWPRINTF
69
swprintf(newformat, L"%d:\t", level);
70
wcscat(newformat, format);
71
vfwprintf(_dbgfile, newformat, args);
72
#else
73
newformat = std::to_wstring(level) + L":\t" + format;
74
vfwprintf(_dbgfile, newformat.c_str(), args);
75
#endif
76
fflush(_dbgfile);
77
#ifdef GHQCHK
78
//vwprintf(newformat, args);
79
vwprintf(newformat.c_str(), args);
80
#endif
81
va_end(args);
82
}
83
84