remove some unused files
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2678 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
d72c35fffc
commit
2d167fa3f0
|
@ -1,198 +0,0 @@
|
|||
// 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/
|
||||
|
||||
|
||||
// Includes
|
||||
#include <string> // System: To be able to add strings with "+"
|
||||
#include <stdio.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#include "Common.h"
|
||||
#include "ConsoleWindow.h" // Common
|
||||
|
||||
|
||||
// Declarations and definitions
|
||||
|
||||
namespace Console
|
||||
{
|
||||
|
||||
// Create handles
|
||||
FILE* __fStdOut = NULL;
|
||||
#ifdef _WIN32
|
||||
HANDLE __hStdOut = NULL;
|
||||
#endif
|
||||
|
||||
|
||||
/* Start console window - width and height is the size of console window, if you enable
|
||||
File the output will also be written to this file. */
|
||||
void Open(int Width, int Height, char * Name, bool File)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// Open the console window and create the window handle for GetStdHandle()
|
||||
AllocConsole();
|
||||
|
||||
// Save the window handle that AllocConsole() created
|
||||
__hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
// Set the console window title
|
||||
SetConsoleTitle(Name);
|
||||
|
||||
// Set the total letter space
|
||||
COORD co = {Width, Height};
|
||||
SetConsoleScreenBufferSize(__hStdOut, co);
|
||||
|
||||
/* Set the window size in number of letters. The height is hardcoded here because it can
|
||||
be changed with MoveWindow() later */
|
||||
SMALL_RECT coo = {0,0, (Width - 1),50}; // Top, left, right, bottom
|
||||
SetConsoleWindowInfo(__hStdOut, TRUE, &coo);
|
||||
|
||||
|
||||
#endif
|
||||
// Create a file and a file handle if File is enabled and we don't already have a file handle
|
||||
if(File && !__fStdOut)
|
||||
{
|
||||
// Edit the log file name
|
||||
std::string FileEnding = ".log";
|
||||
std::string FileName = Name;
|
||||
std::string FullFilename = (FileName + FileEnding);
|
||||
|
||||
// Open the file handle
|
||||
__fStdOut = fopen(FullFilename.c_str(), "w");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Close the console window and close the eventual file handle */
|
||||
void Close()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
FreeConsole(); // Close the console window
|
||||
#endif
|
||||
if(__fStdOut) fclose(__fStdOut); // Close the file handle
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Print to screen and file
|
||||
int Print(const char *fmt, ...)
|
||||
{
|
||||
// Maximum bytes, mind this value to avoid an overrun
|
||||
static const int MAX_BYTES = 1024*20;
|
||||
|
||||
#if defined(_WIN32)
|
||||
if(__hStdOut)
|
||||
{
|
||||
#endif
|
||||
char s[MAX_BYTES];
|
||||
va_list argptr;
|
||||
int cnt; // To store the vsnprintf return message
|
||||
|
||||
va_start(argptr, fmt);
|
||||
cnt = vsnprintf(s, MAX_BYTES, fmt, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
|
||||
#if defined(_WIN32)
|
||||
DWORD cCharsWritten; // We will get a value back here
|
||||
|
||||
WriteConsole(__hStdOut, s, (DWORD)strlen(s), &cCharsWritten, NULL);
|
||||
#else
|
||||
fprintf(stderr, "%s", s);
|
||||
#endif
|
||||
// Write to the file
|
||||
if(__fStdOut)
|
||||
{
|
||||
fprintf(__fStdOut, "%s", s);
|
||||
fflush(__fStdOut); // Write file now, don't wait
|
||||
}
|
||||
|
||||
return(cnt);
|
||||
|
||||
#if defined(_WIN32)
|
||||
} else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Clear console screen
|
||||
void ClearScreen()
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
if(__hStdOut) // Check that we have a window handle
|
||||
{
|
||||
COORD coordScreen = { 0, 0 };
|
||||
DWORD cCharsWritten;
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
DWORD dwConSize;
|
||||
|
||||
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
GetConsoleScreenBufferInfo(hConsole, &csbi);
|
||||
dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
|
||||
FillConsoleOutputCharacter(hConsole, TEXT(' '), dwConSize,
|
||||
coordScreen, &cCharsWritten);
|
||||
GetConsoleScreenBufferInfo(hConsole, &csbi);
|
||||
FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize,
|
||||
coordScreen, &cCharsWritten);
|
||||
SetConsoleCursorPosition(hConsole, coordScreen);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Get window handle of console window to be able to resize it. We use
|
||||
GetConsoleTitle() and FindWindow() to locate the console window handle. */
|
||||
#if defined(_WIN32)
|
||||
HWND GetHwnd(void)
|
||||
{
|
||||
#define MY_BUFSIZE 1024 // Buffer size for console window titles
|
||||
HWND hwndFound; // This is what is returned to the caller
|
||||
char pszNewWindowTitle[MY_BUFSIZE]; // Contains fabricated WindowTitle
|
||||
char pszOldWindowTitle[MY_BUFSIZE]; // Contains original WindowTitle
|
||||
|
||||
// Fetch current window title.
|
||||
GetConsoleTitle(pszOldWindowTitle, MY_BUFSIZE);
|
||||
|
||||
// Format a "unique" NewWindowTitle
|
||||
wsprintf(pszNewWindowTitle, "%d/%d", GetTickCount(), GetCurrentProcessId());
|
||||
|
||||
// Change current window title
|
||||
SetConsoleTitle(pszNewWindowTitle);
|
||||
|
||||
// Ensure window title has been updated
|
||||
Sleep(40);
|
||||
|
||||
// Look for NewWindowTitle
|
||||
hwndFound = FindWindow(NULL, pszNewWindowTitle);
|
||||
|
||||
// Restore original window title
|
||||
SetConsoleTitle(pszOldWindowTitle);
|
||||
|
||||
return(hwndFound);
|
||||
}
|
||||
#endif // _WIN32
|
||||
|
||||
} // namespace
|
|
@ -1,52 +0,0 @@
|
|||
// 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/
|
||||
|
||||
#ifndef _CONSOLE_H
|
||||
#define _CONSOLE_H
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Includes
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
#include <iostream>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
//////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Declarations
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
namespace Console
|
||||
{
|
||||
|
||||
// Settings
|
||||
extern bool WriteToFile;
|
||||
|
||||
// Functions
|
||||
void Open(int Width = 80, int Height = 100, char * Name = "Console", bool File = false);
|
||||
void Close();
|
||||
int Print(const char *fmt, ...);
|
||||
void ClearScreen();
|
||||
#ifdef _WIN32
|
||||
HWND GetHwnd(void);
|
||||
#endif
|
||||
|
||||
} // Console
|
||||
///////////////////////////////
|
||||
|
||||
|
||||
#endif // _CONSOLE_H
|
|
@ -1,351 +0,0 @@
|
|||
// 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/
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Include
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
#include <stdio.h> // System
|
||||
|
||||
#include "Common.h" // Common
|
||||
#include "StringUtil.h"
|
||||
#include "LogManager.h"
|
||||
#include "Timer.h"
|
||||
|
||||
#include "PowerPC/PowerPC.h" // Core
|
||||
#include "PowerPC/SymbolDB.h" // for g_symbolDB
|
||||
#include "Debugger/Debugger_SymbolMap.h"
|
||||
/////////////////////////
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Declarations and definitions
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
LogManager::SMessage (*LogManager::m_Messages)[MAX_MESSAGES];
|
||||
int LogManager::m_nextMessages[LogManager::VERBOSITY_LEVELS + 1];
|
||||
CDebugger_Log* LogManager::m_Log[LogTypes::NUMBER_OF_LOGS + (LogManager::VERBOSITY_LEVELS * 100)];
|
||||
int LogManager::m_activeLog = LogTypes::MASTER_LOG;
|
||||
bool LogManager::m_bDirty = true;
|
||||
bool LogManager::m_bInitialized = false;
|
||||
CDebugger_LogSettings* LogManager::m_LogSettings = NULL;
|
||||
/////////////////////////
|
||||
|
||||
|
||||
void __Log(int log, const char *format, ...)
|
||||
{
|
||||
char* temp = (char*)alloca(strlen(format)+512);
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
CharArrayFromFormatV(temp, 512, format, args);
|
||||
va_end(args);
|
||||
LogManager::Log((LogTypes::LOG_TYPE)log, temp);
|
||||
}
|
||||
|
||||
void __Logv(int log, int v, const char *format, ...)
|
||||
{
|
||||
char* temp = (char*)alloca(strlen(format)+512);
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
CharArrayFromFormatV(temp, 512, format, args);
|
||||
va_end(args);
|
||||
LogManager::Log((LogTypes::LOG_TYPE)(log + v*100), temp);
|
||||
}
|
||||
|
||||
CDebugger_Log::CDebugger_Log(const char* _szShortName, const char* _szName, int a) :
|
||||
m_bLogToFile(true), // write to file or not
|
||||
m_bShowInLog(false),
|
||||
m_bEnable(true),
|
||||
m_pFile(NULL)
|
||||
{
|
||||
strcpy((char*)m_szName, _szName);
|
||||
strcpy((char*)m_szShortName_, _szShortName);
|
||||
sprintf((char*)m_szShortName, "%s%i", _szShortName, a);
|
||||
sprintf((char*)m_szFilename, FULL_LOGS_DIR "%s%i.txt", _szName, a);
|
||||
|
||||
unlink(m_szFilename);
|
||||
}
|
||||
|
||||
CDebugger_Log::~CDebugger_Log(void)
|
||||
{
|
||||
if (m_pFile)
|
||||
{
|
||||
fclose(m_pFile);
|
||||
m_pFile = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// we may need to declare these
|
||||
CDebugger_LogSettings::CDebugger_LogSettings() {}
|
||||
CDebugger_LogSettings::~CDebugger_LogSettings(void) {}
|
||||
|
||||
void CDebugger_Log::Init()
|
||||
{
|
||||
#if LOGLEVEL > 0
|
||||
m_pFile = fopen(m_szFilename, "wtb");
|
||||
#endif
|
||||
}
|
||||
|
||||
void CDebugger_Log::Shutdown()
|
||||
{
|
||||
#if LOGLEVEL > 0
|
||||
if (m_pFile != NULL)
|
||||
{
|
||||
fclose(m_pFile);
|
||||
m_pFile = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void LogManager::Init()
|
||||
{
|
||||
m_Messages = new SMessage[LogManager::VERBOSITY_LEVELS + 1][MAX_MESSAGES];
|
||||
m_bDirty = true;
|
||||
|
||||
// create log files
|
||||
for(int i = 0; i <= LogManager::VERBOSITY_LEVELS; i++)
|
||||
{
|
||||
m_Log[LogTypes::MASTER_LOG + i*100] = new CDebugger_Log("*", "Master Log", i);
|
||||
m_Log[LogTypes::COMMON + i*100] = new CDebugger_Log("COMMON", "Common Lib", i);
|
||||
m_Log[LogTypes::DISCIO + i*100] = new CDebugger_Log("DISCIO", "Disc IO", i);
|
||||
m_Log[LogTypes::BOOT + i*100] = new CDebugger_Log("BOOT", "Boot", i);
|
||||
m_Log[LogTypes::PIXELENGINE + i*100] = new CDebugger_Log("PE", "PixelEngine", i);
|
||||
m_Log[LogTypes::COMMANDPROCESSOR + i*100] = new CDebugger_Log("CP", "CommandProc", i);
|
||||
m_Log[LogTypes::VIDEOINTERFACE + i*100] = new CDebugger_Log("VI", "VideoInt", i);
|
||||
m_Log[LogTypes::SERIALINTERFACE + i*100] = new CDebugger_Log("SI", "SerialInt", i);
|
||||
m_Log[LogTypes::PERIPHERALINTERFACE + i*100]= new CDebugger_Log("PI", "PeripheralInt", i);
|
||||
m_Log[LogTypes::MEMMAP + i*100] = new CDebugger_Log("MI", "MI & memmap", i);
|
||||
m_Log[LogTypes::STREAMINGINTERFACE + i*100] = new CDebugger_Log("Stream", "StreamingInt", i);
|
||||
m_Log[LogTypes::DSPINTERFACE + i*100] = new CDebugger_Log("DSP", "DSPInterface", i);
|
||||
m_Log[LogTypes::DVDINTERFACE + i*100] = new CDebugger_Log("DVD", "DVDInterface", i);
|
||||
m_Log[LogTypes::GPFIFO + i*100] = new CDebugger_Log("GP", "GPFifo", i);
|
||||
m_Log[LogTypes::EXPANSIONINTERFACE + i*100] = new CDebugger_Log("EXI", "ExpansionInt", i);
|
||||
m_Log[LogTypes::AUDIO_INTERFACE + i*100] = new CDebugger_Log("AI", "AudioInt", i);
|
||||
m_Log[LogTypes::GEKKO + i*100] = new CDebugger_Log("GEKKO", "IBM CPU", i);
|
||||
m_Log[LogTypes::HLE + i*100] = new CDebugger_Log("HLE", "HLE", i);
|
||||
m_Log[LogTypes::DSPHLE + i*100] = new CDebugger_Log("DSPHLE", "DSP HLE", i);
|
||||
m_Log[LogTypes::VIDEO + i*100] = new CDebugger_Log("Video", "Video Plugin", i);
|
||||
m_Log[LogTypes::AUDIO + i*100] = new CDebugger_Log("Audio", "Audio Plugin", i);
|
||||
m_Log[LogTypes::DYNA_REC + i*100] = new CDebugger_Log("DYNA", "Dynamic Recompiler", i);
|
||||
m_Log[LogTypes::CONSOLE + i*100] = new CDebugger_Log("CONSOLE", "Dolphin Console", i);
|
||||
m_Log[LogTypes::OSREPORT + i*100] = new CDebugger_Log("OSREPORT", "OSReport", i);
|
||||
m_Log[LogTypes::WII_IOB + i*100] = new CDebugger_Log("WII_IOB", "WII IO Bridge", i);
|
||||
m_Log[LogTypes::WII_IPC + i*100] = new CDebugger_Log("WII_IPC", "WII IPC", i);
|
||||
m_Log[LogTypes::WII_IPC_HLE + i*100] = new CDebugger_Log("WII_IPC_HLE", "WII IPC HLE", i);
|
||||
m_Log[LogTypes::WII_IPC_DVD + i*100] = new CDebugger_Log("WII_IPC_DVD", "WII IPC DVD", i);
|
||||
m_Log[LogTypes::WII_IPC_ES + i*100] = new CDebugger_Log("WII_IPC_ES", "WII IPC ES", i);
|
||||
m_Log[LogTypes::WII_IPC_FILEIO + i*100] = new CDebugger_Log("WII_IPC_FILEIO", "WII IPC FILEIO", i);
|
||||
m_Log[LogTypes::WII_IPC_SD + i*100] = new CDebugger_Log("WII_IPC_SD", "WII IPC SD", i);
|
||||
m_Log[LogTypes::WII_IPC_NET + i*100] = new CDebugger_Log("WII_IPC_NET", "WII IPC NET", i);
|
||||
m_Log[LogTypes::WII_IPC_WIIMOTE + i*100] = new CDebugger_Log("WII_IPC_WIIMOTE", "WII IPC WIIMOTE", i);
|
||||
m_Log[LogTypes::ACTIONREPLAY + i*100] = new CDebugger_Log("ActionReplay", "ActionReplay", i);
|
||||
|
||||
m_nextMessages[i] = 0; // initiate to zero
|
||||
}
|
||||
|
||||
// create the files
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
|
||||
{
|
||||
for (int j = 0; j <= LogManager::VERBOSITY_LEVELS; j++)
|
||||
{
|
||||
m_Log[j*100 + i]->Init();
|
||||
}
|
||||
}
|
||||
m_bInitialized = true;
|
||||
}
|
||||
|
||||
|
||||
void LogManager::Clear()
|
||||
{
|
||||
for (int v = 0; v <= LogManager::VERBOSITY_LEVELS; v++)
|
||||
{
|
||||
for (int i = 0; i < MAX_MESSAGES; i++)
|
||||
{
|
||||
strcpy(m_Messages[v][i].m_szMessage,"");
|
||||
m_Messages[v][i].m_dwMsgLen = 0;
|
||||
m_Messages[v][i].m_bInUse = false;
|
||||
}
|
||||
m_nextMessages[v] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// __________________________________________________________________________________________________
|
||||
// Shutdown
|
||||
//
|
||||
void LogManager::Shutdown()
|
||||
{
|
||||
m_bInitialized = false;
|
||||
|
||||
// Delete all loggers
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
|
||||
{
|
||||
for (int j = 0; j < VERBOSITY_LEVELS; j++)
|
||||
{
|
||||
int id = i + j*100;
|
||||
if (m_Log[id] != NULL)
|
||||
{
|
||||
m_Log[id]->Shutdown();
|
||||
delete m_Log[id];
|
||||
m_Log[id] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delete [] m_Messages;
|
||||
}
|
||||
|
||||
|
||||
// ==========================================================================================
|
||||
// The function that finally writes the log.
|
||||
// ---------------
|
||||
void LogManager::Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...)
|
||||
{
|
||||
static u32 lastPC;
|
||||
static std::string lastSymbol;
|
||||
|
||||
if (m_LogSettings == NULL)
|
||||
return;
|
||||
|
||||
// get the current verbosity level and type
|
||||
// TODO: Base 100 is bad for speed.
|
||||
int v = _type / 100;
|
||||
int type = _type % 100;
|
||||
|
||||
// security checks
|
||||
if (m_Log[_type] == NULL || !m_Log[_type]->m_bEnable
|
||||
|| _type > (LogTypes::NUMBER_OF_LOGS + LogManager::VERBOSITY_LEVELS * 100)
|
||||
|| _type < 0)
|
||||
return;
|
||||
|
||||
// prepare message
|
||||
char Msg[512];
|
||||
va_list ap;
|
||||
va_start(ap, _fmt);
|
||||
vsprintf(Msg, _fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
static u32 count = 0;
|
||||
char* Msg2 = (char*)alloca(strlen(_fmt)+512);
|
||||
|
||||
// Warning: Getting the function name this often is very demanding on the CPU.
|
||||
// I have limited it to the two lowest verbosity levels because of that. I've also
|
||||
// added a simple caching function so that we don't search again if we get the same
|
||||
// question again.
|
||||
const char *symbol;
|
||||
|
||||
if ((v == 0 || v == 1) && lastPC != PC && LogManager::m_LogSettings->bResolve)
|
||||
{
|
||||
symbol = g_symbolDB.GetDescription(PC);
|
||||
lastSymbol = symbol;
|
||||
lastPC = PC;
|
||||
}
|
||||
else if (lastPC == PC && LogManager::m_LogSettings->bResolve)
|
||||
{
|
||||
symbol = lastSymbol.c_str();
|
||||
}
|
||||
else
|
||||
{
|
||||
symbol = "---";
|
||||
}
|
||||
|
||||
int Index = 1;
|
||||
const char *eol = "\n";
|
||||
if (Index > 0)
|
||||
{
|
||||
sprintf(Msg2, "%i %s: %x %s (%s, %08x) : %s%s",
|
||||
++count,
|
||||
Common::Timer::GetTimeFormatted().c_str(),
|
||||
PowerPC::ppcState.DebugCount,
|
||||
m_Log[_type]->m_szShortName_, // (CONSOLE etc)
|
||||
symbol, PC, // current PC location (name, address)
|
||||
Msg, eol);
|
||||
}
|
||||
|
||||
// ==========================================================================================
|
||||
/* Here we have two options
|
||||
1. Verbosity mode where level 0 verbosity logs will be written to all verbosity
|
||||
levels. Given that logging is enabled for that level. Level 1 verbosity will
|
||||
only be written to level 1, 2, 3 and so on.
|
||||
2. Unify mode where everything is written to the last message struct and the
|
||||
last file */
|
||||
// ---------------
|
||||
|
||||
// Check if we should do a unified write to a single file
|
||||
if (m_LogSettings->bUnify)
|
||||
{
|
||||
// prepare the right id
|
||||
int id = VERBOSITY_LEVELS*100 + type;
|
||||
int ver = VERBOSITY_LEVELS;
|
||||
|
||||
// write to memory
|
||||
m_Messages[ver][m_nextMessages[ver]].Set((LogTypes::LOG_TYPE)id, v, Msg2);
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// Write to file
|
||||
// ---------------
|
||||
if (m_Log[id]->m_pFile && m_Log[id]->m_bLogToFile)
|
||||
fprintf(m_Log[id]->m_pFile, "%s", Msg2);
|
||||
if (m_Log[ver*100 + LogTypes::MASTER_LOG] && m_Log[ver*100 + LogTypes::MASTER_LOG]->m_pFile
|
||||
&& m_LogSettings->bWriteMaster)
|
||||
fprintf(m_Log[ver*100 + LogTypes::MASTER_LOG]->m_pFile, "%s", Msg2);
|
||||
|
||||
/* In case it crashes write now to make sure you get the last messages.
|
||||
Is this slower than caching it? Most likely yes, fflush can be really slow.*/
|
||||
//fflush(m_Log[id]->m_pFile);
|
||||
//fflush(m_Log[ver*100 + LogTypes::MASTER_LOG]->m_pFile);
|
||||
|
||||
printf("%s", Msg2); // write to console screen
|
||||
|
||||
// this limits the memory space used for the memory logs to MAX_MESSAGES rows
|
||||
m_nextMessages[ver]++;
|
||||
if (m_nextMessages[ver] >= MAX_MESSAGES)
|
||||
m_nextMessages[ver] = 0;
|
||||
}
|
||||
else // write to separate files and structs
|
||||
{
|
||||
for (int i = VERBOSITY_LEVELS; i >= v ; i--)
|
||||
{
|
||||
// prepare the right id
|
||||
int id = i*100 + type;
|
||||
|
||||
// write to memory
|
||||
m_Messages[i][m_nextMessages[i]].Set((LogTypes::LOG_TYPE)id, v, Msg2);
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// Write to file
|
||||
// ---------------
|
||||
if (m_Log[id]->m_pFile && m_Log[id]->m_bLogToFile)
|
||||
fprintf(m_Log[id]->m_pFile, "%s", Msg2);
|
||||
if (m_Log[i*100 + LogTypes::MASTER_LOG] && m_Log[i*100 + LogTypes::MASTER_LOG]->m_pFile
|
||||
&& m_LogSettings->bWriteMaster)
|
||||
fprintf(m_Log[i*100 + LogTypes::MASTER_LOG]->m_pFile, "%s", Msg2);
|
||||
|
||||
// Write now. Is this slower than caching it?
|
||||
//fflush(m_Log[id]->m_pFile);
|
||||
//fflush(m_Log[i*100 + LogTypes::MASTER_LOG]->m_pFile);
|
||||
|
||||
printf("%s", Msg2); // write to console screen
|
||||
|
||||
// this limits the memory space used for the memory logs to MAX_MESSAGES rows
|
||||
m_nextMessages[i]++;
|
||||
if (m_nextMessages[i] >= MAX_MESSAGES)
|
||||
m_nextMessages[i] = 0;
|
||||
// ---------------
|
||||
}
|
||||
}
|
||||
m_bDirty = true; // tell LogWindow that the log has been updated
|
||||
}
|
|
@ -1,125 +0,0 @@
|
|||
// 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/
|
||||
|
||||
|
||||
// Dolphin Logging framework. Needs a good ol' spring cleaning methinks.
|
||||
|
||||
#ifndef _LOGMANAGER_H
|
||||
#define _LOGMANAGER_H
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
class CLogWindow;
|
||||
|
||||
// should be inside the LogManager ...
|
||||
struct CDebugger_Log
|
||||
{
|
||||
char m_szName[128];
|
||||
char m_szShortName[32];
|
||||
char m_szShortName_[32]; // save the unadjusted originals here ( ???? )
|
||||
char m_szFilename[256];
|
||||
|
||||
bool m_bLogToFile;
|
||||
bool m_bShowInLog;
|
||||
bool m_bEnable;
|
||||
FILE *m_pFile;
|
||||
|
||||
void Init();
|
||||
void Shutdown();
|
||||
|
||||
CDebugger_Log(const char* _szShortName, const char* _szName, int a);
|
||||
~CDebugger_Log();
|
||||
};
|
||||
|
||||
// make a variable that can be accessed from both LogManager.cpp and LogWindow.cpp
|
||||
struct CDebugger_LogSettings
|
||||
{
|
||||
int m_iVerbosity; // verbosity level 0 - 2
|
||||
bool bResolve;
|
||||
bool bWriteMaster;
|
||||
bool bUnify;
|
||||
|
||||
CDebugger_LogSettings();
|
||||
~CDebugger_LogSettings();
|
||||
};
|
||||
|
||||
class LogManager
|
||||
{
|
||||
#define MAX_MESSAGES 8000 // the old value was to large
|
||||
#define MAX_MSGLEN 256
|
||||
public:
|
||||
// Message
|
||||
struct SMessage
|
||||
{
|
||||
bool m_bInUse;
|
||||
LogTypes::LOG_TYPE m_type;
|
||||
int m_verbosity;
|
||||
char m_szMessage[MAX_MSGLEN];
|
||||
int m_dwMsgLen;
|
||||
|
||||
// constructor
|
||||
SMessage() :
|
||||
m_bInUse(false)
|
||||
{}
|
||||
|
||||
// set
|
||||
void Set(LogTypes::LOG_TYPE _type, int _verbosity, char* _szMessage)
|
||||
{
|
||||
strncpy(m_szMessage, _szMessage, MAX_MSGLEN-1);
|
||||
m_szMessage[MAX_MSGLEN-1] = 0;
|
||||
m_dwMsgLen = (int)strlen(m_szMessage);
|
||||
|
||||
if (m_dwMsgLen == (MAX_MSGLEN-1))
|
||||
{
|
||||
m_szMessage[m_dwMsgLen-2] = 0xd;
|
||||
m_szMessage[m_dwMsgLen-1] = 0xa;
|
||||
}
|
||||
m_szMessage[m_dwMsgLen] = 0;
|
||||
|
||||
m_type = _type;
|
||||
m_verbosity = _verbosity;
|
||||
m_bInUse = true; // turn on this message line
|
||||
}
|
||||
//
|
||||
static void Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...);
|
||||
};
|
||||
|
||||
private:
|
||||
enum LOG_SETTINGS
|
||||
{
|
||||
VERBOSITY_LEVELS = LOGLEVEL
|
||||
};
|
||||
|
||||
friend class CDebugger_LogWindow;
|
||||
friend class CLogWindow;
|
||||
static SMessage (*m_Messages)[MAX_MESSAGES];
|
||||
static int m_nextMessages[VERBOSITY_LEVELS + 1];
|
||||
static int m_activeLog;
|
||||
static bool m_bDirty;
|
||||
static bool m_bInitialized;
|
||||
static CDebugger_LogSettings* m_LogSettings;
|
||||
static CDebugger_Log* m_Log[LogTypes::NUMBER_OF_LOGS + (VERBOSITY_LEVELS * 100)]; // make 326 of them
|
||||
|
||||
public:
|
||||
static void Init();
|
||||
static void Clear(void);
|
||||
static void Shutdown();
|
||||
static int GetLevel() {return LOGLEVEL;}
|
||||
static void Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,520 +0,0 @@
|
|||
// 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/
|
||||
|
||||
#include "Debugger.h"
|
||||
#include "LogManager.h"
|
||||
|
||||
#include <wx/button.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/listbox.h>
|
||||
#include <wx/checklst.h>
|
||||
|
||||
#include "Core.h" // for Core::GetState()
|
||||
#include "LogWindow.h"
|
||||
#include "Console.h"
|
||||
|
||||
BEGIN_EVENT_TABLE(CLogWindow, wxDialog)
|
||||
EVT_BUTTON(IDM_SUBMITCMD, CLogWindow::OnSubmit)
|
||||
EVT_BUTTON(IDM_UPDATELOG, CLogWindow::OnUpdateLog)
|
||||
EVT_BUTTON(IDM_CLEARLOG, CLogWindow::OnClear)
|
||||
EVT_BUTTON(IDM_ENABLEALL, CLogWindow::OnEnableAll)
|
||||
EVT_CHECKLISTBOX(IDM_OPTIONS, CLogWindow::OnOptionsCheck)
|
||||
EVT_CHECKLISTBOX(IDM_LOGCHECKS, CLogWindow::OnLogCheck)
|
||||
EVT_RADIOBOX(IDM_RADIO0, CLogWindow::OnRadioChange)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
CLogWindow::CLogWindow(wxWindow* parent)
|
||||
: wxDialog(parent, wxID_ANY, _T("Log/Console"), wxPoint(100, 700), wxSize(800, 270),
|
||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
||||
{
|
||||
wxBoxSizer* sizerTop = new wxBoxSizer(wxHORIZONTAL), // buttons
|
||||
* sizerUber = new wxBoxSizer(wxHORIZONTAL), // whole plane
|
||||
* sizerBig = new wxBoxSizer(wxVERTICAL), // RIGHT sizer
|
||||
* sizerBottom = new wxBoxSizer(wxHORIZONTAL), // submit row
|
||||
* sizerLeft = new wxBoxSizer(wxVERTICAL); // LEFT sizer
|
||||
|
||||
// left checkboxes and radio boxes -----------------------------------
|
||||
int m_radioBoxNChoices[1];
|
||||
wxString m_radioBoxChoices0[LOGLEVEL+1];
|
||||
for (int i=0;i<=LOGLEVEL;i++) {
|
||||
m_radioBoxChoices0[i] = wxString::Format(wxT("%d"), i);
|
||||
}
|
||||
|
||||
m_radioBoxNChoices[0] = sizeof( m_radioBoxChoices0 ) / sizeof( wxString );
|
||||
m_RadioBox[0] = new wxRadioBox( this, IDM_RADIO0, wxT("Verbosity"),
|
||||
wxDefaultPosition, wxDefaultSize, m_radioBoxNChoices[0], m_radioBoxChoices0, 1, wxRA_SPECIFY_ROWS);
|
||||
|
||||
wxStaticBoxSizer * m_optionsSizer = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Settings"));
|
||||
m_options = new wxCheckListBox(this, IDM_OPTIONS, wxDefaultPosition, wxDefaultSize,
|
||||
0, NULL, wxNO_BORDER);
|
||||
m_options->Append(wxT("Unify"));
|
||||
m_options->Append(wxT("Resolve symbols"));
|
||||
m_options->Append(wxT("Write master"));
|
||||
m_options->Append(wxT("Show unique"));
|
||||
m_optionsSizer->Add(m_options, 0, 0, 0);
|
||||
|
||||
// I could not find any transparency setting and it would not automatically space correctly
|
||||
m_options->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
|
||||
//m_options->SetMinSize(wxSize(m_options->GetSize().GetWidth() - 40,m_options->GetCount() * 15));
|
||||
#ifdef _WIN32
|
||||
for (unsigned int i = 0; i < m_options->GetCount(); ++i)
|
||||
m_options->GetItem(i)->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
|
||||
#endif
|
||||
|
||||
m_checks = new wxCheckListBox(this, IDM_LOGCHECKS, wxDefaultPosition, wxSize(120, 280));
|
||||
|
||||
// finally add it to the sizer
|
||||
sizerLeft->Add(m_RadioBox[0], 0, wxGROW);
|
||||
sizerLeft->Add(m_optionsSizer, 0, wxGROW);
|
||||
sizerLeft->Add(m_checks, 1, wxGROW);
|
||||
|
||||
|
||||
// right windows -----------------------------------------------------
|
||||
m_log = new wxTextCtrl(this, IDM_LOG, _T(""), wxDefaultPosition, wxSize(600, 120),
|
||||
wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP);
|
||||
m_log->SetFont(DebuggerFont);
|
||||
m_cmdline = new wxTextCtrl(this, wxID_ANY, _T(""), wxDefaultPosition);
|
||||
m_cmdline->SetFont(DebuggerFont);
|
||||
wxButton* btn = new wxButton(this, IDM_SUBMITCMD, _T("Submit"));
|
||||
|
||||
sizerTop->Add(new wxButton(this, IDM_UPDATELOG, _T("Update")));
|
||||
sizerTop->Add(new wxButton(this, IDM_CLEARLOG, _T("Clear")));
|
||||
sizerTop->Add(new wxButton(this, IDM_ENABLEALL, _T("Enable all")));
|
||||
|
||||
sizerBottom->Add(m_cmdline, 8, wxGROW | wxRIGHT, 5);
|
||||
sizerBottom->Add(btn, 1, wxGROW, 0);
|
||||
|
||||
sizerBig->Add(sizerTop, 0, wxGROW);
|
||||
sizerBig->Add(m_log, 1, wxGROW | wxSHRINK);
|
||||
sizerBig->Add(sizerBottom, 0, wxGROW);
|
||||
|
||||
sizerUber->Add(sizerLeft, 0, wxGROW);
|
||||
sizerUber->Add(sizerBig, 1, wxGROW);
|
||||
|
||||
SetSizer(sizerUber);
|
||||
SetAffirmativeId(IDM_SUBMITCMD);
|
||||
|
||||
// declare this now to be able to use it in Load()
|
||||
LogManager::m_LogSettings = new CDebugger_LogSettings;
|
||||
|
||||
//sizerTop->SetSizeHints(this);
|
||||
//sizerTop->Fit(this);
|
||||
UpdateChecks();
|
||||
m_cmdline->SetFocus();
|
||||
m_bCheckDirty = false;
|
||||
|
||||
/* Load ini from here instead of from CodeWindow.cpp to make sure that
|
||||
settings are loaded if the window is showing */
|
||||
IniFile file;
|
||||
file.Load(DEBUGGER_CONFIG_FILE);
|
||||
Load(file);
|
||||
}
|
||||
|
||||
|
||||
// =======================================================
|
||||
// This is called from the CodeWindow deconstruction function.
|
||||
// -------------
|
||||
void CLogWindow::Save(IniFile& _IniFile) const
|
||||
{
|
||||
_IniFile.Set("LogWindow", "x", GetPosition().x);
|
||||
_IniFile.Set("LogWindow", "y", GetPosition().y);
|
||||
_IniFile.Set("LogWindow", "w", GetSize().GetWidth());
|
||||
_IniFile.Set("LogWindow", "h", GetSize().GetHeight());
|
||||
}
|
||||
|
||||
|
||||
// =======================================================
|
||||
// This is called from the class construction function.
|
||||
// -------------
|
||||
void CLogWindow::Load(IniFile& _IniFile)
|
||||
{
|
||||
int x,y,w,h;
|
||||
_IniFile.Get("LogWindow", "x", &x, GetPosition().x);
|
||||
_IniFile.Get("LogWindow", "y", &y, GetPosition().y);
|
||||
_IniFile.Get("LogWindow", "w", &w, GetSize().GetWidth());
|
||||
_IniFile.Get("LogWindow", "h", &h, GetSize().GetHeight());
|
||||
SetSize(x, y, w, h);
|
||||
|
||||
// Load verbosity setting
|
||||
int v;
|
||||
_IniFile.Get("LogWindow", "Verbosity", &v, m_RadioBox[0]->GetSelection());
|
||||
m_RadioBox[0]->SetSelection(v);
|
||||
LogManager::m_LogSettings->m_iVerbosity = v;
|
||||
|
||||
// Load options
|
||||
_IniFile.Get("LogWindow", "Unify", &LogManager::m_LogSettings->bUnify, false);
|
||||
_IniFile.Get("LogWindow", "ResolveSymbols", &LogManager::m_LogSettings->bResolve, false);
|
||||
_IniFile.Get("LogWindow", "WriteMaster", &LogManager::m_LogSettings->bWriteMaster, false);
|
||||
_IniFile.Get("LogWindow", "OnlyUnique", &bOnlyUnique, false);
|
||||
m_options->Check(0, LogManager::m_LogSettings->bUnify);
|
||||
m_options->Check(1, LogManager::m_LogSettings->bResolve);
|
||||
m_options->Check(2, LogManager::m_LogSettings->bWriteMaster);
|
||||
m_options->Check(3, bOnlyUnique);
|
||||
|
||||
// If we use the Unify option
|
||||
if(LogManager::m_LogSettings->bUnify)
|
||||
{
|
||||
m_RadioBox[0]->SetSelection(LogManager::VERBOSITY_LEVELS);
|
||||
LogManager::m_LogSettings->m_iVerbosity = LogManager::VERBOSITY_LEVELS;
|
||||
m_RadioBox[0]->Disable();
|
||||
}
|
||||
}
|
||||
|
||||
void CLogWindow::OnSubmit(wxCommandEvent& event)
|
||||
{
|
||||
Console_Submit(m_cmdline->GetValue().To8BitData());
|
||||
m_cmdline->SetValue(_T(""));
|
||||
NotifyUpdate();
|
||||
}
|
||||
|
||||
|
||||
void CLogWindow::OnClear(wxCommandEvent& event)
|
||||
{
|
||||
if (Core::GetState() != Core::CORE_UNINITIALIZED) // avoid crash
|
||||
{
|
||||
LogManager::Clear();
|
||||
INFO_LOG(MASTER_LOG, "(log cleared).");
|
||||
NotifyUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// Enable or disable all boxes for the current verbosity level and save the changes.
|
||||
// -------------
|
||||
void CLogWindow::OnEnableAll(wxCommandEvent& event)
|
||||
{
|
||||
if (!LogManager::m_Log[0])
|
||||
return;
|
||||
static bool enable = true;
|
||||
int v = LogManager::m_LogSettings->m_iVerbosity;
|
||||
IniFile ini;
|
||||
ini.Load(DEBUGGER_CONFIG_FILE);
|
||||
|
||||
// Unified case. Write the same to all levels.
|
||||
if(m_options->IsChecked(0))
|
||||
{
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
|
||||
{
|
||||
m_checks->Check(i, enable); // get all from the current selection
|
||||
for (int j = 0; j <= LogManager::VERBOSITY_LEVELS; j++)
|
||||
{
|
||||
LogManager::m_Log[i + j*100]->m_bEnable = enable;
|
||||
LogManager::m_Log[i + j*100]->m_bShowInLog = enable;
|
||||
ini.Set("LogManager", LogManager::m_Log[i + j*100]->m_szShortName, enable);
|
||||
}
|
||||
}
|
||||
}
|
||||
else // otherwise only update the current shown level
|
||||
{
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
|
||||
{
|
||||
m_checks->Check(i, enable);
|
||||
LogManager::m_Log[i + v*100]->m_bEnable = enable;
|
||||
LogManager::m_Log[i + v*100]->m_bShowInLog = enable;
|
||||
ini.Set("LogManager", LogManager::m_Log[i + v*100]->m_szShortName, enable);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ini.Save(DEBUGGER_CONFIG_FILE);
|
||||
enable = !enable;
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// Append checkboxes and update checked groups.
|
||||
// -------------
|
||||
void CLogWindow::UpdateChecks()
|
||||
{
|
||||
if (!LogManager::m_bInitialized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// This is only run once to append checkboxes to the wxCheckListBox.
|
||||
if (m_checks->GetCount() == 0)
|
||||
{
|
||||
// [F|RES] hide the window while we fill it... wxwidgets gets trouble if you don't do it
|
||||
// (at least the win version)
|
||||
m_checks->Show(false);
|
||||
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
|
||||
{
|
||||
m_checks->Append(wxString::FromAscii(LogManager::m_Log[i]->m_szName));
|
||||
}
|
||||
|
||||
m_checks->Show(true);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// Load the correct values and enable/disable the right groups
|
||||
// -------------
|
||||
int v = LogManager::m_LogSettings->m_iVerbosity;
|
||||
IniFile ini;
|
||||
ini.Load(DEBUGGER_CONFIG_FILE);
|
||||
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
|
||||
{
|
||||
for (int j = 0; j <= LogManager::VERBOSITY_LEVELS; j++)
|
||||
{
|
||||
bool Enabled = false;
|
||||
ini.Get("LogManager", LogManager::m_Log[i + j*100]->m_szShortName, &Enabled, false);
|
||||
LogManager::m_Log[i + j*100]->m_bEnable = Enabled;
|
||||
LogManager::m_Log[i + j*100]->m_bShowInLog = Enabled;
|
||||
if(j == v) m_checks->Check(i, Enabled);
|
||||
}
|
||||
}
|
||||
|
||||
m_bCheckDirty = true;
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// When an option is changed, save the change
|
||||
// ---------------
|
||||
void CLogWindow::OnOptionsCheck(wxCommandEvent& event)
|
||||
{
|
||||
IniFile ini;
|
||||
ini.Load(DEBUGGER_CONFIG_FILE);
|
||||
|
||||
//PanicAlert("%i", (int)Core::GetState());
|
||||
|
||||
// Unified case. If the core is uninitialized we only disable the radio boxes
|
||||
if(m_options->IsChecked(0) && Core::GetState() == Core::CORE_UNINITIALIZED)
|
||||
{
|
||||
m_RadioBox[0]->SetSelection(LogManager::VERBOSITY_LEVELS);
|
||||
LogManager::m_LogSettings->m_iVerbosity = LogManager::VERBOSITY_LEVELS;
|
||||
m_RadioBox[0]->Disable();
|
||||
}
|
||||
// otherwise we both disable them and update all blocks
|
||||
else if(m_options->IsChecked(0) && Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||
{
|
||||
m_RadioBox[0]->SetSelection(LogManager::VERBOSITY_LEVELS);
|
||||
LogManager::m_LogSettings->m_iVerbosity = LogManager::VERBOSITY_LEVELS;
|
||||
m_RadioBox[0]->Disable();
|
||||
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
|
||||
{
|
||||
bool Enabled = m_checks->IsChecked(i); // get all from the current i
|
||||
for (int j = 0; j <= LogManager::VERBOSITY_LEVELS; j++)
|
||||
{
|
||||
// update groups to enabled or disabled
|
||||
LogManager::m_Log[i + 100*j]->m_bEnable = Enabled;
|
||||
LogManager::m_Log[i + 100*j]->m_bShowInLog = Enabled;
|
||||
|
||||
// update all verbosity levels to this level's Enabled
|
||||
ini.Set("LogManager", LogManager::m_Log[i + 100*j]->m_szShortName, Enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_RadioBox[0]->Enable(true);
|
||||
}
|
||||
|
||||
LogManager::m_LogSettings->bUnify = m_options->IsChecked(0);
|
||||
LogManager::m_LogSettings->bResolve = m_options->IsChecked(1);
|
||||
LogManager::m_LogSettings->bWriteMaster = m_options->IsChecked(2);
|
||||
bOnlyUnique = m_options->IsChecked(3);
|
||||
|
||||
ini.Set("LogWindow", "Unify", m_options->IsChecked(0));
|
||||
ini.Set("LogWindow", "ResolveSymbols", m_options->IsChecked(1));
|
||||
ini.Set("LogWindow", "WriteMaster", m_options->IsChecked(2));
|
||||
ini.Set("LogWindow", "OnlyUnique", m_options->IsChecked(3));
|
||||
ini.Save(DEBUGGER_CONFIG_FILE);
|
||||
if (Core::GetState() != Core::CORE_UNINITIALIZED) UpdateLog();
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// When a checkbox is changed
|
||||
// ---------------
|
||||
void CLogWindow::OnLogCheck(wxCommandEvent& event)
|
||||
{
|
||||
if (!LogManager::m_bInitialized) return;
|
||||
|
||||
IniFile ini;
|
||||
ini.Load(DEBUGGER_CONFIG_FILE);
|
||||
int v = LogManager::m_LogSettings->m_iVerbosity; // current radio button
|
||||
int uni = LogManager::m_LogSettings->bUnify;
|
||||
|
||||
// Unified case
|
||||
if(uni)
|
||||
{
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
|
||||
{
|
||||
for (int j = 0; j <= LogManager::VERBOSITY_LEVELS; j++)
|
||||
{
|
||||
// update groups to enabled or disabled
|
||||
bool Enabled = m_checks->IsChecked(i); // get all from the current i
|
||||
LogManager::m_Log[i + 100*j]->m_bEnable = Enabled;
|
||||
LogManager::m_Log[i + 100*j]->m_bShowInLog = Enabled;
|
||||
|
||||
ini.Set("LogManager", LogManager::m_Log[i + 100*j]->m_szShortName, Enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
|
||||
{
|
||||
// update groups to enabled or disabled
|
||||
bool Enabled = m_checks->IsChecked(i);
|
||||
LogManager::m_Log[i + 100*v]->m_bEnable = Enabled;
|
||||
LogManager::m_Log[i + 100*v]->m_bShowInLog = Enabled;
|
||||
|
||||
ini.Set("LogManager", LogManager::m_Log[i + 100*v]->m_szShortName, Enabled);
|
||||
}
|
||||
}
|
||||
|
||||
ini.Save(DEBUGGER_CONFIG_FILE);
|
||||
|
||||
m_bCheckDirty = true;
|
||||
if (Core::GetState() != Core::CORE_UNINITIALIZED) UpdateLog();
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// When the verbosity level is changed
|
||||
// -------------
|
||||
void CLogWindow::OnRadioChange(wxCommandEvent& event)
|
||||
{
|
||||
// get selection
|
||||
int v = m_RadioBox[0]->GetSelection();
|
||||
|
||||
// save it
|
||||
LogManager::m_LogSettings->m_iVerbosity = v;
|
||||
IniFile ini;
|
||||
ini.Load(DEBUGGER_CONFIG_FILE);
|
||||
ini.Set("LogWindow", "Verbosity", v);
|
||||
ini.Save(DEBUGGER_CONFIG_FILE);
|
||||
|
||||
// This check is because we allow this to be changed before a game has been loaded so
|
||||
// that the boxes do not exist yet
|
||||
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||
{
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
|
||||
{
|
||||
// update groups to enabled or disabled
|
||||
bool Enabled;
|
||||
ini.Get("LogManager", LogManager::m_Log[i + 100*v]->m_szShortName, &Enabled, false);
|
||||
LogManager::m_Log[i + 100*v]->m_bEnable = Enabled;
|
||||
LogManager::m_Log[i + 100*v]->m_bShowInLog = Enabled;
|
||||
m_checks->Check(i, Enabled);
|
||||
}
|
||||
|
||||
m_bCheckDirty = true;
|
||||
UpdateLog();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CLogWindow::OnUpdateLog(wxCommandEvent& event)
|
||||
{
|
||||
if (Core::GetState() != Core::CORE_UNINITIALIZED) UpdateLog();
|
||||
}
|
||||
|
||||
|
||||
void CLogWindow::NotifyUpdate()
|
||||
{
|
||||
UpdateChecks();
|
||||
UpdateLog();
|
||||
}
|
||||
|
||||
|
||||
void CLogWindow::UpdateLog()
|
||||
{
|
||||
static int last = -1;
|
||||
int v = LogManager::m_LogSettings->m_iVerbosity;
|
||||
int i = LogManager::m_nextMessages[v];
|
||||
|
||||
// check if the the log has been updated (ie if it's dirty)
|
||||
if ((last == i) && !m_bCheckDirty)
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_bCheckDirty = false;
|
||||
last = i;
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// Prepare a selection of the memory log to show to screen
|
||||
// ---------------
|
||||
int count = 0;
|
||||
char* p = m_logBuffer;
|
||||
|
||||
// go through all rows
|
||||
while (count < MAX_MESSAGES)
|
||||
{
|
||||
count++;
|
||||
const LogManager::SMessage& message = LogManager::m_Messages[v][i];
|
||||
|
||||
if (message.m_bInUse) // check if the line has a value
|
||||
{
|
||||
int len = message.m_dwMsgLen;
|
||||
|
||||
// this is what we use, I'm not sure why we have this option
|
||||
if (LogManager::m_activeLog == LogTypes::MASTER_LOG)
|
||||
{
|
||||
// only show checkboxed logs
|
||||
if (LogManager::m_Log[message.m_type]->m_bShowInLog)
|
||||
{
|
||||
if(bOnlyUnique) /* don't show lower level messages that have fallen through
|
||||
to this higher level */
|
||||
{
|
||||
if(message.m_verbosity == v)
|
||||
{
|
||||
// memcpy is faster than strcpy
|
||||
memcpy(p, message.m_szMessage, len);
|
||||
p += len;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// memcpy is faster than strcpy
|
||||
memcpy(p, message.m_szMessage, len);
|
||||
p += len;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (message.m_type == LogManager::m_activeLog)
|
||||
{
|
||||
memcpy(p, message.m_szMessage, len);
|
||||
p += len;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
|
||||
if (i >= MAX_MESSAGES)
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
// ---------------
|
||||
|
||||
*p = 0; //end the string
|
||||
m_log->SetValue(wxString::FromAscii(m_logBuffer));
|
||||
m_log->SetInsertionPoint(p - m_logBuffer - 1);
|
||||
m_log->ShowPosition( m_log->GetLastPosition()); // show last line
|
||||
m_log->SetFont(DebuggerFont);
|
||||
m_cmdline->SetFont(DebuggerFont);
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
// 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/
|
||||
|
||||
#ifndef LOGWINDOW_H_
|
||||
#define LOGWINDOW_H_
|
||||
|
||||
class wxTextCtrl;
|
||||
class wxCheckListBox;
|
||||
class IniFile;
|
||||
|
||||
class CLogWindow
|
||||
: public wxDialog
|
||||
{
|
||||
public:
|
||||
|
||||
CLogWindow(wxWindow* parent);
|
||||
void NotifyUpdate();
|
||||
|
||||
void Save(IniFile& _IniFile) const;
|
||||
void Load(IniFile& _IniFile);
|
||||
|
||||
private:
|
||||
|
||||
enum { LogBufferSize = 8 * 1024 * 1024};
|
||||
char m_logBuffer[LogBufferSize];
|
||||
wxTextCtrl* m_log, * m_cmdline;
|
||||
wxCheckListBox* m_checks;
|
||||
wxCheckListBox* m_options;
|
||||
wxRadioBox *m_RadioBox[1]; // radio boxes
|
||||
bool m_bCheckDirty;
|
||||
bool bOnlyUnique;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
void OnSubmit(wxCommandEvent& event);
|
||||
void OnUpdateLog(wxCommandEvent& event);
|
||||
void OnOptionsCheck(wxCommandEvent& event);
|
||||
void OnLogCheck(wxCommandEvent& event);
|
||||
void OnRadioChange(wxCommandEvent& event); // verbosity buttons
|
||||
void OnClear(wxCommandEvent& event);
|
||||
void OnEnableAll(wxCommandEvent& event);
|
||||
|
||||
void UpdateChecks();
|
||||
void UpdateLog();
|
||||
};
|
||||
|
||||
#endif /*LOGWINDOW_H_*/
|
|
@ -51,9 +51,6 @@ CLogWindow::CLogWindow(wxWindow* parent)
|
|||
m_fileLog = m_logManager->getFileListener();
|
||||
m_console = m_logManager->getConsoleListener();
|
||||
|
||||
m_writeFile = true;
|
||||
m_writeConsole = true;
|
||||
|
||||
CreateGUIControls();
|
||||
|
||||
LoadSettings();
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
// 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/
|
||||
|
||||
#include "VideoCommon.h"
|
||||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
|
||||
static FILE* pfLog = NULL;
|
||||
void __Log(const char *fmt, ...)
|
||||
{
|
||||
char* Msg = (char*)alloca(strlen(fmt)+512);
|
||||
va_list ap;
|
||||
|
||||
va_start( ap, fmt );
|
||||
vsnprintf( Msg, strlen(fmt)+512, fmt, ap );
|
||||
va_end( ap );
|
||||
|
||||
g_VideoInitialize.pLog(Msg, FALSE);
|
||||
|
||||
if (pfLog == NULL)
|
||||
pfLog = fopen(FULL_LOGS_DIR "oglgfx.txt", "w");
|
||||
|
||||
if (pfLog != NULL)
|
||||
fwrite(Msg, strlen(Msg), 1, pfLog);
|
||||
#ifdef _WIN32
|
||||
// DWORD tmp;
|
||||
// WriteConsole(hConsole, Msg, (DWORD)strlen(Msg), &tmp, 0);
|
||||
#else
|
||||
//printf("%s", Msg);
|
||||
#endif
|
||||
}
|
||||
|
||||
void __Log(int type, const char *fmt, ...)
|
||||
{
|
||||
char* Msg = (char*)alloca(strlen(fmt)+512);
|
||||
va_list ap;
|
||||
|
||||
va_start( ap, fmt );
|
||||
vsnprintf( Msg, strlen(fmt)+512, fmt, ap );
|
||||
va_end( ap );
|
||||
|
||||
g_VideoInitialize.pLog(Msg, FALSE);
|
||||
|
||||
#ifdef _WIN32
|
||||
// DWORD tmp;
|
||||
// WriteConsole(hConsole, Msg, (DWORD)strlen(Msg), &tmp, 0);
|
||||
#endif
|
||||
}
|
|
@ -943,10 +943,6 @@
|
|||
RelativePath=".\Src\Config.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\Globals.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\Globals.h"
|
||||
>
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
// 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/
|
||||
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
#include <wx/wx.h>
|
||||
#include <wx/filepicker.h>
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/dialog.h>
|
||||
#include <wx/aboutdlg.h>
|
||||
#endif
|
||||
|
||||
#include "Globals.h"
|
||||
|
||||
#include "pluginspecs_video.h"
|
||||
#include "main.h"
|
||||
|
||||
#include "IniFile.h"
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
/* FIXME should be done from logmanager
|
||||
// Open and close the Windows console window
|
||||
|
||||
void OpenConsole()
|
||||
{
|
||||
// Console::Open(100, 300, "OpenGL Plugin Output"); // give room for 300 rows
|
||||
INFO_LOG(CONSOLE, "OpenGL console opened\n");
|
||||
// #ifdef _WIN32
|
||||
MoveWindow(Console::GetHwnd(), 0,400, 1280,550, true); // Move window. Todo: make this
|
||||
// adjustable from the debugging window
|
||||
#endif
|
||||
}
|
||||
|
||||
void CloseConsole()
|
||||
{
|
||||
// Console::Close();
|
||||
}
|
||||
*/
|
||||
|
|
@ -11,7 +11,6 @@ name = "Plugin_VideoOGL"
|
|||
|
||||
files = [
|
||||
'BPStructs.cpp',
|
||||
'Globals.cpp',
|
||||
'Config.cpp',
|
||||
'rasterfont.cpp',
|
||||
'Render.cpp',
|
||||
|
|
Loading…
Reference in New Issue