nakee's new logmanager. added a console window for windows builds (prints to parent console on non-win32). also fix some random wxw bugs: main window's position is saved when using debugger, disabling windows from the tools menu are saved settings, some other small fixes

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2675 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman
2009-03-18 17:17:58 +00:00
parent 03ba466b5b
commit 2301d072a6
120 changed files with 1758 additions and 1103 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Version="9.00"
Name="Common"
ProjectGUID="{C573CAF7-EE6A-458E-8049-16C0BF34C2E9}"
RootNamespace="Common"
@ -538,6 +538,26 @@
</File>
</Filter>
</Filter>
<Filter
Name="Logging"
>
<File
RelativePath=".\Src\ConsoleListener.cpp"
>
</File>
<File
RelativePath=".\Src\ConsoleListener.h"
>
</File>
<File
RelativePath=".\Src\LogManager.cpp"
>
</File>
<File
RelativePath=".\Src\LogManager.h"
>
</File>
</Filter>
<File
RelativePath=".\Src\ABI.cpp"
>
@ -586,14 +606,6 @@
RelativePath=".\Src\CommonTypes.h"
>
</File>
<File
RelativePath=".\Src\ConsoleWindow.cpp"
>
</File>
<File
RelativePath=".\Src\ConsoleWindow.h"
>
</File>
<File
RelativePath=".\Src\CPUDetect.cpp"
>

View File

@ -81,6 +81,7 @@
#define DEBUGGER_CONFIG "Debugger.ini"
#define LOGGER_CONFIG "Logger.ini"
#define TOTALDB "totaldb.dsy"
#define MAIN_LOG "dolphin.log"
#define DEFAULT_GFX_PLUGIN PLUGIN_PREFIX "Plugin_VideoOGL" PLUGIN_SUFFIX
#define DEFAULT_DSP_PLUGIN PLUGIN_PREFIX "Plugin_DSP_HLE" PLUGIN_SUFFIX
@ -148,6 +149,8 @@
#define MAINRAM_DUMP_FILE FULL_DUMP_DIR MEMORY_DUMP_FILE
#define GC_SRAM_FILE FULL_USERDATA_DIR GC_USER_DIR DIR_SEP GC_SRAM
#define MAIN_LOG_FILE FULL_LOGS_DIR MAIN_LOG
// Sys files
#define FONT_ANSI_FILE FULL_GC_SYS_DIR FONT_ANSI
#define FONT_SJIS_FILE FULL_GC_SYS_DIR FONT_SJIS

View File

