Joined work of nakee and mine, cleanup the logging code a bit.

This solves the random __Log symbol and crash problem on linux
Please tell us if you find problems in the logging code


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2109 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
XTra.KrazzY 2009-02-04 15:28:39 +00:00
parent c43d8e9dcd
commit 77215fd27c
10 changed files with 60 additions and 181 deletions

View file

@ -196,14 +196,10 @@ inline u64 swap64(u64 data) {return(((u64)swap32(data) << 32) | swap32(data >> 3
} // end of namespace Common } // end of namespace Common
//////////////////////////////////////////////////////////////////////////////////////////
// Utility functions // Utility functions
// ¯¯¯¯¯¯¯¯¯
///////////////////////////
// Message alerts // Message alerts
// ¯¯¯¯¯¯¯¯¯
enum MSG_TYPE enum MSG_TYPE
{ {
INFORMATION, INFORMATION,
@ -230,12 +226,7 @@ extern bool MsgAlert(const char* caption, bool yes_no, int Style, const char* fo
///////////////////////////
// Logging // Logging
// ¯¯¯¯¯¯¯¯¯
extern void __Log(int logNumber, const char* text, ...);
extern void __Logv(int log, int v, const char *format, ...);
// dummy class // dummy class
class LogTypes class LogTypes
@ -279,14 +270,25 @@ class LogTypes
}; };
}; };
#ifdef LOGGING
extern void __Log(int logNumber, const char* text, ...);
extern void __Logv(int log, int v, const char *format, ...);
void Host_UpdateLogDisplay(); void Host_UpdateLogDisplay();
// Logging macros. LOGGING is turned on from earlier in this file // Logging macros. LOGGING is turned on from earlier in this file
#ifdef LOGGING
#ifdef _WIN32
#define LOG(t, ...) __Log(LogTypes::t, __VA_ARGS__); #define LOG(t, ...) __Log(LogTypes::t, __VA_ARGS__);
#define LOGV(t,v, ...) __Log(LogTypes::t + (v)*100, __VA_ARGS__); #define LOGV(t,v, ...) __Log(LogTypes::t + (v)*100, __VA_ARGS__);
#define LOGP(t, ...) __Log(t, __VA_ARGS__);
#define LOGVP(t,v, ...) __Log(t + (v)*100, __VA_ARGS__);
#else
#define LOG(t, ...) __Log(LogTypes::t, ##__VA_ARGS__);
#define LOGV(t,v, ...) __Log(LogTypes::t + (v)*100, ##__VA_ARGS__);
#define LOGP(t, ...) __Log(t, ##__VA_ARGS__);
#define LOGVP(t,v, ...) __Log(t + (v)*100, ##__VA_ARGS__);
#endif
#define _dbg_assert_(_t_, _a_) \ #define _dbg_assert_(_t_, _a_) \
if (!(_a_)){\ if (!(_a_)){\
@ -305,6 +307,8 @@ void Host_UpdateLogDisplay();
#define LOG(_t_, ...) #define LOG(_t_, ...)
#define LOGV(_t_,_v_, ...) #define LOGV(_t_,_v_, ...)
#define LOGP(_t_, ...)
#define LOGVP(_t_,_v_, ...)
#define _dbg_clear_() #define _dbg_clear_()
#ifndef _dbg_assert_ #ifndef _dbg_assert_
#define _dbg_assert_(_t_, _a_) ; #define _dbg_assert_(_t_, _a_) ;
@ -326,9 +330,7 @@ void Host_UpdateLogDisplay();
#endif #endif
//////////////////////////////////////////////////////////////////////////////////////////
// Compile time asserts // Compile time asserts
// ¯¯¯¯¯¯¯¯¯
namespace namespace
{ {
@ -344,7 +346,6 @@ namespace
#endif #endif
#endif #endif
} }
//////////////////////////////////
#endif // #ifndef _COMMON_H #endif // #ifndef _COMMON_H

View file

@ -106,19 +106,19 @@ void PrintCallstack()
} }
} }
void PrintCallstack(LogTypes::LOG_TYPE _Log) void PrintCallstack(LogTypes::LOG_TYPE type)
{ {
u32 addr = Memory::ReadUnchecked_U32(PowerPC::ppcState.gpr[1]); // SP u32 addr = Memory::ReadUnchecked_U32(PowerPC::ppcState.gpr[1]); // SP
__Logv(_Log, 1, "\n == STACK TRACE - SP = %08x ==\n", PowerPC::ppcState.gpr[1]); LOGVP(type, 1, "\n == STACK TRACE - SP = %08x ==\n", PowerPC::ppcState.gpr[1]);
if (LR == 0) { if (LR == 0) {
__Logv(_Log, 1, " LR = 0 - this is bad\n"); LOGVP(type, 1, " LR = 0 - this is bad\n");
} }
int count = 1; int count = 1;
if (g_symbolDB.GetDescription(PowerPC::ppcState.pc) != g_symbolDB.GetDescription(LR)) if (g_symbolDB.GetDescription(PowerPC::ppcState.pc) != g_symbolDB.GetDescription(LR))
{ {
__Log(_Log, " * %s [ LR = %08x ]\n", g_symbolDB.GetDescription(LR), LR); LOGP(type, " * %s [ LR = %08x ]\n", g_symbolDB.GetDescription(LR), LR);
count++; count++;
} }
@ -129,14 +129,14 @@ void PrintCallstack(LogTypes::LOG_TYPE _Log)
const char *str = g_symbolDB.GetDescription(func); const char *str = g_symbolDB.GetDescription(func);
if (!str || strlen(str) == 0 || !strcmp(str, "Invalid")) if (!str || strlen(str) == 0 || !strcmp(str, "Invalid"))
str = "(unknown)"; str = "(unknown)";
__Logv(_Log, 3, " * %s [ addr = %08x ]\n", str, func); LOGVP(type, 3, " * %s [ addr = %08x ]\n", str, func);
addr = Memory::ReadUnchecked_U32(addr); addr = Memory::ReadUnchecked_U32(addr);
} }
} }
void PrintDataBuffer(LogTypes::LOG_TYPE _Log, u8* _pData, size_t _Size, const char* _title) void PrintDataBuffer(LogTypes::LOG_TYPE type, u8* _pData, size_t _Size, const char* _title)
{ {
__Log(_Log, _title); LOGP(type, _title);
for (u32 j=0; j<_Size;) for (u32 j=0; j<_Size;)
{ {
std::string Temp; std::string Temp;
@ -150,7 +150,7 @@ void PrintDataBuffer(LogTypes::LOG_TYPE _Log, u8* _pData, size_t _Size, const ch
break; break;
} }
__Log(_Log, " Data: %s", Temp.c_str()); LOGP(type, " Data: %s", Temp.c_str());
} }
} }

