mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
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:
@@ -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"
|
||||
>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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
|
||||
@@ -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;
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -2264,14 +2264,6 @@
|
||||
RelativePath=".\Src\Host.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\LogManager.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\LogManager.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\MemTools.cpp"
|
||||
>
|
||||
|
||||
@@ -178,7 +178,7 @@ void LogInfo(const char *format, ...)
|
||||
{
|
||||
if (!b_RanOnce)
|
||||
{
|
||||
if (LogManager::GetLevel() >= LogTypes::LINFO || logSelf)
|
||||
if (LogManager::GetMaxLevel() >= LogTypes::LINFO || logSelf)
|
||||
{
|
||||
char* temp = (char*)alloca(strlen(format)+512);
|
||||
va_list args;
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "Common.h"
|
||||
#include "IniFile.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "PluginManager.h"
|
||||
#include "FileUtil.h"
|
||||
|
||||
SConfig SConfig::m_Instance;
|
||||
@@ -27,6 +28,7 @@ SConfig SConfig::m_Instance;
|
||||
|
||||
SConfig::SConfig()
|
||||
{
|
||||
// Make sure we have log manager
|
||||
LoadSettings();
|
||||
}
|
||||
|
||||
@@ -39,6 +41,7 @@ SConfig::~SConfig()
|
||||
|
||||
void SConfig::SaveSettings()
|
||||
{
|
||||
NOTICE_LOG(BOOT, "Saving Settings to %s", CONFIG_FILE);
|
||||
IniFile ini;
|
||||
#if defined(__APPLE__)
|
||||
ini.Load(File::GetConfigDirectory()); // yes we must load first to not kill unknown stuff
|
||||
@@ -71,7 +74,10 @@ void SConfig::SaveSettings()
|
||||
ini.Set("Interface", "ShowWiimoteLeds", m_LocalCoreStartupParameter.bWiiLeds);
|
||||
ini.Set("Interface", "ShowWiimoteSpeakers", m_LocalCoreStartupParameter.bWiiSpeakers);
|
||||
// interface(UI) language
|
||||
ini.Set("Interface", "Language", m_InterfaceLanguage);
|
||||
ini.Set("Interface", "Language", m_InterfaceLanguage);
|
||||
ini.Set("Interface", "ShowToolbar", m_InterfaceToolbar);
|
||||
ini.Set("Interface", "ShowStatusbar", m_InterfaceStatusbar);
|
||||
ini.Set("Interface", "ShowLogWindow", m_InterfaceLogWindow);
|
||||
|
||||
// Core
|
||||
ini.Set("Core", "HLEBios", m_LocalCoreStartupParameter.bHLEBios);
|
||||
@@ -122,7 +128,9 @@ void SConfig::SaveSettings()
|
||||
|
||||
|
||||
void SConfig::LoadSettings()
|
||||
{
|
||||
{
|
||||
|
||||
NOTICE_LOG(BOOT, "Loading Settings from %s", CONFIG_FILE);
|
||||
IniFile ini;
|
||||
#if defined(__APPLE__)
|
||||
ini.Load(File::GetConfigDirectory());
|
||||
@@ -166,7 +174,10 @@ void SConfig::LoadSettings()
|
||||
ini.Get("Interface", "ShowWiimoteLeds", &m_LocalCoreStartupParameter.bWiiLeds, false);
|
||||
ini.Get("Interface", "ShowWiimoteSpeakers", &m_LocalCoreStartupParameter.bWiiSpeakers, false);
|
||||
// interface(UI) language
|
||||
ini.Get("Interface", "Language", (int*)&m_InterfaceLanguage, 0);
|
||||
ini.Get("Interface", "Language", (int*)&m_InterfaceLanguage, 0);
|
||||
ini.Get("Interface", "ShowToolbar", &m_InterfaceToolbar, true);
|
||||
ini.Get("Interface", "ShowStatusbar", &m_InterfaceStatusbar, true);
|
||||
ini.Get("Interface", "ShowLogWindow", &m_InterfaceLogWindow, true);
|
||||
|
||||
// Core
|
||||
ini.Get("Core", "HLEBios", &m_LocalCoreStartupParameter.bHLEBios, true);
|
||||
|
||||
@@ -61,6 +61,11 @@ struct SConfig
|
||||
|
||||
// interface language
|
||||
INTERFACE_LANGUAGE m_InterfaceLanguage;
|
||||
// other interface settings
|
||||
bool m_InterfaceToolbar;
|
||||
bool m_InterfaceStatusbar;
|
||||
bool m_InterfaceLogWindow;
|
||||
|
||||
// save settings
|
||||
void SaveSettings();
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
#include "PowerPCDisasm.h"
|
||||
#include "Console.h"
|
||||
|
||||
#define CASE(x) else if (memcmp(cmd, x, 4*sizeof(TCHAR))==0)
|
||||
#define CASE1(x) if (memcmp(cmd, x, 2*sizeof(TCHAR))==0)
|
||||
#define CASE(x) else if (memcmp(cmd, x, 4*sizeof(TCHAR))==0)
|
||||
|
||||
void Console_Submit(const char *cmd)
|
||||
{
|
||||
@@ -53,7 +53,7 @@ void Console_Submit(const char *cmd)
|
||||
|
||||
if (addr)
|
||||
{
|
||||
#if LOGLEVEL >= 3
|
||||
#if LOGLEVEL >= INFO_LEVEL
|
||||
u32 EA =
|
||||
#endif
|
||||
Memory::CheckDTLB(addr, Memory::FLAG_NO_EXCEPTION);
|
||||
@@ -120,7 +120,8 @@ void Console_Submit(const char *cmd)
|
||||
TCHAR temp[256];
|
||||
sscanf(cmd, "%s %08x %08x", temp, &start, &end);
|
||||
char disasm[256];
|
||||
for (u32 addr = start; addr <= end; addr += 4) {
|
||||
for (u32 addr = start; addr <= end; addr += 4)
|
||||
{
|
||||
u32 data = Memory::ReadUnchecked_U32(addr);
|
||||
DisassembleGekko(data, addr, disasm, 256);
|
||||
printf("%08x: %08x: %s\n", addr, data, disasm);
|
||||
@@ -149,7 +150,8 @@ void Console_Submit(const char *cmd)
|
||||
{
|
||||
g_symbolDB.List();
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
printf("blach\n");
|
||||
ERROR_LOG(CONSOLE, "Invalid command");
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "Thread.h"
|
||||
#include "Timer.h"
|
||||
#include "Common.h"
|
||||
#include "ConsoleWindow.h"
|
||||
#include "StringUtil.h"
|
||||
|
||||
#include "Console.h"
|
||||
@@ -161,7 +160,7 @@ void ReconnectPad()
|
||||
CPluginManager &Plugins = CPluginManager::GetInstance();
|
||||
Plugins.FreePad(0);
|
||||
Plugins.GetPad(0)->Config(g_pWindowHandle);
|
||||
Console::Print("ReconnectPad()\n");
|
||||
INFO_LOG(CONSOLE, "ReconnectPad()\n");
|
||||
}
|
||||
|
||||
// This doesn't work yet, I don't understand how the connection work yet
|
||||
@@ -171,7 +170,7 @@ void ReconnectWiimote()
|
||||
/* JP: Yes, it's basically nothing right now, I could not figure out how to reset the Wiimote
|
||||
for reconnection */
|
||||
HW::InitWiimote();
|
||||
Console::Print("ReconnectWiimote()\n");
|
||||
INFO_LOG(CONSOLE, "ReconnectWiimote()\n");
|
||||
}
|
||||
|
||||
// -----------------------------------------
|
||||
@@ -182,7 +181,7 @@ void ReconnectWiimote()
|
||||
VideoThreadRunning = false;
|
||||
VideoThreadEvent.SetTimer();
|
||||
VideoThreadEvent2.SetTimer();
|
||||
//Console::Print("VideoThreadEnd\n");
|
||||
//INFO_LOG(CONSOLE, "VideoThreadEnd\n");
|
||||
}
|
||||
#endif
|
||||
// ---------------------------
|
||||
@@ -207,7 +206,8 @@ bool Init()
|
||||
SCoreStartupParameter &_CoreParameter = SConfig::GetInstance().m_LocalCoreStartupParameter;
|
||||
|
||||
g_CoreStartupParameter = _CoreParameter;
|
||||
LogManager::Init();
|
||||
NOTICE_LOG(BOOT, "Starting core");
|
||||
// FIXME DEBUG_LOG(BOOT, dump_params());
|
||||
Host_SetWaitCursor(true);
|
||||
|
||||
// Start the thread again
|
||||
@@ -241,8 +241,8 @@ void Stop()
|
||||
#ifdef SETUP_TIMER_WAITING
|
||||
if (!StopUpToVideoDone)
|
||||
{
|
||||
Console::Print("--------------------------------------------------------------\n");
|
||||
Console::Print("Stop [Main Thread]: Shutting down...\n");
|
||||
INFO_LOG(CONSOLE, "--------------------------------------------------------------\n");
|
||||
INFO_LOG(CONSOLE, "Stop [Main Thread]: Shutting down...\n");
|
||||
// Reset variables
|
||||
StopReachedEnd = false;
|
||||
EmuThreadReachedEnd = false;
|
||||
@@ -265,7 +265,7 @@ void Stop()
|
||||
|
||||
// If dual core mode, the CPU thread should immediately exit here.
|
||||
if (_CoreParameter.bUseDualCore) {
|
||||
Console::Print("Stop [Main Thread]: Wait for Video Loop to exit...\n");
|
||||
INFO_LOG(CONSOLE, "Stop [Main Thread]: Wait for Video Loop to exit...\n");
|
||||
CPluginManager::GetInstance().GetVideo()->Video_ExitLoop();
|
||||
}
|
||||
|
||||
@@ -276,7 +276,7 @@ void Stop()
|
||||
//if (!VideoThreadEvent.TimerWait(Stop, 1, EmuThreadReachedEnd) || !EmuThreadReachedEnd) return;
|
||||
if (!VideoThreadEvent.TimerWait(Stop, 1)) return;
|
||||
|
||||
//Console::Print("Stop() will continue\n");
|
||||
//INFO_LOG(CONSOLE, "Stop() will continue\n");
|
||||
#endif
|
||||
|
||||
// Video_EnterLoop() should now exit so that EmuThread() will continue concurrently with the rest
|
||||
@@ -284,9 +284,8 @@ void Stop()
|
||||
|
||||
// Close the trace file
|
||||
Core::StopTrace();
|
||||
#ifndef SETUP_TIMER_WAITING // This hangs
|
||||
LogManager::Shutdown();
|
||||
#endif
|
||||
NOTICE_LOG(BOOT, "Shutting core");
|
||||
|
||||
// Update mouse pointer
|
||||
Host_SetWaitCursor(false);
|
||||
#ifdef SETUP_AVOID_CHILD_WINDOW_RENDERING_HANG
|
||||
@@ -307,8 +306,8 @@ void Stop()
|
||||
Host_UpdateGUI();
|
||||
StopUpToVideoDone = false;
|
||||
StopReachedEnd = true;
|
||||
//Console::Print("Stop() reached the end\n");
|
||||
if (EmuThreadReachedEnd) Console::Print("--------------------------------------------------------------\n");
|
||||
//INFO_LOG(CONSOLE, "Stop() reached the end\n");
|
||||
if (EmuThreadReachedEnd) INFO_LOG(CONSOLE, "--------------------------------------------------------------\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -521,7 +520,7 @@ THREAD_RETURN EmuThread(void *pArg)
|
||||
#ifdef SETUP_TIMER_WAITING
|
||||
|
||||
VideoThreadEvent2.TimerWait(EmuThreadEnd, 2);
|
||||
//Console::Print("Video loop [Video Thread]: Stopped\n");
|
||||
//INFO_LOG(CONSOLE, "Video loop [Video Thread]: Stopped\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -530,23 +529,23 @@ void EmuThreadEnd()
|
||||
CPluginManager &Plugins = CPluginManager::GetInstance();
|
||||
const SCoreStartupParameter& _CoreParameter = SConfig::GetInstance().m_LocalCoreStartupParameter;
|
||||
|
||||
//Console::Print("Video loop [Video Thread]: EmuThreadEnd [StopEnd:%i]\n", StopReachedEnd);
|
||||
//INFO_LOG(CONSOLE, "Video loop [Video Thread]: EmuThreadEnd [StopEnd:%i]\n", StopReachedEnd);
|
||||
|
||||
//if (!VideoThreadEvent2.TimerWait(EmuThreadEnd, 2)) return;
|
||||
if (!VideoThreadEvent2.TimerWait(EmuThreadEnd, 2, StopReachedEnd) || !StopReachedEnd)
|
||||
{
|
||||
Console::Print("Stop [Video Thread]: Waiting for Stop() and Video Loop to end...\n");
|
||||
INFO_LOG(CONSOLE, "Stop [Video Thread]: Waiting for Stop() and Video Loop to end...\n");
|
||||
return;
|
||||
}
|
||||
|
||||
//Console::Print("EmuThreadEnd() will continue\n");
|
||||
//INFO_LOG(CONSOLE, "EmuThreadEnd() will continue\n");
|
||||
|
||||
/* There will be a few problems with the OpenGL ShutDown() after this, for example the "Release
|
||||
Device Context Failed" error message */
|
||||
#endif
|
||||
|
||||
Console::Print("Stop [Video Thread]: Stop() and Video Loop Ended\n");
|
||||
Console::Print("Stop [Video Thread]: Shutting down HW and Plugins\n");
|
||||
INFO_LOG(CONSOLE, "Stop [Video Thread]: Stop() and Video Loop Ended\n");
|
||||
INFO_LOG(CONSOLE, "Stop [Video Thread]: Shutting down HW and Plugins\n");
|
||||
|
||||
// We have now exited the Video Loop and will shut down
|
||||
|
||||
@@ -582,10 +581,10 @@ void EmuThreadEnd()
|
||||
Host_UpdateMainFrame();
|
||||
#ifdef SETUP_TIMER_WAITING
|
||||
EmuThreadReachedEnd = true;
|
||||
//Console::Print("EmuThread() reached the end\n");
|
||||
//INFO_LOG(CONSOLE, "EmuThread() reached the end\n");
|
||||
Host_UpdateGUI();
|
||||
Console::Print("Stop [Video Thread]: Done\n");
|
||||
if (StopReachedEnd) Console::Print("--------------------------------------------------------------\n");
|
||||
INFO_LOG(CONSOLE, "Stop [Video Thread]: Done\n");
|
||||
if (StopReachedEnd) INFO_LOG(CONSOLE, "--------------------------------------------------------------\n");
|
||||
delete g_EmuThread; // Wait for emuthread to close.
|
||||
g_EmuThread = 0;
|
||||
#endif
|
||||
@@ -715,9 +714,9 @@ void Callback_VideoCopiedToXFB()
|
||||
// __________________________________________________________________________________________________
|
||||
// Callback_DSPLog
|
||||
// WARNING - THIS MAY EXECUTED FROM DSP THREAD
|
||||
void Callback_DSPLog(const TCHAR* _szMessage, int _v)
|
||||
void Callback_DSPLog(const TCHAR* _szMessage, int _v)
|
||||
{
|
||||
GENERIC_LOG(LogTypes::AUDIO, _v, _szMessage);
|
||||
GENERIC_LOG(LogTypes::AUDIO, (LogTypes::LOG_LEVELS)_v, _szMessage);
|
||||
}
|
||||
|
||||
// __________________________________________________________________________________________________
|
||||
@@ -729,10 +728,11 @@ void Callback_DSPInterrupt()
|
||||
}
|
||||
|
||||
// __________________________________________________________________________________________________
|
||||
// Callback_PADLog
|
||||
// Callback_PADLog
|
||||
//
|
||||
void Callback_PADLog(const TCHAR* _szMessage)
|
||||
{
|
||||
// FIXME add levels
|
||||
INFO_LOG(SERIALINTERFACE, _szMessage);
|
||||
}
|
||||
|
||||
@@ -769,7 +769,7 @@ void Callback_KeyPress(int key, bool shift, bool control)
|
||||
//
|
||||
void Callback_WiimoteLog(const TCHAR* _szMessage, int _v)
|
||||
{
|
||||
GENERIC_LOG(LogTypes::WII_IPC_WIIMOTE, _v, _szMessage);
|
||||
GENERIC_LOG(LogTypes::WII_IPC_WIIMOTE, (LogTypes::LOG_LEVELS)_v, _szMessage);
|
||||
}
|
||||
|
||||
// TODO: Get rid of at some point
|
||||
|
||||
@@ -115,7 +115,7 @@ void RerecordingStart()
|
||||
ReRecTimer.Start();
|
||||
|
||||
// Logging
|
||||
//Console::Print("RerecordingStart: %i\n", g_FrameCounter);
|
||||
//DEBUG_LOG(CONSOLE, "RerecordingStart: %i\n", g_FrameCounter);
|
||||
}
|
||||
|
||||
// Reset the frame counter
|
||||
@@ -159,7 +159,7 @@ void WindBack(int Counter)
|
||||
ReRecTimer.WindBackStartingTime((u64)CurrentTimeSeconds * 1000);
|
||||
|
||||
// Logging
|
||||
Console::Print("WindBack: %i %u\n", Counter, (u64)CurrentTimeSeconds);
|
||||
DEBUG_LOG(CONSOLE, "WindBack: %i %u\n", Counter, (u64)CurrentTimeSeconds);
|
||||
}
|
||||
////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -241,7 +241,7 @@ void CEXIMemoryCard::TransferByte(u8 &byte)
|
||||
{
|
||||
command = byte; // first byte is command
|
||||
byte = 0xFF; // would be tristate, but we don't care.
|
||||
WARN_LOG(EXPANSIONINTERFACE, "EXI MEMCARD: command %02x", byte)
|
||||
WARN_LOG(EXPANSIONINTERFACE, "EXI MEMCARD: command %02x", command)
|
||||
|
||||
if(command == cmdClearStatus)
|
||||
{
|
||||
|
||||
@@ -136,7 +136,7 @@ protected:
|
||||
of 4 byte commands. */
|
||||
// ----------------
|
||||
void DumpCommands(u32 _CommandAddress, size_t _NumberOfCommands = 8,
|
||||
int LogType = LogTypes::WII_IPC_HLE, int Verbosity = 0)
|
||||
LogTypes::LOG_TYPE LogType = LogTypes::WII_IPC_HLE, LogTypes::LOG_LEVELS Verbosity =LogTypes::LDEBUG)
|
||||
{
|
||||
GENERIC_LOG(LogType, Verbosity, "CommandDump of %s",
|
||||
GetDeviceName().c_str());
|
||||
@@ -184,8 +184,8 @@ protected:
|
||||
INFO_LOG(WII_IPC_HLE,"%s - IOCtlV OutBuffer[%i]:", GetDeviceName().c_str(), i);
|
||||
INFO_LOG(WII_IPC_HLE, " OutBuffer: 0x%08x (0x%x):", OutBuffer, OutBufferSize);
|
||||
|
||||
#if defined LOGLEVEL && LOGLEVEL > 2
|
||||
DumpCommands(OutBuffer, OutBufferSize, LogTypes::WII_IPC_HLE, 1);
|
||||
#if defined LOGLEVEL && LOGLEVEL > NOTICE_LEVEL
|
||||
DumpCommands(OutBuffer, OutBufferSize, LogTypes::WII_IPC_HLE, LogTypes::LINFO);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user