OpenGL: Changed printf to DEBUG_LOG to avoid that it's always shown in the console window

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1801 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson
2009-01-06 01:50:57 +00:00
parent aacfb94059
commit cbdad3495d
5 changed files with 58 additions and 30 deletions

View File

@ -78,25 +78,30 @@ struct TRectangle
int left, top, right, bottom; int left, top, right, bottom;
}; };
void DebugLog(const char* _fmt, ...);
void __Log(const char *format, ...); //////////////////////////////////////////////////////////////////////////////////////////
// Logging
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void DebugLog(const char* _fmt, ...); // This one goes to the main program
void __Log(const char *format, ...); // This one is for the local console
void __Log(int type, const char *format, ...); void __Log(int type, const char *format, ...);
void HandleGLError(); void HandleGLError();
#define ERROR_LOG __Log #define ERROR_LOG __Log
#if defined(_DEBUG) || defined(DEBUGFAST) #if defined(_DEBUG) || defined(DEBUGFAST)
// FIXME ugly hack for debug to build should use logmanager // FIXME ugly hack for debug to build should use logmanager
//#define INFO_LOG if( g_Config.iLog & CONF_LOG ) __Log //#define INFO_LOG if( g_Config.iLog & CONF_LOG ) __Log
//#define PRIM_LOG if( g_Config.iLog & CONF_PRIMLOG ) __Log //#define PRIM_LOG if( g_Config.iLog & CONF_PRIMLOG ) __Log
#define INFO_LOG __Log #define INFO_LOG __Log
#define PRIM_LOG __Log #define PRIM_LOG __Log
#define DEBUG_LOG __Log #define DEBUG_LOG __Log
#else #else
#define INFO_LOG(...) #define INFO_LOG(...)
#define PRIM_LOG(...) #define PRIM_LOG(...)
#define DEBUG_LOG(...) #define DEBUG_LOG(...)
#endif #endif
///////////////////////////////////
#endif // _VIDEOCOMMON_H #endif // _VIDEOCOMMON_H

View File

@ -317,7 +317,7 @@ void BPWritten(int addr, int changes, int newval)
// TODO: Figure out how to do these in GL // TODO: Figure out how to do these in GL
//TEV_FSEL_BX, TEV_FSEL_BX2? //TEV_FSEL_BX, TEV_FSEL_BX2?
default: default:
printf("Non-Emulated Fog selection %d\n", bpmem.fog.c_proj_fsel.fsel); DEBUG_LOG("Non-Emulated Fog selection %d\n", bpmem.fog.c_proj_fsel.fsel);
break; break;
} }
} }

View File

@ -15,12 +15,16 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
//////////////////////////////////////////////////////////////////////////////////////////
// Includes
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
#include <wx/wx.h> #include <wx/wx.h>
#include <wx/filepicker.h> #include <wx/filepicker.h>
#include <wx/notebook.h> #include <wx/notebook.h>
#include <wx/dialog.h> #include <wx/dialog.h>
#include <wx/aboutdlg.h> #include <wx/aboutdlg.h>
#endif #endif
#include "Globals.h" #include "Globals.h"
@ -30,11 +34,18 @@
#include "IniFile.h" #include "IniFile.h"
#include <assert.h> #include <assert.h>
/////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Declarations and definitions
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#ifdef _WIN32 #ifdef _WIN32
// The one for Linux is in Linux/Linux.cpp // The Windows console handle. The one for Linux is in Linux/Linux.cpp
static HANDLE hConsole = NULL; static HANDLE hConsole = NULL;
//////////////////////////////////
void OpenConsole() void OpenConsole()
{ {
@ -88,10 +99,10 @@ void __Log(const char *fmt, ...)
if (pfLog != NULL) if (pfLog != NULL)
fwrite(Msg, strlen(Msg), 1, pfLog); fwrite(Msg, strlen(Msg), 1, pfLog);
#ifdef _WIN32 #ifdef _WIN32
DWORD tmp; DWORD tmp;
WriteConsole(hConsole, Msg, (DWORD)strlen(Msg), &tmp, 0); WriteConsole(hConsole, Msg, (DWORD)strlen(Msg), &tmp, 0);
#else #else
//printf("%s", Msg); //printf("%s", Msg);
#endif #endif
} }

View File

@ -16,16 +16,22 @@
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// -------------------- //////////////////////////////////////////////////////////////////////////////////////////
// Includes // Includes
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#include "../Globals.h" #include "../Globals.h"
#include <string> #include <string>
#include <stdio.h> #include <stdio.h>
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#endif #endif
//////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Declarations and definitions
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// -------------------- // --------------------
// On and off // On and off
bool g_consoleEnable = true; bool g_consoleEnable = true;
@ -47,6 +53,7 @@ FILE* __fStdOut[1]; // you have to update this manually, we can't place a nFiles
#ifdef _WIN32 #ifdef _WIN32
HANDLE __hStdOut = NULL; HANDLE __hStdOut = NULL;
#endif #endif
///////////////////////////////////
// ======================================================================================= // =======================================================================================
@ -159,6 +166,9 @@ void OpenConsole()
} }
#endif #endif
//////////////////////////////////////////////////////////////////////////////////////////
// Get the window handle of the console
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#if defined(DEBUGG) && defined(_WIN32) #if defined(DEBUGG) && defined(_WIN32)
HWND GetConsoleHwnd(void) HWND GetConsoleHwnd(void)
{ {
@ -200,3 +210,4 @@ HWND GetConsoleHwnd(void)
} }
#endif // win32 #endif // win32
////////////////////////////////////

View File

@ -145,9 +145,9 @@ void Logging(int a)
{ {
std::string sfbuff; std::string sfbuff;
sfbuff = sfbuff + writeMessage(ii, 0); sfbuff = sfbuff + writeMessage(ii, 0);
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
aprintf(ii, (char *)sfbuff.c_str()); aprintf(ii, (char *)sfbuff.c_str());
#endif #endif
} }
// -------------- // --------------
@ -258,9 +258,10 @@ void Logging(int a)
// ======================================================================================= // =======================================================================================
// Print // Print
// ---------------- // ----------------
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
ClearScreen(); ClearScreen();
#endif #endif
__Log("%s", sbuff.c_str()); __Log("%s", sbuff.c_str());
sbuff.clear(); strcpy(buffer, ""); sbuff.clear(); strcpy(buffer, "");
// ================ // ================