View file

@ -138,12 +138,12 @@ protected:
void DumpCommands(u32 _CommandAddress, size_t _NumberOfCommands = 8, void DumpCommands(u32 _CommandAddress, size_t _NumberOfCommands = 8,
int LogType = LogTypes::WII_IPC_HLE, int Verbosity = 0) int LogType = LogTypes::WII_IPC_HLE, int Verbosity = 0)
{ {
// Because I have to use __Logv here I add this #if // Because I have to use LOGV here I add this #if
#if defined(_DEBUG) || defined(DEBUGFAST) #if defined(_DEBUG) || defined(DEBUGFAST)
__Logv(LogType, Verbosity, "CommandDump of %s", GetDeviceName().c_str()); LOGVP(LogType, Verbosity, "CommandDump of %s", GetDeviceName().c_str());
for (u32 i = 0; i < _NumberOfCommands; i++) for (u32 i = 0; i < _NumberOfCommands; i++)
{ {
__Logv(LogType, Verbosity, " Command%02i: 0x%08x", i, LOGVP(LogType, Verbosity, " Command%02i: 0x%08x", i,
Memory::Read_U32(_CommandAddress + i*4)); Memory::Read_U32(_CommandAddress + i*4));
} }
#endif #endif

View file

@ -86,29 +86,23 @@ struct TRectangle
}; };
//////////////////////////////////////////////////////////////////////////////////////////
// Logging // Logging
// ¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯
void DebugLog(const char* _fmt, ...); // This one goes to the main program 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 HandleGLError(); void HandleGLError();
#define ERROR_LOG __Log #ifdef _WIN32
#define ERROR_LOG(...) LOG(VIDEO, __VA_ARGS__)
#if defined(_DEBUG) || defined(DEBUGFAST) #define INFO_LOG(...) LOG(VIDEO, __VA_ARGS__)
// FIXME ugly hack for debug to build should use logmanager #define PRIM_LOG(...) LOG(VIDEO, __VA_ARGS__)
//#define INFO_LOG if( g_Config.iLog & CONF_LOG ) __Log #define DEBUG_LOG(...) LOG(VIDEO, __VA_ARGS__)
//#define PRIM_LOG if( g_Config.iLog & CONF_PRIMLOG ) __Log
#define INFO_LOG __Log
#define PRIM_LOG __Log
#define DEBUG_LOG __Log
#else #else
#define INFO_LOG(...) #define ERROR_LOG(...) LOG(VIDEO, ##__VA_ARGS__)
#define PRIM_LOG(...) #define INFO_LOG(...) LOG(VIDEO, ##__VA_ARGS__)
#define DEBUG_LOG(...) #define PRIM_LOG(...) LOG(VIDEO, ##__VA_ARGS__)
#define DEBUG_LOG(...) LOG(VIDEO, ##__VA_ARGS__)
#endif #endif
///////////////////////////////////
#endif // _VIDEOCOMMON_H #endif // _VIDEOCOMMON_H

