mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
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:
@@ -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
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user