@ -0,0 +1,137 @@
// 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 <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 "LogManager.h" // Common
/* Start console window - width and height is the size of console window */
ConsoleListener::ConsoleListener(int Width, int Height, char * Name) :
Listener("console")
{
#ifdef _WIN32
// Open the console window and create the window handle for GetStdHandle()
AllocConsole();
// Save the window handle that AllocConsole() created
m_hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
// Set the console window title
SetConsoleTitle(Name);
// Set the total letter space
COORD co = {Width, Height};
SetConsoleScreenBufferSize(m_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(m_hStdOut, TRUE, &coo);
#endif
}
/* Close the console window and close the eventual file handle */
ConsoleListener::~ConsoleListener()
{
#ifdef _WIN32
FreeConsole(); // Close the console window
#else
fflush(NULL);
#endif
}
// Logs the message to screen
void ConsoleListener::Log(LogTypes::LOG_LEVELS, const char *text)
{
#if defined(_WIN32)
DWORD cCharsWritten; // We will get a value back here
WriteConsole(m_hStdOut, text, (DWORD)strlen(text),
&cCharsWritten, NULL);
#else
fprintf(stderr, "%s", text);
#endif
}
// Clear console screen
void ConsoleListener::ClearScreen()
{
#if defined(_WIN32)
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

View File

@ -32,8 +32,6 @@
#include "FileUtil.h"
#include "StringUtil.h"
#include "DynamicLibrary.h"
#include "ConsoleWindow.h"
DynamicLibrary::DynamicLibrary()
{
@ -61,7 +59,6 @@ const char *DllGetLastError()
*/
int DynamicLibrary::Load(const char* filename)
{
INFO_LOG(COMMON, "DL: Loading dynamic library %s", filename);
if (!filename || strlen(filename) == 0) {
@ -85,6 +82,8 @@ int DynamicLibrary::Load(const char* filename)
DEBUG_LOG(COMMON, "DL: LoadLibrary: %s(%p)", filename, library);
if (!library) {
fprintf(stderr, "DL: Error loading DLL %s: %s", filename,
DllGetLastError());
ERROR_LOG(COMMON, "DL: Error loading DLL %s: %s", filename,
DllGetLastError());
return 0;

View File

@ -18,6 +18,12 @@
#ifndef _LOG_H
#define _LOG_H
#define ERROR_LEVEL 1 // Critical errors
#define WARNING_LEVEL 2 // Something is suspicious.
#define NOTICE_LEVEL 3 // Important information
#define INFO_LEVEL 4 // General information.
#define DEBUG_LEVEL 5 // Detailed debugging - might make things slow.
namespace LogTypes
{
@ -41,6 +47,7 @@ enum LOG_TYPE {
MASTER_LOG,
MEMMAP,
OSREPORT,
PAD,
PERIPHERALINTERFACE,
PIXELENGINE,
SERIALINTERFACE,
@ -56,15 +63,18 @@ enum LOG_TYPE {
WII_IPC_NET,
WII_IPC_SD,
WII_IPC_WIIMOTE,
WIIMOTE,
NUMBER_OF_LOGS // Must be last
};
// FIXME: should this be removed?
enum LOG_LEVELS {
LERROR = 1, // Bad errors - that still don't deserve a PanicAlert.
LWARNING, // Something is suspicious.
LINFO, // General information.
LDEBUG, // Strictly for detailed debugging - might make things slow.
LERROR = ERROR_LEVEL,
LWARNING = WARNING_LEVEL,
LNOTICE = NOTICE_LEVEL,
LINFO = INFO_LEVEL,
LDEBUG = DEBUG_LEVEL,
};
} // namespace
@ -73,47 +83,52 @@ enum LOG_LEVELS {
/*
FIXME:
- Debug_run() - run only in debug time
- Compile the log functions according to LOGLEVEL
*/
#ifdef LOGGING
#define LOGLEVEL 4 //LogTypes::LDEBUG
#if defined LOGGING || defined _DEBUG || defined DEBUGFAST
#define LOGLEVEL DEBUG_LEVEL
#else
#ifndef LOGLEVEL
#define LOGLEVEL 2 //LogTypes::LWARNING
#define LOGLEVEL NOTICE_LEVEL
#endif // loglevel
#endif // logging
#define ERROR_LOG(...) {}
#define WARN_LOG(...) {}
#define NOTICE_LOG(...) {}
#define INFO_LOG(...) {}
#define DEBUG_LOG(...) {}
extern void __Log(int logNumber, const char* text, ...);
// FIXME can we get rid of this?
#include "LogManager.h"
// Let the compiler optimize this out
#define GENERIC_LOG(t,v, ...) {if (v <= LOGLEVEL) __Log(t + (v)*100, __VA_ARGS__);}
#define GENERIC_LOG(t, v, ...) {if (v <= LOGLEVEL) LogManager::GetInstance()->Log(v, t, __VA_ARGS__);}
#if LOGLEVEL >= 1 //LogTypes::LERROR
#if LOGLEVEL >= ERROR_LEVEL
#undef ERROR_LOG
#define ERROR_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LERROR, __VA_ARGS__)}
#endif // loglevel LERROR+
#endif // loglevel ERROR+
#if LOGLEVEL >= 2 //LogTypes::LWARNING
#if LOGLEVEL >= WARNING_LEVEL
#undef WARN_LOG
#define WARN_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LWARNING, __VA_ARGS__)}
#endif // loglevel LWARNING+
#endif // loglevel WARNING+
#if LOGLEVEL >= 3 //LogTypes::LINFO
#if LOGLEVEL >= NOTICE_LEVEL
#undef NOTICE_LOG
#define NOTICE_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LNOTICE, __VA_ARGS__)}
#endif // loglevel NOTICE+
#if LOGLEVEL >= INFO_LEVEL
#undef INFO_LOG
#define INFO_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LINFO, __VA_ARGS__)}
#endif // loglevel LINFO+
#endif // loglevel INFO+
#if LOGLEVEL >= 4 //LogTypes::LDEBUG
#if LOGLEVEL >= DEBUG_LEVEL
#undef DEBUG_LOG
#define DEBUG_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, __VA_ARGS__)}
#endif // loglevel LDEBUG+
#endif // loglevel DEBUG+
#if LOGLEVEL >= 4 //LogTypes::LDEBUG
#if LOGLEVEL >= DEBUG_LEVEL
#define _dbg_assert_(_t_, _a_) \
if (!(_a_)) {\
ERROR_LOG(_t_, "Error...\n\n Line: %d\n File: %s\n Time: %s\n\nIgnore and continue?", \
@ -135,7 +150,7 @@ extern void __Log(int logNumber, const char* text, ...);
#define _dbg_assert_(_t_, _a_) ;
#define _dbg_assert_msg_(_t_, _a_, _desc_, ...) ;
#endif // dbg_assert
#endif // LOGLEVEL LDEBUG
#endif // LOGLEVEL DEBUG
#define _assert_(_a_) _dbg_assert_(MASTER_LOG, _a_)
#ifdef _WIN32

View File

@ -0,0 +1,161 @@
#include "LogManager.h"
#include "Timer.h"
#include "../../Core/Src/PowerPC/PowerPC.h" // Core
LogManager *LogManager::m_logManager = NULL;
LogManager::LogManager() {
// create log files
m_Log[LogTypes::MASTER_LOG] = new LogContainer("*", "Master Log");
m_Log[LogTypes::BOOT] = new LogContainer("BOOT", "Boot");
m_Log[LogTypes::COMMON] = new LogContainer("COMMON", "Common");
m_Log[LogTypes::DISCIO] = new LogContainer("DIO", "Disc IO");
m_Log[LogTypes::PAD] = new LogContainer("PAD", "Pad");
m_Log[LogTypes::PIXELENGINE] = new LogContainer("PE", "PixelEngine");
m_Log[LogTypes::COMMANDPROCESSOR] = new LogContainer("CP", "CommandProc");
m_Log[LogTypes::VIDEOINTERFACE] = new LogContainer("VI", "VideoInt");
m_Log[LogTypes::SERIALINTERFACE] = new LogContainer("SI", "SerialInt");
m_Log[LogTypes::PERIPHERALINTERFACE]= new LogContainer("PI", "PeripheralInt");
m_Log[LogTypes::MEMMAP] = new LogContainer("MI", "MI & memmap");
m_Log[LogTypes::STREAMINGINTERFACE] = new LogContainer("Stream", "StreamingInt");
m_Log[LogTypes::DSPINTERFACE] = new LogContainer("DSP", "DSPInterface");
m_Log[LogTypes::DVDINTERFACE] = new LogContainer("DVD", "DVDInterface");
m_Log[LogTypes::GPFIFO] = new LogContainer("GP", "GPFifo");
m_Log[LogTypes::EXPANSIONINTERFACE] = new LogContainer("EXI", "ExpansionInt");
m_Log[LogTypes::AUDIO_INTERFACE] = new LogContainer("AI", "AudioInt");
m_Log[LogTypes::GEKKO] = new LogContainer("GEKKO", "IBM CPU");
m_Log[LogTypes::HLE] = new LogContainer("HLE", "HLE");
m_Log[LogTypes::DSPHLE] = new LogContainer("DSPHLE", "DSP HLE");
m_Log[LogTypes::VIDEO] = new LogContainer("Video", "Video Plugin");
m_Log[LogTypes::AUDIO] = new LogContainer("Audio", "Audio Plugin");
m_Log[LogTypes::DYNA_REC] = new LogContainer("JIT", "Dynamic Recompiler");
m_Log[LogTypes::CONSOLE] = new LogContainer("CONSOLE", "Dolphin Console");
m_Log[LogTypes::OSREPORT] = new LogContainer("OSREPORT", "OSReport");
m_Log[LogTypes::WIIMOTE] = new LogContainer("Wiimote", "Wiimote");
m_Log[LogTypes::WII_IOB] = new LogContainer("WII_IOB", "WII IO Bridge");
m_Log[LogTypes::WII_IPC] = new LogContainer("WII_IPC", "WII IPC");
m_Log[LogTypes::WII_IPC_HLE] = new LogContainer("WII_IPC_HLE", "WII IPC HLE");
m_Log[LogTypes::WII_IPC_DVD] = new LogContainer("WII_IPC_DVD", "WII IPC DVD");
m_Log[LogTypes::WII_IPC_ES] = new LogContainer("WII_IPC_ES", "WII IPC ES");
m_Log[LogTypes::WII_IPC_FILEIO] = new LogContainer("WII_IPC_FILEIO","WII IPC FILEIO");
m_Log[LogTypes::WII_IPC_SD] = new LogContainer("WII_IPC_SD", "WII IPC SD");
m_Log[LogTypes::WII_IPC_NET] = new LogContainer("WII_IPC_NET", "WII IPC NET");
m_Log[LogTypes::WII_IPC_WIIMOTE] = new LogContainer("WII_IPC_WIIMOTE","WII IPC WIIMOTE");
m_Log[LogTypes::ACTIONREPLAY] = new LogContainer("ActionReplay", "ActionReplay");
logMutex = new Common::CriticalSection(1);
m_fileLog = new FileLogListener(MAIN_LOG_FILE);
m_consoleLog = new ConsoleListener();
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) {
m_Log[i]->setEnable(true);
m_Log[i]->addListener(m_fileLog);
m_Log[i]->addListener(m_consoleLog);
}
}
LogManager::~LogManager() {
delete [] &m_Log;
delete logMutex;
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) {
m_logManager->removeListener((LogTypes::LOG_TYPE)i, m_fileLog);
m_logManager->removeListener((LogTypes::LOG_TYPE)i, m_consoleLog);
}
delete m_fileLog;
delete m_consoleLog;
}
void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
const char *format, ...) {
va_list args;
char temp[MAX_MSGLEN];
char msg[MAX_MSGLEN + 512];
LogContainer *log = m_Log[type];
if (! log->isEnable() || level > log->getLevel())
return;
va_start(args, format);
CharArrayFromFormatV(temp, MAX_MSGLEN, format, args);
va_end(args);
sprintf(msg, "%s: %i %s %s\n",
Common::Timer::GetTimeFormatted().c_str(),
// PowerPC::ppcState.DebugCount,
(int)level,
log->getShortName(),
temp);
logMutex->Enter();
log->trigger(level, msg);
logMutex->Leave();
}
void LogManager::removeListener(LogTypes::LOG_TYPE type, Listener *listener) {
logMutex->Enter();
m_Log[type]->removeListener(listener);
logMutex->Leave();
}
// LogContainer
void LogContainer::addListener(Listener *listener) {
std::vector<Listener *>::iterator i;
bool exists = false;
for(i=listeners.begin();i!=listeners.end();i++) {
if ((*i) == listener) {
exists = true;
break;
}
}
if (! exists)
listeners.push_back(listener);
}
void LogContainer::removeListener(Listener *listener) {
std::vector<Listener *>::iterator i;
for(i=listeners.begin();i!=listeners.end();i++) {
if ((*i) == listener) {
listeners.erase(i);
break;
}
}
}
bool LogContainer::isListener(Listener *listener) {
std::vector<Listener *>::iterator i;
for(i=listeners.begin();i!=listeners.end();i++) {
if ((*i) == listener) {
return true;
}
}
return false;
}
void LogContainer::trigger(LogTypes::LOG_LEVELS level, const char *msg) {
std::vector<Listener *>::const_iterator i;
for(i=listeners.begin();i!=listeners.end();i++) {
(*i)->Log(level, msg);
}
}
FileLogListener::FileLogListener(const char *filename) : Listener("File") {
m_filename = strndup(filename, 255);
m_logfile = fopen(filename, "a+");
setEnable(true);
}
FileLogListener::~FileLogListener() {
free(m_filename);
fclose(m_logfile);
}
void FileLogListener::Log(LogTypes::LOG_LEVELS, const char *msg) {
if (!m_enable || !isValid())
return;
fwrite(msg, (strlen(msg) + 1) * sizeof(char), 1, m_logfile);
fflush(m_logfile);
}

View File

@ -0,0 +1,206 @@
// 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 _LOGMANAGER_H
#define _LOGMANAGER_H
#include "Log.h"
#include "Thread.h"
#include "StringUtil.h"
#ifdef _WIN32
#include <windows.h>
#endif
#include <vector>
#include <string.h>
#include <stdio.h>
#define MAX_MESSAGES 8000
#define MAX_MSGLEN 512
class Listener {
public:
Listener(const char *name) : m_name(name) {}
virtual void Log(LogTypes::LOG_LEVELS, const char *msg) = 0;
virtual const char *getName() { return m_name; }
private:
const char *m_name;
};
class FileLogListener : public Listener {
public:
FileLogListener(const char *filename);
~FileLogListener();
void Log(LogTypes::LOG_LEVELS, const char *msg);
bool isValid() {
return (m_logfile != NULL);
}
bool isEnable() {
return m_enable;
}
void setEnable(bool enable) {
m_enable = enable;
}
private:
char *m_filename;
FILE *m_logfile;
bool m_enable;
};
class ConsoleListener : public Listener
{
public:
ConsoleListener(int Width = 150, int Height = 100,
char * Name = "Console");
~ConsoleListener();
void Log(LogTypes::LOG_LEVELS, const char *text);
void ClearScreen();
private:
#ifdef _WIN32
HWND GetHwnd(void);
HANDLE m_hStdOut;
#endif
};
class LogContainer {
public:
LogContainer(const char* shortName, const char* fullName,
bool enable = false) : m_enable(enable) {
strncpy(m_fullName, fullName, 128);
strncpy(m_shortName, shortName, 32);
m_level = LogTypes::LWARNING;
}
const char *getShortName() {
return m_shortName;
}
const char *getFullName() {
return m_fullName;
}
bool isListener(Listener *listener);
void addListener(Listener *listener);
void removeListener(Listener *listener);
void trigger(LogTypes::LOG_LEVELS, const char *msg);
bool isEnable() {
return m_enable;
}
void setEnable(bool enable) {
m_enable = enable;
}
LogTypes::LOG_LEVELS getLevel() {
return m_level;
}
void setLevel(LogTypes::LOG_LEVELS level) {
m_level = level;
}
private:
char m_fullName[128];
char m_shortName[32];
bool m_enable;
LogTypes::LOG_LEVELS m_level;
std::vector<Listener *> listeners;
};
class LogManager
{
private:
LogContainer* m_Log[LogTypes::NUMBER_OF_LOGS];
Common::CriticalSection* logMutex;
FileLogListener *m_fileLog;
ConsoleListener *m_consoleLog;
static LogManager *m_logManager; // FIXME: find a way without singletone
public:
static u32 GetMaxLevel() {
return LOGLEVEL;
}
void Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
const char *fmt, ...);
void setLogLevel(LogTypes::LOG_TYPE type, LogTypes::LOG_LEVELS level){
m_Log[type]->setLevel(level);
}
void setEnable(LogTypes::LOG_TYPE type, bool enable) {
m_Log[type]->setEnable(enable);
}
const char *getShortName(LogTypes::LOG_TYPE type) {
return m_Log[type]->getShortName();
}
const char *getFullName(LogTypes::LOG_TYPE type) {
return m_Log[type]->getFullName();
}
bool isListener(LogTypes::LOG_TYPE type, Listener *listener) {
return m_Log[type]->isListener(listener);
}
void addListener(LogTypes::LOG_TYPE type, Listener *listener) {
m_Log[type]->addListener(listener);
}
void removeListener(LogTypes::LOG_TYPE type, Listener *listener);
FileLogListener *getFileListener() {
return m_fileLog;
}
ConsoleListener *getConsoleListener() {
return m_consoleLog;
}
static LogManager* GetInstance() {
if (! m_logManager)
m_logManager = new LogManager();
return m_logManager;
}
static void SetInstance(LogManager *logManager) {
m_logManager = logManager;
}
LogManager();
~LogManager();
};
#endif // LOGMANAGER_H

View File

@ -57,17 +57,17 @@ CPlugin::CPlugin(const char* _szName) : valid(false)
(m_hInstLib.Get("Shutdown"));
m_DoState = reinterpret_cast<TDoState>
(m_hInstLib.Get("DoState"));
}
// Check if the plugin has all the functions it shold have
if (m_GetDllInfo != 0 &&
m_DllConfig != 0 &&
m_DllDebugger != 0 &&
m_SetDllGlobals != 0 &&
m_Initialize != 0 &&
m_Shutdown != 0 &&
m_DoState != 0)
valid = true;
// Check if the plugin has all the functions it shold have
if (m_GetDllInfo != 0 &&
m_DllConfig != 0 &&
m_DllDebugger != 0 &&
m_SetDllGlobals != 0 &&
m_Initialize != 0 &&
m_Shutdown != 0 &&
m_DoState != 0)
valid = true;
}
// Save the filename for this plugin
Filename = _szName;

View File

@ -8,7 +8,7 @@ files = [
"CDUtils.cpp",
"ChunkFile.cpp",
"ColorUtil.cpp",
"ConsoleWindow.cpp",
"ConsoleListener.cpp",
"CPUDetect.cpp",
"DynamicLibrary.cpp",
"ExtendedTrace.cpp",
@ -16,6 +16,7 @@ files = [
"FileUtil.cpp",
"Hash.cpp",
"IniFile.cpp",
"LogManager.cpp",
"MappedFile.cpp",
"MathUtil.cpp",
"MemArena.cpp",

View File

@ -202,13 +202,13 @@ VOID CALLBACK TimerRoutine(PVOID lpParam, BOOLEAN TimerOrWaitFired)
{
if (lpParam == NULL)
{
Console::Print("TimerRoutine lpParam is NULL\n");
DEBUG_LOG(CONSOLE, "TimerRoutine lpParam is NULL\n");
}
else
{
// lpParam points to the argument; in this case it is an int
//Console::Print("Timer[%i] will call back\n", *(int*)lpParam);
//DEBUG_LOG(CONSOLE, "Timer[%i] will call back\n", *(int*)lpParam);
}
// Call back
@ -221,7 +221,7 @@ bool Event::TimerWait(EventCallBack WaitCB, int _Id, bool OptCondition)
{
Id = _Id;
//Console::Print("TimerWait[%i]: %i %i %i\n", Id, StartWait, DoneWaiting, OptCondition);
//DEBUG_LOG(CONSOLE, "TimerWait[%i]: %i %i %i\n", Id, StartWait, DoneWaiting, OptCondition);
FunctionPointer[Id] = WaitCB;
@ -234,7 +234,7 @@ bool Event::TimerWait(EventCallBack WaitCB, int _Id, bool OptCondition)
// Delete all timers in the timer queue.
if (!DeleteTimerQueue(hTimerQueue))
Console::Print("DeleteTimerQueue failed (%d)\n", GetLastError());
DEBUG_LOG(CONSOLE, "DeleteTimerQueue failed (%d)\n", GetLastError());
hTimer = NULL;
hTimerQueue = NULL;
@ -251,7 +251,7 @@ bool Event::TimerWait(EventCallBack WaitCB, int _Id, bool OptCondition)
hTimerQueue = CreateTimerQueue();
if (NULL == hTimerQueue)
{
Console::Print("CreateTimerQueue failed (%d)\n", GetLastError());
DEBUG_LOG(CONSOLE, "CreateTimerQueue failed (%d)\n", GetLastError());
return false;
}
}
@ -260,7 +260,7 @@ bool Event::TimerWait(EventCallBack WaitCB, int _Id, bool OptCondition)
if (!CreateTimerQueueTimer( &hTimer, hTimerQueue,
(WAITORTIMERCALLBACK)TimerRoutine, &Id , 10, 0, 0))
{
Console::Print("CreateTimerQueueTimer failed (%d)\n", GetLastError());
DEBUG_LOG(CONSOLE, "CreateTimerQueueTimer failed (%d)\n", GetLastError());
return false;
}

View File

@ -34,10 +34,12 @@
#endif
#endif
#include "Common.h"
///////////////////////////////////
// Don't include common.h here as it will break LogManager
#include "CommonTypes.h"
#include <stdio.h>
#include <string.h>
//////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
// Definitions
// ------------
// This may not be defined outside _WIN32