View file

@ -16,9 +16,6 @@
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// =======================================================================================
// Includes
// ---------------
#include "../Globals.h" // The precompiled header #include "../Globals.h" // The precompiled header
#include "IniFile.h" // Common #include "IniFile.h" // Common
@ -29,20 +26,13 @@
#include "PBView.h" // Debugger files #include "PBView.h" // Debugger files
#include "Debugger.h" #include "Debugger.h"
#include "Logging.h" // Open and close console #include "Logging.h" // Open and close console
// ========================
// =======================================================================================
// Declarations and definitions
// ---------------
extern int gPreset; extern int gPreset;
int A, B; int A, B;
// ========================
// =======================================================================================
// Event table and class // Event table and class
// ---------------
BEGIN_EVENT_TABLE(CDebugger,wxDialog) BEGIN_EVENT_TABLE(CDebugger,wxDialog)
EVT_SHOW(CDebugger::OnShow) EVT_SHOW(CDebugger::OnShow)
EVT_CLOSE(CDebugger::OnClose) EVT_CLOSE(CDebugger::OnClose)
@ -81,12 +71,9 @@ CDebugger::~CDebugger()
this->Save(file); this->Save(file);
file.Save(DEBUGGER_CONFIG_FILE); file.Save(DEBUGGER_CONFIG_FILE);
} }
// =========================
// ==========================================================================
// System functions // System functions
// --------------
void CDebugger::OnShow(wxShowEvent& /*event*/) void CDebugger::OnShow(wxShowEvent& /*event*/)
{ {
// bring the console back to // bring the console back to
@ -130,12 +117,8 @@ void CDebugger::OnUpdate(wxCommandEvent& /*event*/)
{ {
this->NotifyUpdate(); this->NotifyUpdate();
} }
// ===============
// ==========================================================================
// Save and load settings // Save and load settings
// --------------
void CDebugger::Save(IniFile& _IniFile) const void CDebugger::Save(IniFile& _IniFile) const
{ {
// TODO1: make this work when we close the entire program to, currently on total close we get // TODO1: make this work when we close the entire program to, currently on total close we get
@ -182,7 +165,6 @@ void CDebugger::Load(IniFile& _IniFile)
_IniFile.Get("VideoWindow", "LogLevel", &g_Config.iLog, 0); _IniFile.Get("VideoWindow", "LogLevel", &g_Config.iLog, 0);
m_settings->Check(g_Config.iLog - 1, true); m_settings->Check(g_Config.iLog - 1, true);
} }
// ===============
void CDebugger::CreateGUIControls() void CDebugger::CreateGUIControls()
@ -209,7 +191,6 @@ void CDebugger::CreateGUIControls()
// ===================================================================
// Main Page // Main Page
@ -238,12 +219,8 @@ void CDebugger::CreateGUIControls()
m_buttonSizer->Add(m_Am, 0, 0, 5); m_buttonSizer->Add(m_Am, 0, 0, 5);
m_buttonSizer->Add(m_Bp, 0, 0, 5); m_buttonSizer->Add(m_Bp, 0, 0, 5);
m_buttonSizer->Add(m_Bm, 0, 0, 5); m_buttonSizer->Add(m_Bm, 0, 0, 5);
// ------------------------
// --------------------------------------------------------------------
// m_PageMain: Options // m_PageMain: Options
// -------------------------
wxStaticBoxSizer * m_optionsSizer = new wxStaticBoxSizer(wxVERTICAL, m_PageMain, wxT("Options")); wxStaticBoxSizer * m_optionsSizer = new wxStaticBoxSizer(wxVERTICAL, m_PageMain, wxT("Options"));
//m_Label[0] = new wxStaticBox(m_PageMain, IDG_LABEL1, wxT("Options"), //m_Label[0] = new wxStaticBox(m_PageMain, IDG_LABEL1, wxT("Options"),
// wxDefaultPosition, wxDefaultSize, 0); // wxDefaultPosition, wxDefaultSize, 0);
@ -259,12 +236,9 @@ void CDebugger::CreateGUIControls()
m_optionsSizer->Add(m_Check[0], 0, 0, 5); m_optionsSizer->Add(m_Check[0], 0, 0, 5);
m_optionsSizer->Add(m_Check[2], 0, 0, 5); m_optionsSizer->Add(m_Check[2], 0, 0, 5);
// ------------------------
// --------------------------------------------------------------------
// m_PageMain: Log settings checkboxes // m_PageMain: Log settings checkboxes
// -------------------------
wxStaticBoxSizer * m_logSizer = new wxStaticBoxSizer(wxVERTICAL, m_PageMain, wxT("Log setting")); wxStaticBoxSizer * m_logSizer = new wxStaticBoxSizer(wxVERTICAL, m_PageMain, wxT("Log setting"));
m_settings = new wxCheckListBox(m_PageMain, ID_CHECKLIST1, wxDefaultPosition, wxDefaultSize, m_settings = new wxCheckListBox(m_PageMain, ID_CHECKLIST1, wxDefaultPosition, wxDefaultSize,
0, NULL, wxNO_BORDER); 0, NULL, wxNO_BORDER);
@ -397,7 +371,7 @@ void CDebugger::Ap(wxCommandEvent& event)
{ {
A += 50; A += 50;
//MessageBox(0, "", "", 0); //MessageBox(0, "", "", 0);
__Log("%i", A); DEBUG_LOG("%i", A);
} }
void CDebugger::Am(wxCommandEvent& event) void CDebugger::Am(wxCommandEvent& event)
{ {

View file

@ -17,12 +17,7 @@
// 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
// ---------------
#include "../Globals.h" // This is the precompiled header and must be the first ... #include "../Globals.h" // This is the precompiled header and must be the first ...
#include <iostream> #include <iostream>
@ -40,16 +35,8 @@
#include "ConsoleWindow.h" // Open and close console, clear console window #include "ConsoleWindow.h" // Open and close console, clear console window
#endif #endif
#include "../Debugger/Logging.h" // For global logging values #include "../Debugger/Logging.h" // For global logging values
// =======================
// =======================================================================================
// Declarations and definitions
// ---------------
// -------------------------
// Externals // Externals
// -------------
extern int nFiles; extern int nFiles;
float ratioFactor; // a global to get the ratio factor from MixAdd float ratioFactor; // a global to get the ratio factor from MixAdd
int gPreset = 0; int gPreset = 0;
@ -62,26 +49,16 @@ extern bool gReset;
bool gOnlyLooping = false; bool gOnlyLooping = false;
//extern int gleft, gright, gtop, gbottom; // from BPStructs.cpp //extern int gleft, gright, gtop, gbottom; // from BPStructs.cpp
// -------------------------
// Counters
// -------------
int j = 0; int j = 0;
int k = 0; int k = 0;
bool iupdonce = false; bool iupdonce = false;
std::vector<u16> viupd(15); // the length of the update frequency bar std::vector<u16> viupd(15); // the length of the update frequency bar
// -------------------------
// Classes
// -------------
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
extern CDebugger* m_frame; extern CDebugger* m_frame;
#endif #endif
// =======================
// =======================================================================================
// Write title
// --------------
std::string writeTitle(int a) std::string writeTitle(int a)
{ {
std::string b; std::string b;
@ -91,20 +68,13 @@ std::string writeTitle(int a)
} }
return b; return b;
} }
// =======================================================================================
// =======================================================================================
// Write main message (presets) // Write main message (presets)
// --------------
std::string writeMessage(int a, int i) std::string writeMessage(int a, int i)
{ {
char buf [1000] = ""; char buf [1000] = "";
std::string sbuf; std::string sbuf;
// =======================================================================================
// PRESETS
// ---------------------------------------------------------------------------------------
/* /*
PRESET 0 PRESET 0
"lef rig top bot | xof yof\n"; "lef rig top bot | xof yof\n";
@ -122,27 +92,12 @@ std::string writeMessage(int a, int i)
} }
// =======================================================================================
// Logging // Logging
void Logging(int a) void Logging(int a)
{ {
// =======================================================================================
// Update parameter values
// --------------
// AXPB base
// ==============
// =======================================================================================
// Control how often the screen is updated, and then update the screen // Control how often the screen is updated, and then update the screen
// --------------
if(a == 0) j++; if(a == 0) j++;
//if(l == pow((double)2,32)) l=0; // reset l //if(l == pow((double)2,32)) l=0; // reset l
//l++; //l++;
@ -150,13 +105,10 @@ void Logging(int a)
{ {
// =======================================================================================
// Write header // Write header
// --------------
char buffer [1000] = ""; char buffer [1000] = "";
std::string sbuff; std::string sbuff;
sbuff = writeTitle(gPreset); sbuff = writeTitle(gPreset);
// ==============
// hopefully this is false if we don't have a debugging window and so it doesn't cause a crash // hopefully this is false if we don't have a debugging window and so it doesn't cause a crash
@ -172,7 +124,7 @@ void Logging(int a)
sbuff = sbuff + "\n"; sbuff = sbuff + "\n";
// =======================================================================================
// Write global values // Write global values
// --------------- // ---------------
/* /*
@ -250,7 +202,7 @@ void Logging(int a)
Console::ClearScreen(); Console::ClearScreen();
#endif #endif
__Log("%s", sbuff.c_str()); LOG(VIDEO, "%s", sbuff.c_str());
sbuff.clear(); strcpy(buffer, ""); sbuff.clear(); strcpy(buffer, "");
// ================ // ================

View file

@ -562,11 +562,12 @@ bool OpenGL_MakeCurrent()
glXMakeCurrent(GLWin.dpy, GLWin.win, GLWin.ctx); glXMakeCurrent(GLWin.dpy, GLWin.win, GLWin.ctx);
XGetGeometry(GLWin.dpy, GLWin.win, &winDummy, &GLWin.x, &GLWin.y, XGetGeometry(GLWin.dpy, GLWin.win, &winDummy, &GLWin.x, &GLWin.y,
&GLWin.width, &GLWin.height, &borderDummy, &GLWin.depth); &GLWin.width, &GLWin.height, &borderDummy, &GLWin.depth);
ERROR_LOG("GLWin Depth %d", GLWin.depth); ERROR_LOG("GLWin Depth %d", GLWin.depth)
if (glXIsDirect(GLWin.dpy, GLWin.ctx)) if (glXIsDirect(GLWin.dpy, GLWin.ctx)) {
ERROR_LOG("you have Direct Rendering!"); ERROR_LOG("you have Direct Rendering!");
else } else {
ERROR_LOG("no Direct Rendering possible!"); ERROR_LOG("no Direct Rendering possible!");
}
// better for pad plugin key input (thc) // better for pad plugin key input (thc)
XSelectInput(GLWin.dpy, GLWin.win, ExposureMask | KeyPressMask | ButtonPressMask | KeyReleaseMask | ButtonReleaseMask | StructureNotifyMask | EnterWindowMask | LeaveWindowMask | XSelectInput(GLWin.dpy, GLWin.win, ExposureMask | KeyPressMask | ButtonPressMask | KeyReleaseMask | ButtonReleaseMask | StructureNotifyMask | EnterWindowMask | LeaveWindowMask |

View file

@ -16,9 +16,6 @@
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
//////////////////////////////////////////////////////////////////////////////////////////
// Includes
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
#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>
@ -35,41 +32,26 @@
#include "IniFile.h" #include "IniFile.h"
#include "ConsoleWindow.h" #include "ConsoleWindow.h"
#include <assert.h> #include <assert.h>
/////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Open and close the Windows console window // Open and close the Windows console window
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
#ifdef _WIN32
void OpenConsole() void OpenConsole()
{ {
Console::Open(100, 300, "OpenGL Plugin Output"); // give room for 300 rows Console::Open(100, 300, "OpenGL Plugin Output"); // give room for 300 rows
Console::Print("OpenGL console opened\n"); Console::Print("OpenGL console opened\n");
#ifdef _WIN32
MoveWindow(Console::GetHwnd(), 0,400, 1280,550, true); // Move window. Todo: make this MoveWindow(Console::GetHwnd(), 0,400, 1280,550, true); // Move window. Todo: make this
// adjustable from the debugging window // adjustable from the debugging window
#endif
} }
void CloseConsole() void CloseConsole()
{ {
Console::Close(); Console::Close();
} }
#else
// Dummy functions for console open/close
void OpenConsole()
{
}
void CloseConsole()
{
}
#endif
//////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Write logs // Write logs
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
// The log file handle // The log file handle
static FILE* pfLog = NULL; static FILE* pfLog = NULL;
@ -77,6 +59,7 @@ static FILE* pfLog = NULL;
// This is on by default, but can be controlled from the debugging window // This is on by default, but can be controlled from the debugging window
bool LocalLogFile = true; bool LocalLogFile = true;
#ifdef LOGGING
void __Log(const char *fmt, ...) void __Log(const char *fmt, ...)
{ {
char* Msg = (char*)alloca(strlen(fmt)+512); char* Msg = (char*)alloca(strlen(fmt)+512);
@ -96,12 +79,8 @@ void __Log(const char *fmt, ...)
if (pfLog != NULL && LocalLogFile) if (pfLog != NULL && LocalLogFile)
fwrite(Msg, strlen(Msg), 1, pfLog); fwrite(Msg, strlen(Msg), 1, pfLog);
#ifdef _WIN32
// Write to the console screen, if one exists
Console::Print(Msg); Console::Print(Msg);
#else
//printf("%s", Msg);
#endif
} }
void __Log(int type, const char *fmt, ...) void __Log(int type, const char *fmt, ...)
@ -114,10 +93,7 @@ void __Log(int type, const char *fmt, ...)
va_end( ap ); va_end( ap );
g_VideoInitialize.pLog(Msg, FALSE); g_VideoInitialize.pLog(Msg, FALSE);
#ifdef _WIN32
// Write to the console screen, if one exists
Console::Print(Msg); Console::Print(Msg);
#endif
} }
////////////////////////////////// #endif

View file

@ -19,27 +19,16 @@
#define _GLOBALS_H #define _GLOBALS_H
//////////////////////////////////////////////////////////////////////////////////////////
// Includes
// -------------
#include "Common.h" #include "Common.h"
#include "Config.h" #include "Config.h"
#include "VideoCommon.h" #include "VideoCommon.h"
#include "pluginspecs_video.h" #include "pluginspecs_video.h"
//////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Declarations and definitions
// -------------
// Turns file logging on and off // Turns file logging on and off
extern bool LocalLogFile; extern bool LocalLogFile;
// A global plugin specification // A global plugin specification
extern PLUGIN_GLOBALS* globals; extern PLUGIN_GLOBALS* globals;
//////////////////////////////
#endif // _GLOBALS_H #endif // _GLOBALS_H

View file

@ -16,9 +16,6 @@
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
//////////////////////////////////////////////////////////////////////////////////////////
// Includes
// -------------
#include "Globals.h" #include "Globals.h"
#include <list> #include <list>
#include <vector> #include <vector>
@ -59,12 +56,7 @@
#include "Win32Window.h" // warning: crapcode #include "Win32Window.h" // warning: crapcode
#else #else
#endif #endif
/////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Declarations and definitions
// -------------
struct MESSAGE struct MESSAGE
{ {
MESSAGE() {} MESSAGE() {}
@ -139,9 +131,9 @@ bool Renderer::Init()
const char* ptoken = (const char*)glGetString(GL_EXTENSIONS); const char* ptoken = (const char*)glGetString(GL_EXTENSIONS);
if (ptoken == NULL) return false; if (ptoken == NULL) return false;
__Log("Supported OpenGL Extensions:\n"); INFO_LOG("Supported OpenGL Extensions:\n");
__Log(ptoken); // write to the log file INFO_LOG(ptoken); // write to the log file
__Log("\n"); INFO_LOG("\n");
if (strstr(ptoken, "GL_EXT_blend_logic_op") != NULL) if (strstr(ptoken, "GL_EXT_blend_logic_op") != NULL)
g_bBlendLogicOp = true; g_bBlendLogicOp = true;
@ -326,8 +318,8 @@ bool Renderer::Init()
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, (GLint *)&nenvfragparams); glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, (GLint *)&nenvfragparams);
glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB, (GLint *)&naddrregisters[0]); glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB, (GLint *)&naddrregisters[0]);
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB, (GLint *)&naddrregisters[1]); glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB, (GLint *)&naddrregisters[1]);
__Log("max program env parameters: vert=%d, frag=%d\n", nenvvertparams, nenvfragparams); DEBUG_LOG("max program env parameters: vert=%d, frag=%d\n", nenvvertparams, nenvfragparams);
__Log("max program address register parameters: vert=%d, frag=%d\n", naddrregisters[0], naddrregisters[1]); DEBUG_LOG("max program address register parameters: vert=%d, frag=%d\n", naddrregisters[0], naddrregisters[1]);
if (nenvvertparams < 238) if (nenvvertparams < 238)
ERROR_LOG("not enough vertex shader environment constants!!\n"); ERROR_LOG("not enough vertex shader environment constants!!\n");
@ -689,7 +681,7 @@ bool Renderer::SetScissorRect()
rc_bottom *= MValueY; rc_bottom *= MValueY;
if (rc_bottom > 480 * MValueY) rc_bottom = 480 * MValueY; if (rc_bottom > 480 * MValueY) rc_bottom = 480 * MValueY;
/*__Log("Scissor: lt=(%d,%d), rb=(%d,%d,%i), off=(%d,%d)\n", /*LOG("Scissor: lt=(%d,%d), rb=(%d,%d,%i), off=(%d,%d)\n",
rc_left, rc_top, rc_left, rc_top,
rc_right, rc_bottom, Renderer::GetTargetHeight(), rc_right, rc_bottom, Renderer::GetTargetHeight(),
xoff, yoff xoff, yoff