2008-12-08 05:25:12 +00:00
|
|
|
// Copyright (C) 2003-2008 Dolphin Project.
|
|
|
|
|
|
|
|
// This program 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, version 2.0.
|
|
|
|
|
|
|
|
// This program 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 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official SVN repository and contact information can be found at
|
|
|
|
// http://code.google.com/p/dolphin-emu/
|
|
|
|
|
2009-01-06 01:50:57 +00:00
|
|
|
|
2008-12-08 05:25:12 +00:00
|
|
|
#if defined(HAVE_WX) && HAVE_WX
|
2009-01-06 01:50:57 +00:00
|
|
|
#include <wx/wx.h>
|
|
|
|
#include <wx/filepicker.h>
|
|
|
|
#include <wx/notebook.h>
|
|
|
|
#include <wx/dialog.h>
|
|
|
|
#include <wx/aboutdlg.h>
|
2008-12-08 05:25:12 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "Globals.h"
|
|
|
|
|
|
|
|
#include "pluginspecs_video.h"
|
|
|
|
#include "main.h"
|
|
|
|
|
|
|
|
#include "IniFile.h"
|
2009-01-17 14:28:09 +00:00
|
|
|
#include "ConsoleWindow.h"
|
2008-12-08 05:25:12 +00:00
|
|
|
#include <assert.h>
|
2009-01-06 01:50:57 +00:00
|
|
|
|
2009-01-17 14:28:09 +00:00
|
|
|
// Open and close the Windows console window
|
2009-02-04 15:28:39 +00:00
|
|
|
|
2008-12-08 05:25:12 +00:00
|
|
|
void OpenConsole()
|
|
|
|
{
|
2009-01-17 14:28:09 +00:00
|
|
|
Console::Open(100, 300, "OpenGL Plugin Output"); // give room for 300 rows
|
|
|
|
Console::Print("OpenGL console opened\n");
|
2009-02-04 15:28:39 +00:00
|
|
|
#ifdef _WIN32
|
2009-01-17 14:28:09 +00:00
|
|
|
MoveWindow(Console::GetHwnd(), 0,400, 1280,550, true); // Move window. Todo: make this
|
|
|
|
// adjustable from the debugging window
|
2009-02-04 15:28:39 +00:00
|
|
|
#endif
|
2008-12-08 05:25:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CloseConsole()
|
|
|
|
{
|
2009-01-17 14:28:09 +00:00
|
|
|
Console::Close();
|
2008-12-08 05:25:12 +00:00
|
|
|
}
|
2009-01-17 14:28:09 +00:00
|
|
|
|
|
|
|
|
2009-02-06 18:04:24 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
2009-01-17 14:28:09 +00:00
|
|
|
// Write logs
|
2008-12-08 05:25:12 +00:00
|
|
|
|
2009-01-17 14:28:09 +00:00
|
|
|
// The log file handle
|
2008-12-08 05:25:12 +00:00
|
|
|
static FILE* pfLog = NULL;
|
2009-01-17 14:28:09 +00:00
|
|
|
|
|
|
|
// This is on by default, but can be controlled from the debugging window
|
|
|
|
bool LocalLogFile = true;
|
|
|
|
|
2009-02-04 15:28:39 +00:00
|
|
|
#ifdef LOGGING
|
2008-12-08 05:25:12 +00:00
|
|
|
void __Log(const char *fmt, ...)
|
|
|
|
{
|
2009-02-06 18:04:24 +00:00
|
|
|
int len = strlen(fmt);
|
|
|
|
if (!len)
|
|
|
|
return;
|
|
|
|
char* Msg = (char*)alloca(len + 512);
|
2008-12-08 05:25:12 +00:00
|
|
|
va_list ap;
|
|
|
|
|
2009-02-06 18:04:24 +00:00
|
|
|
va_start(ap, fmt);
|
|
|
|
vsnprintf(Msg, len + 512, fmt, ap);
|
|
|
|
va_end(ap);
|
2008-12-08 05:25:12 +00:00
|
|
|
|
|
|
|
g_VideoInitialize.pLog(Msg, FALSE);
|
|
|
|
|
2009-01-17 14:28:09 +00:00
|
|
|
// If we have no file to write to, create one
|
|
|
|
if (pfLog == NULL && LocalLogFile)
|
2008-12-08 05:25:12 +00:00
|
|
|
pfLog = fopen(FULL_LOGS_DIR "oglgfx.txt", "w");
|
|
|
|
|
2009-01-17 14:28:09 +00:00
|
|
|
// Write to file
|
|
|
|
if (pfLog != NULL && LocalLogFile)
|
2008-12-08 05:25:12 +00:00
|
|
|
fwrite(Msg, strlen(Msg), 1, pfLog);
|
2009-01-17 14:28:09 +00:00
|
|
|
|
2009-02-04 15:28:39 +00:00
|
|
|
Console::Print(Msg);
|
|
|
|
|
2008-12-08 05:25:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void __Log(int type, const char *fmt, ...)
|
|
|
|
{
|
2009-02-06 18:04:24 +00:00
|
|
|
int len = strlen(fmt);
|
|
|
|
if (!len)
|
|
|
|
return;
|
|
|
|
char* Msg = (char*)alloca(len + 512);
|
2008-12-08 05:25:12 +00:00
|
|
|
va_list ap;
|
|
|
|
|
2009-02-06 18:04:24 +00:00
|
|
|
va_start(ap, fmt);
|
|
|
|
vsnprintf(Msg, len + 512, fmt, ap);
|
|
|
|
va_end(ap);
|
2008-12-08 05:25:12 +00:00
|
|
|
|
|
|
|
g_VideoInitialize.pLog(Msg, FALSE);
|
2009-01-17 14:28:09 +00:00
|
|
|
Console::Print(Msg);
|
2008-12-08 05:25:12 +00:00
|
|
|
}
|
2009-02-04 15:28:39 +00:00
|
|
|
|
2009-02-06 18:04:24 +00:00
|
|
|
#endif
|