mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 06:39:46 -06: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
|
||||
|
137
Source/Core/Common/Src/ConsoleListener.cpp
Normal file
137
Source/Core/Common/Src/ConsoleListener.cpp
Normal 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
|
||||
|
@ -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
|
||||
|
161
Source/Core/Common/Src/LogManager.cpp
Normal file
161
Source/Core/Common/Src/LogManager.cpp
Normal 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);
|
||||
}
|
206
Source/Core/Common/Src/LogManager.h
Normal file
206
Source/Core/Common/Src/LogManager.h
Normal 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
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -18,8 +18,6 @@
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Include
|
||||
#include "ConsoleWindow.h" // Common
|
||||
|
||||
#include "../Core.h" // Local core functions
|
||||
#include "../Debugger/Debugger_SymbolMap.h"
|
||||
#include "../Host.h"
|
||||
@ -1811,7 +1809,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandDisconnect(u8* _Input)
|
||||
"anyway. It is strongly recommed to save and/or restart the\n"
|
||||
"emulation.");
|
||||
}
|
||||
Console::Print("IPC CommandDisconnect\n");
|
||||
INFO_LOG(CONSOLE, "IPC CommandDisconnect\n");
|
||||
|
||||
// Send message to plugin
|
||||
/*
|
||||
|
@ -54,8 +54,6 @@
|
||||
if it works I'd rather be without FreeLibrary() between Start and Stop.
|
||||
|
||||
//////////////////////////////////////*/
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Include
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
@ -71,7 +69,6 @@
|
||||
#include "FileSearch.h" // Common
|
||||
#include "FileUtil.h"
|
||||
#include "StringUtil.h"
|
||||
#include "ConsoleWindow.h"
|
||||
#include "Setup.h"
|
||||
|
||||
// Create the plugin manager class
|
||||
@ -84,13 +81,16 @@ CPluginManager CPluginManager::m_Instance;
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// The plugin manager is some sort of singleton that runs during Dolphin's entire lifespan.
|
||||
CPluginManager::CPluginManager() :
|
||||
m_params(SConfig::GetInstance().m_LocalCoreStartupParameter)
|
||||
CPluginManager::CPluginManager()
|
||||
{
|
||||
m_PluginGlobals = new PLUGIN_GLOBALS;
|
||||
|
||||
// Start LogManager
|
||||
m_PluginGlobals->logManager = LogManager::GetInstance();
|
||||
m_PluginGlobals->eventHandler = EventHandler::GetInstance();
|
||||
m_PluginGlobals->config = (void *)&SConfig::GetInstance();
|
||||
m_PluginGlobals->messageLogger = NULL;
|
||||
|
||||
m_params = &(SConfig::GetInstance().m_LocalCoreStartupParameter);
|
||||
|
||||
// Set initial values to NULL.
|
||||
m_video = NULL;
|
||||
@ -104,7 +104,7 @@ CPluginManager::CPluginManager() :
|
||||
// This will call FreeLibrary() for all plugins
|
||||
CPluginManager::~CPluginManager()
|
||||
{
|
||||
Console::Print("Delete CPluginManager\n");
|
||||
INFO_LOG(CONSOLE, "Delete CPluginManager\n");
|
||||
|
||||
delete m_PluginGlobals;
|
||||
delete m_dsp;
|
||||
@ -113,7 +113,7 @@ CPluginManager::~CPluginManager()
|
||||
{
|
||||
if (m_pad[i] && OkayToInitPlugin(i))
|
||||
{
|
||||
Console::Print("Delete: %i\n", i);
|
||||
INFO_LOG(CONSOLE, "Delete: %i\n", i);
|
||||
delete m_pad[i];
|
||||
}
|
||||
m_pad[i] = NULL;
|
||||
@ -138,13 +138,13 @@ bool CPluginManager::InitPlugins()
|
||||
PanicAlert("Can't init DSP Plugin");
|
||||
return false;
|
||||
}
|
||||
Console::Print("Before GetVideo\n");
|
||||
INFO_LOG(CONSOLE, "Before GetVideo\n");
|
||||
|
||||
if (!GetVideo()) {
|
||||
PanicAlert("Can't init Video Plugin");
|
||||
return false;
|
||||
}
|
||||
Console::Print("After GetVideo\n");
|
||||
INFO_LOG(CONSOLE, "After GetVideo\n");
|
||||
|
||||
// Check if we get at least one pad or wiimote
|
||||
bool pad = false;
|
||||
@ -154,7 +154,7 @@ bool CPluginManager::InitPlugins()
|
||||
for (int i = 0; i < MAXPADS; i++)
|
||||
{
|
||||
// Check that the plugin has a name
|
||||
if (!m_params.m_strPadPlugin[i].empty())
|
||||
if (!m_params->m_strPadPlugin[i].empty())
|
||||
GetPad(i);
|
||||
// Check that GetPad succeeded
|
||||
if (m_pad[i] != NULL)
|
||||
@ -167,9 +167,9 @@ bool CPluginManager::InitPlugins()
|
||||
}
|
||||
|
||||
// Init wiimote
|
||||
if (m_params.bWii) {
|
||||
if (m_params->bWii) {
|
||||
for (int i = 0; i < MAXWIIMOTES; i++) {
|
||||
if (!m_params.m_strWiimotePlugin[i].empty())
|
||||
if (!m_params->m_strWiimotePlugin[i].empty())
|
||||
GetWiimote(i);
|
||||
|
||||
if (m_wiimote[i] != NULL)
|
||||
@ -257,7 +257,8 @@ CPluginInfo::CPluginInfo(const char *_rFilename)
|
||||
|
||||
// We are now done with this plugin and will call FreeLibrary()
|
||||
delete plugin;
|
||||
}
|
||||
} else
|
||||
PanicAlert("PluginInfo: %s is not valid", _rFilename);
|
||||
}
|
||||
///////////////////////////////////////////
|
||||
|
||||
@ -276,10 +277,6 @@ void CPluginManager::GetPluginInfo(CPluginInfo *&info, std::string Filename)
|
||||
if (m_PluginInfos.at(i).GetFilename() == Filename)
|
||||
{
|
||||
info = &m_PluginInfos.at(i);
|
||||
if (info == NULL)
|
||||
{
|
||||
PanicAlert("error reading info from dll");
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -292,29 +289,23 @@ void *CPluginManager::LoadPlugin(const char *_rFilename, int Number)
|
||||
{
|
||||
// Create a string of the filename
|
||||
std::string Filename = _rFilename;
|
||||
|
||||
if (!File::Exists(_rFilename)) {
|
||||
PanicAlert("Error loading %s: can't find file", _rFilename);
|
||||
return NULL;
|
||||
}
|
||||
/* Avoid calling LoadLibrary() again and instead point to the plugin info that we found when
|
||||
Dolphin was started */
|
||||
CPluginInfo *info = NULL;
|
||||
if (!Filename.empty()){
|
||||
GetPluginInfo(info, Filename);
|
||||
if (info == NULL)
|
||||
{
|
||||
PanicAlert("Can't open %s, it's missing", _rFilename);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else{
|
||||
PanicAlert("error with dll Filename (its NULL)");
|
||||
GetPluginInfo(info, Filename);
|
||||
if (! info) {
|
||||
PanicAlert("Error loading %s: can't read info", _rFilename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
PLUGIN_TYPE type = info->GetPluginInfo().Type;
|
||||
Common::CPlugin *plugin = NULL;
|
||||
|
||||
// Check again that the file exists, the first check is when CPluginInfo info is created
|
||||
if (!File::Exists(_rFilename))
|
||||
return NULL;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case PLUGIN_TYPE_VIDEO:
|
||||
@ -355,7 +346,7 @@ int CPluginManager::OkayToInitPlugin(int Plugin)
|
||||
{
|
||||
// Compare it to the earlier plugins
|
||||
for (int i = 0; i < Plugin; i++)
|
||||
if (m_params.m_strPadPlugin[Plugin] == m_params.m_strPadPlugin[i])
|
||||
if (m_params->m_strPadPlugin[Plugin] == m_params->m_strPadPlugin[i])
|
||||
return i;
|
||||
|
||||
// No there is no duplicate plugin
|
||||
@ -376,18 +367,18 @@ void CPluginManager::ScanForPlugins()
|
||||
// Get plugins dir
|
||||
CFileSearch::XStringVector Directories;
|
||||
|
||||
#if defined(__APPLE__)
|
||||
Directories.push_back(File::GetPluginsDirectory());
|
||||
#else
|
||||
Directories.push_back(std::string(PLUGINS_DIR));
|
||||
#endif
|
||||
#if defined(__APPLE__)
|
||||
Directories.push_back(File::GetPluginsDirectory());
|
||||
#else
|
||||
Directories.push_back(std::string(PLUGINS_DIR));
|
||||
#endif
|
||||
|
||||
CFileSearch::XStringVector Extensions;
|
||||
Extensions.push_back("*" PLUGIN_SUFFIX);
|
||||
Extensions.push_back("*" PLUGIN_SUFFIX);
|
||||
// Get all DLL files in the plugins dir
|
||||
CFileSearch FileSearch(Extensions, Directories);
|
||||
const CFileSearch::XStringVector& rFilenames = FileSearch.GetFileNames();
|
||||
|
||||
|
||||
if (rFilenames.size() > 0)
|
||||
{
|
||||
for (size_t i = 0; i < rFilenames.size(); i++)
|
||||
@ -399,7 +390,7 @@ void CPluginManager::ScanForPlugins()
|
||||
printf("Bad Path %s\n", rFilenames[i].c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
CPluginInfo PluginInfo(orig_name.c_str());
|
||||
if (PluginInfo.IsValid())
|
||||
{
|
||||
@ -424,16 +415,16 @@ void CPluginManager::ScanForPlugins()
|
||||
Common::PluginPAD *CPluginManager::GetPad(int controller)
|
||||
{
|
||||
if (m_pad[controller] != NULL)
|
||||
if (m_pad[controller]->GetFilename() == m_params.m_strPadPlugin[controller])
|
||||
if (m_pad[controller]->GetFilename() == m_params->m_strPadPlugin[controller])
|
||||
return m_pad[controller];
|
||||
|
||||
// Else do this
|
||||
if (OkayToInitPlugin(controller) == -1) {
|
||||
m_pad[controller] = (Common::PluginPAD*)LoadPlugin(m_params.m_strPadPlugin[controller].c_str(), controller);
|
||||
Console::Print("LoadPlugin: %i\n", controller);
|
||||
m_pad[controller] = (Common::PluginPAD*)LoadPlugin(m_params->m_strPadPlugin[controller].c_str(), controller);
|
||||
INFO_LOG(CONSOLE, "LoadPlugin: %i\n", controller);
|
||||
}
|
||||
else {
|
||||
Console::Print("Pointed: %i to %i\n", controller, OkayToInitPlugin(controller));
|
||||
INFO_LOG(CONSOLE, "Pointed: %i to %i\n", controller, OkayToInitPlugin(controller));
|
||||
m_pad[controller] = m_pad[OkayToInitPlugin(controller)];
|
||||
}
|
||||
return m_pad[controller];
|
||||
@ -442,21 +433,21 @@ Common::PluginPAD *CPluginManager::GetPad(int controller)
|
||||
Common::PluginWiimote *CPluginManager::GetWiimote(int controller)
|
||||
{
|
||||
if (m_wiimote[controller] != NULL)
|
||||
if (m_wiimote[controller]->GetFilename() == m_params.m_strWiimotePlugin[controller])
|
||||
if (m_wiimote[controller]->GetFilename() == m_params->m_strWiimotePlugin[controller])
|
||||
return m_wiimote[controller];
|
||||
|
||||
// Else load a new plugin
|
||||
m_wiimote[controller] = (Common::PluginWiimote*)LoadPlugin(m_params.m_strWiimotePlugin[controller].c_str());
|
||||
m_wiimote[controller] = (Common::PluginWiimote*)LoadPlugin(m_params->m_strWiimotePlugin[controller].c_str());
|
||||
return m_wiimote[controller];
|
||||
}
|
||||
|
||||
Common::PluginDSP *CPluginManager::GetDSP()
|
||||
{
|
||||
if (m_dsp != NULL)
|
||||
if (m_dsp->GetFilename() == m_params.m_strDSPPlugin)
|
||||
if (m_dsp->GetFilename() == m_params->m_strDSPPlugin)
|
||||
return m_dsp;
|
||||
// Else load a new plugin
|
||||
m_dsp = (Common::PluginDSP*)LoadPlugin(m_params.m_strDSPPlugin.c_str());
|
||||
m_dsp = (Common::PluginDSP*)LoadPlugin(m_params->m_strDSPPlugin.c_str());
|
||||
return m_dsp;
|
||||
}
|
||||
|
||||
@ -467,7 +458,7 @@ Common::PluginVideo *CPluginManager::GetVideo()
|
||||
if (m_video != NULL)
|
||||
{
|
||||
// Check if the video plugin has been changed
|
||||
if (m_video->GetFilename() == m_params.m_strVideoPlugin)
|
||||
if (m_video->GetFilename() == m_params->m_strVideoPlugin)
|
||||
return m_video;
|
||||
// Then free the current video plugin,
|
||||
else
|
||||
@ -475,7 +466,7 @@ Common::PluginVideo *CPluginManager::GetVideo()
|
||||
}
|
||||
|
||||
// and load a new plugin
|
||||
m_video = (Common::PluginVideo*)LoadPlugin(m_params.m_strVideoPlugin.c_str());
|
||||
m_video = (Common::PluginVideo*)LoadPlugin(m_params->m_strVideoPlugin.c_str());
|
||||
return m_video;
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ private:
|
||||
Common::PluginWiimote *m_wiimote[4];
|
||||
Common::PluginDSP *m_dsp;
|
||||
|
||||
SCoreStartupParameter& m_params;
|
||||
SCoreStartupParameter * m_params;
|
||||
CPluginManager();
|
||||
~CPluginManager();
|
||||
void GetPluginInfo(CPluginInfo *&info, std::string Filename);
|
||||
|
@ -12,7 +12,6 @@ files = ["ActionReplay.cpp",
|
||||
"CoreRerecording.cpp",
|
||||
"CoreTiming.cpp",
|
||||
"Host.cpp",
|
||||
"LogManager.cpp",
|
||||
"MemTools.cpp",
|
||||
"PatchEngine.cpp",
|
||||
"PluginManager.cpp",
|
||||
|
@ -642,14 +642,6 @@
|
||||
RelativePath=".\src\JitWindow.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\LogWindow.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\LogWindow.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\MemoryCheckDlg.cpp"
|
||||
>
|
||||
|
@ -37,7 +37,6 @@
|
||||
#include "Debugger.h"
|
||||
|
||||
#include "RegisterWindow.h"
|
||||
#include "LogWindow.h"
|
||||
#include "BreakpointWindow.h"
|
||||
#include "MemoryWindow.h"
|
||||
#include "JitWindow.h"
|
||||
@ -121,8 +120,7 @@ BEGIN_EVENT_TABLE(CCodeWindow, wxFrame)
|
||||
EVT_MENU(IDM_JITPOFF, CCodeWindow::OnCPUMode)
|
||||
EVT_MENU(IDM_JITSROFF, CCodeWindow::OnCPUMode)
|
||||
|
||||
EVT_MENU(IDM_LOGWINDOW, CCodeWindow::OnToggleLogWindow) // Views
|
||||
EVT_MENU(IDM_REGISTERWINDOW, CCodeWindow::OnToggleRegisterWindow)
|
||||
EVT_MENU(IDM_REGISTERWINDOW, CCodeWindow::OnToggleRegisterWindow) //views
|
||||
EVT_MENU(IDM_BREAKPOINTWINDOW, CCodeWindow::OnToggleBreakPointWindow)
|
||||
EVT_MENU(IDM_MEMORYWINDOW, CCodeWindow::OnToggleMemoryWindow)
|
||||
EVT_MENU(IDM_JITWINDOW, CCodeWindow::OnToggleJitWindow)
|
||||
@ -167,7 +165,6 @@ CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter
|
||||
|
||||
/* Remember to initialize potential new controls with NULL there, otherwise m_dialog = true and
|
||||
things may crash */
|
||||
, m_LogWindow(NULL)
|
||||
, m_RegisterWindow(NULL)
|
||||
, m_BreakpointWindow(NULL)
|
||||
, m_MemoryWindow(NULL)
|
||||
@ -208,7 +205,6 @@ CCodeWindow::~CCodeWindow()
|
||||
|
||||
this->Save(file);
|
||||
if (m_BreakpointWindow) m_BreakpointWindow->Save(file);
|
||||
if (m_LogWindow) m_LogWindow->Save(file);
|
||||
if (m_RegisterWindow) m_RegisterWindow->Save(file);
|
||||
if (m_MemoryWindow) m_MemoryWindow->Save(file);
|
||||
if (m_JitWindow) m_JitWindow->Save(file);
|
||||
@ -236,7 +232,7 @@ void CCodeWindow::OnHostMessage(wxCommandEvent& event)
|
||||
NotifyMapLoaded();
|
||||
break;
|
||||
|
||||
case IDM_UPDATELOGDISPLAY:
|
||||
/* case IDM_UPDATELOGDISPLAY:
|
||||
|
||||
if (m_LogWindow)
|
||||
{
|
||||
@ -244,7 +240,7 @@ void CCodeWindow::OnHostMessage(wxCommandEvent& event)
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
*/
|
||||
case IDM_UPDATEDISASMDIALOG:
|
||||
Update();
|
||||
|
||||
@ -295,7 +291,6 @@ void CCodeWindow::Load_( IniFile &ini )
|
||||
DebuggerFont.SetNativeFontInfoUserDesc(wxString(fontDesc.c_str(), wxConvUTF8));
|
||||
|
||||
// Decide what windows to use
|
||||
ini.Get("ShowOnStart", "LogWindow", &bLogWindow, true);
|
||||
ini.Get("ShowOnStart", "RegisterWindow", &bRegisterWindow, true);
|
||||
ini.Get("ShowOnStart", "BreakpointWindow", &bBreakpointWindow, true);
|
||||
ini.Get("ShowOnStart", "MemoryWindow", &bMemoryWindow, true);
|
||||
@ -318,6 +313,11 @@ void CCodeWindow::Load( IniFile &ini )
|
||||
ini.Get("CodeWindow", "w", &w, GetSize().GetWidth());
|
||||
ini.Get("CodeWindow", "h", &h, GetSize().GetHeight());
|
||||
this->SetSize(x, y, w, h);
|
||||
ini.Get("MainWindow", "x", &x, 100);
|
||||
ini.Get("MainWindow", "y", &y, 100);
|
||||
ini.Get("MainWindow", "w", &w, 800);
|
||||
ini.Get("MainWindow", "h", &h, 600);
|
||||
GetParent()->SetSize(x, y, w, h);
|
||||
}
|
||||
|
||||
|
||||
@ -327,6 +327,10 @@ void CCodeWindow::Save(IniFile &ini) const
|
||||
ini.Set("CodeWindow", "y", GetPosition().y);
|
||||
ini.Set("CodeWindow", "w", GetSize().GetWidth());
|
||||
ini.Set("CodeWindow", "h", GetSize().GetHeight());
|
||||
ini.Set("MainWindow", "x", GetParent()->GetPosition().x);
|
||||
ini.Set("MainWindow", "y", GetParent()->GetPosition().y);
|
||||
ini.Set("MainWindow", "w", GetParent()->GetSize().GetWidth());
|
||||
ini.Set("MainWindow", "h", GetParent()->GetSize().GetHeight());
|
||||
|
||||
ini.Set("ShowOnStart", "DebuggerFont", std::string(DebuggerFont.GetNativeFontInfoUserDesc().mb_str()));
|
||||
|
||||
@ -335,7 +339,6 @@ void CCodeWindow::Save(IniFile &ini) const
|
||||
ini.Set("ShowOnStart", "BootToPause", GetMenuBar()->IsChecked(IDM_BOOTTOPAUSE));
|
||||
|
||||
// Save windows settings
|
||||
ini.Set("ShowOnStart", "LogWindow", GetMenuBar()->IsChecked(IDM_LOGWINDOW));
|
||||
ini.Set("ShowOnStart", "RegisterWindow", GetMenuBar()->IsChecked(IDM_REGISTERWINDOW));
|
||||
ini.Set("ShowOnStart", "BreakpointWindow", GetMenuBar()->IsChecked(IDM_BREAKPOINTWINDOW));
|
||||
ini.Set("ShowOnStart", "MemoryWindow", GetMenuBar()->IsChecked(IDM_MEMORYWINDOW));
|
||||
@ -375,15 +378,6 @@ void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStart
|
||||
// =================
|
||||
|
||||
|
||||
// Additional dialogs
|
||||
#if LOGLEVEL > 0
|
||||
if (bLogWindow)
|
||||
{
|
||||
m_LogWindow = new CLogWindow(this);
|
||||
m_LogWindow->Show(true);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (bRegisterWindow)
|
||||
{
|
||||
m_RegisterWindow = new CRegisterWindow(this);
|
||||
@ -504,12 +498,6 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam
|
||||
// ---------------
|
||||
wxMenu* pDebugDialogs = new wxMenu;
|
||||
|
||||
if (LogManager::GetLevel() > 0)
|
||||
{
|
||||
wxMenuItem* pLogWindow = pDebugDialogs->Append(IDM_LOGWINDOW, _T("&LogManager"), wxEmptyString, wxITEM_CHECK);
|
||||
pLogWindow->Check(bLogWindow);
|
||||
}
|
||||
|
||||
wxMenuItem* pRegister = pDebugDialogs->Append(IDM_REGISTERWINDOW, _T("&Registers"), wxEmptyString, wxITEM_CHECK);
|
||||
pRegister->Check(bRegisterWindow);
|
||||
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "CoreParameter.h"
|
||||
|
||||
class CRegisterWindow;
|
||||
class CLogWindow;
|
||||
class CBreakPointWindow;
|
||||
class CMemoryWindow;
|
||||
class CJitWindow;
|
||||
@ -146,7 +145,6 @@ class CCodeWindow
|
||||
|
||||
// Settings
|
||||
bool bAutomaticStart; bool bBootToPause;
|
||||
bool bLogWindow;
|
||||
bool bRegisterWindow;
|
||||
bool bBreakpointWindow;
|
||||
bool bMemoryWindow;
|
||||
@ -156,7 +154,6 @@ class CCodeWindow
|
||||
|
||||
// Sub dialogs
|
||||
wxMenuBar* pMenuBar;
|
||||
CLogWindow* m_LogWindow;
|
||||
CRegisterWindow* m_RegisterWindow;
|
||||
CBreakPointWindow* m_BreakpointWindow;
|
||||
CMemoryWindow* m_MemoryWindow;
|
||||
@ -195,7 +192,6 @@ class CCodeWindow
|
||||
|
||||
void OnToggleRegisterWindow(wxCommandEvent& event);
|
||||
void OnToggleBreakPointWindow(wxCommandEvent& event);
|
||||
void OnToggleLogWindow(wxCommandEvent& event);
|
||||
void OnToggleMemoryWindow(wxCommandEvent& event);
|
||||
void OnToggleJitWindow(wxCommandEvent& event);
|
||||
void OnToggleSoundWindow(wxCommandEvent& event);
|
||||
|
@ -41,7 +41,6 @@
|
||||
#include "Debugger.h"
|
||||
|
||||
#include "RegisterWindow.h"
|
||||
#include "LogWindow.h"
|
||||
#include "BreakpointWindow.h"
|
||||
#include "MemoryWindow.h"
|
||||
#include "JitWindow.h"
|
||||
@ -308,44 +307,6 @@ void CCodeWindow::OnSymbolListContextMenu(wxContextMenuEvent& event)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Show and hide windows
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void CCodeWindow::OnToggleLogWindow(wxCommandEvent& event)
|
||||
{
|
||||
if (LogManager::GetLevel() > 0)
|
||||
{
|
||||
bool show = GetMenuBar()->IsChecked(event.GetId());
|
||||
|
||||
if (show)
|
||||
{
|
||||
if (!m_LogWindow)
|
||||
{
|
||||
m_LogWindow = new CLogWindow(this);
|
||||
}
|
||||
|
||||
m_LogWindow->Show(true);
|
||||
}
|
||||
else // hide
|
||||
{
|
||||
// If m_dialog is NULL, then possibly the system
|
||||
// didn't report the checked menu item status correctly.
|
||||
// It should be true just after the menu item was selected,
|
||||
// if there was no modeless dialog yet.
|
||||
wxASSERT(m_LogWindow != NULL);
|
||||
|
||||
if (m_LogWindow)
|
||||
{
|
||||
m_LogWindow->Hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CCodeWindow::OnToggleRegisterWindow(wxCommandEvent& event)
|
||||
{
|
||||
bool show = GetMenuBar()->IsChecked(event.GetId());
|
||||
|
@ -18,17 +18,6 @@
|
||||
#ifndef _DEBUGGER_H
|
||||
#define _DEBUGGER_H
|
||||
|
||||
enum
|
||||
{
|
||||
IDM_LOG,
|
||||
IDM_UPDATELOG,
|
||||
IDM_CLEARLOG,
|
||||
IDM_LOGCHECKS,
|
||||
IDM_OPTIONS,
|
||||
IDM_ENABLEALL,
|
||||
IDM_RADIO0,
|
||||
IDM_SUBMITCMD = 300,
|
||||
};
|
||||
|
||||
#define wxUSE_XPM_IN_MSW 1
|
||||
#define USE_XPM_BITMAPS 1
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "CoreParameter.h"
|
||||
|
||||
class CRegisterWindow;
|
||||
class CLogWindow;
|
||||
class CBreakPointWindow;
|
||||
|
||||
class CMemoryWindow
|
||||
|
@ -5,21 +5,21 @@ Import('env')
|
||||
if not env['HAVE_WX']:
|
||||
Return()
|
||||
|
||||
files = ["LogWindow.cpp",
|
||||
"BreakPointDlg.cpp",
|
||||
"BreakpointView.cpp",
|
||||
"CodeView.cpp",
|
||||
"BreakpointWindow.cpp",
|
||||
"CodeWindow.cpp",
|
||||
"CodeWindowSJP.cpp",
|
||||
"CodeView.cpp",
|
||||
"MemoryCheckDlg.cpp",
|
||||
"MemoryView.cpp",
|
||||
"MemoryWindow.cpp",
|
||||
"RegisterWindow.cpp",
|
||||
"RegisterView.cpp",
|
||||
"JitWindow.cpp",
|
||||
]
|
||||
files = [
|
||||
"BreakPointDlg.cpp",
|
||||
"BreakpointView.cpp",
|
||||
"CodeView.cpp",
|
||||
"BreakpointWindow.cpp",
|
||||
"CodeWindow.cpp",
|
||||
"CodeWindowSJP.cpp",
|
||||
"CodeView.cpp",
|
||||
"MemoryCheckDlg.cpp",
|
||||
"MemoryView.cpp",
|
||||
"MemoryWindow.cpp",
|
||||
"RegisterWindow.cpp",
|
||||
"RegisterView.cpp",
|
||||
"JitWindow.cpp",
|
||||
]
|
||||
wxenv = env.Clone()
|
||||
wxenv.Append(
|
||||
CPPDEFINES = [
|
||||
|
@ -1051,6 +1051,14 @@
|
||||
RelativePath=".\Src\FrameWiimote.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\LogWindow.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\LogWindow.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\GameListCtrl.cpp"
|
||||
>
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "Core.h" // Core
|
||||
#include "HW/EXI.h"
|
||||
#include "HW/SI.h"
|
||||
#include "ConsoleWindow.h"
|
||||
|
||||
#include "Globals.h" // Local
|
||||
#include "ConfigMain.h"
|
||||
@ -875,7 +874,7 @@ void CConfigMain::OnConfig(wxCommandEvent& event)
|
||||
void CConfigMain::CallConfig(wxChoice* _pChoice)
|
||||
{
|
||||
int Index = _pChoice->GetSelection();
|
||||
Console::Print("CallConfig: %i\n", Index);
|
||||
INFO_LOG(CONSOLE, "CallConfig: %i\n", Index);
|
||||
|
||||
if (Index >= 0)
|
||||
{
|
||||
@ -888,7 +887,7 @@ void CConfigMain::CallConfig(wxChoice* _pChoice)
|
||||
|
||||
void CConfigMain::FillChoiceBox(wxChoice* _pChoice, int _PluginType, const std::string& _SelectFilename)
|
||||
{
|
||||
Console::Print("FillChoiceBox\n");
|
||||
INFO_LOG(CONSOLE, "FillChoiceBox\n");
|
||||
|
||||
_pChoice->Clear();
|
||||
|
||||
@ -924,7 +923,7 @@ bool CConfigMain::GetFilename(wxChoice* _pChoice, std::string& _rFilename)
|
||||
{
|
||||
const CPluginInfo* pInfo = static_cast<CPluginInfo*>(_pChoice->GetClientData(Index));
|
||||
_rFilename = pInfo->GetFilename();
|
||||
Console::Print("GetFilename: %i %s\n", Index, _rFilename.c_str());
|
||||
INFO_LOG(CONSOLE, "GetFilename: %i %s\n", Index, _rFilename.c_str());
|
||||
return(true);
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,6 @@ be accessed from Core::GetWindowHandle().
|
||||
#include "FileUtil.h"
|
||||
#include "Timer.h"
|
||||
#include "Setup.h"
|
||||
#include "ConsoleWindow.h"
|
||||
|
||||
#include "ConfigManager.h" // Core
|
||||
#include "Core.h"
|
||||
@ -190,7 +189,7 @@ int abc = 0;
|
||||
|
||||
case WIIMOTE_RECONNECT:
|
||||
// The Wiimote plugin has been shut down, now reconnect the Wiimote
|
||||
//Console::Print("WIIMOTE_RECONNECT\n");
|
||||
//INFO_LOG(CONSOLE, "WIIMOTE_RECONNECT\n");
|
||||
Core::ReconnectWiimote();
|
||||
return 0;
|
||||
|
||||
@ -210,7 +209,7 @@ int abc = 0;
|
||||
case OPENGL_VIDEO_STOP:
|
||||
// The Video thread has been shut down
|
||||
Core::VideoThreadEnd();
|
||||
//Console::Print("OPENGL_VIDEO_STOP\n");
|
||||
//INFO_LOG(CONSOLE, "OPENGL_VIDEO_STOP\n");
|
||||
return 0;
|
||||
#endif
|
||||
// -----------------------------
|
||||
@ -273,6 +272,7 @@ EVT_MENU(IDM_TOGGLE_FULLSCREEN, CFrame::OnToggleFullscreen)
|
||||
EVT_MENU(IDM_TOGGLE_DUALCORE, CFrame::OnToggleDualCore)
|
||||
EVT_MENU(IDM_TOGGLE_SKIPIDLE, CFrame::OnToggleSkipIdle)
|
||||
EVT_MENU(IDM_TOGGLE_TOOLBAR, CFrame::OnToggleToolbar)
|
||||
EVT_MENU(IDM_TOGGLE_LOGWINDOW, CFrame::OnToggleLogWindow)
|
||||
EVT_MENU(IDM_TOGGLE_STATUSBAR, CFrame::OnToggleStatusbar)
|
||||
|
||||
EVT_MENU_RANGE(IDM_LOADSLOT1, IDM_LOADSLOT10, CFrame::OnLoadState)
|
||||
@ -293,13 +293,15 @@ END_EVENT_TABLE()
|
||||
// Creation and close, quit functions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
CFrame::CFrame(wxFrame* parent,
|
||||
CFrame::CFrame(bool showLogWindow,
|
||||
wxFrame* parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style)
|
||||
: wxFrame(parent, id, title, pos, size, style)
|
||||
, m_bLogWindow(showLogWindow || SConfig::GetInstance().m_InterfaceLogWindow)
|
||||
, m_pStatusBar(NULL), bRenderToMain(true)
|
||||
, HaveLeds(false), HaveSpeakers(false)
|
||||
, m_Panel(NULL)
|
||||
@ -326,6 +328,8 @@ CFrame::CFrame(wxFrame* parent,
|
||||
|
||||
// Give it a status bar
|
||||
m_pStatusBar = CreateStatusBar(1, wxST_SIZEGRIP, ID_STATUSBAR);
|
||||
if (!SConfig::GetInstance().m_InterfaceStatusbar)
|
||||
m_pStatusBar->Hide();
|
||||
|
||||
// Give it a menu bar
|
||||
CreateMenu();
|
||||
@ -334,6 +338,10 @@ CFrame::CFrame(wxFrame* parent,
|
||||
//m_Panel = new wxPanel(this, IDM_MPANEL);
|
||||
m_Panel = new CPanel(this, IDM_MPANEL);
|
||||
|
||||
m_LogWindow = new CLogWindow(this);
|
||||
if (m_bLogWindow)
|
||||
m_LogWindow->Show();
|
||||
|
||||
m_GameListCtrl = new CGameListCtrl(m_Panel, LIST_CTRL,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT);
|
||||
@ -348,6 +356,8 @@ CFrame::CFrame(wxFrame* parent,
|
||||
|
||||
// Create the toolbar
|
||||
RecreateToolbar();
|
||||
if (!SConfig::GetInstance().m_InterfaceToolbar)
|
||||
TheToolBar->Hide();
|
||||
|
||||
FitInside();
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <wx/mstream.h>
|
||||
////////////////////////////////
|
||||
#include "CDUtils.h"
|
||||
#include "LogWindow.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// A shortcut to access the bitmaps
|
||||
@ -48,7 +49,8 @@ class CFrame : public wxFrame
|
||||
{
|
||||
public:
|
||||
|
||||
CFrame(wxFrame* parent,
|
||||
CFrame(bool showLogWindow,
|
||||
wxFrame* parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxString& title = wxT("Dolphin"),
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
@ -98,6 +100,8 @@ class CFrame : public wxFrame
|
||||
wxPanel* m_Panel;
|
||||
wxToolBar* TheToolBar;
|
||||
wxToolBarToolBase* m_ToolPlay;
|
||||
bool m_bLogWindow;
|
||||
CLogWindow* m_LogWindow;
|
||||
|
||||
char **drives;
|
||||
|
||||
@ -199,6 +203,7 @@ class CFrame : public wxFrame
|
||||
void OnToggleThrottle(wxCommandEvent& event);
|
||||
void OnResize(wxSizeEvent& event);
|
||||
void OnToggleToolbar(wxCommandEvent& event);
|
||||
void OnToggleLogWindow(wxCommandEvent& event);
|
||||
void OnToggleStatusbar(wxCommandEvent& event);
|
||||
void OnKeyDown(wxKeyEvent& event); void OnKeyUp(wxKeyEvent& event);
|
||||
void OnDoubleClick(wxMouseEvent& event); void OnMotion(wxMouseEvent& event);
|
||||
|
@ -44,11 +44,11 @@ be accessed from Core::GetWindowHandle().
|
||||
#include "GameListCtrl.h"
|
||||
#include "BootManager.h"
|
||||
#include "SDCardWindow.h"
|
||||
#include "LogWindow.h"
|
||||
|
||||
#include "Common.h" // Common
|
||||
#include "FileUtil.h"
|
||||
#include "Timer.h"
|
||||
#include "ConsoleWindow.h"
|
||||
#include "Setup.h"
|
||||
|
||||
#include "ConfigManager.h" // Core
|
||||
@ -153,9 +153,11 @@ void CFrame::CreateMenu()
|
||||
// Tools menu
|
||||
wxMenu* toolsMenu = new wxMenu;
|
||||
toolsMenu->AppendCheckItem(IDM_TOGGLE_TOOLBAR, _T("View &Toolbar"));
|
||||
toolsMenu->Check(IDM_TOGGLE_TOOLBAR, true);
|
||||
toolsMenu->Check(IDM_TOGGLE_TOOLBAR, SConfig::GetInstance().m_InterfaceToolbar);
|
||||
toolsMenu->AppendCheckItem(IDM_TOGGLE_STATUSBAR, _T("View &Statusbar"));
|
||||
toolsMenu->Check(IDM_TOGGLE_STATUSBAR, true);
|
||||
toolsMenu->Check(IDM_TOGGLE_STATUSBAR, SConfig::GetInstance().m_InterfaceStatusbar);
|
||||
toolsMenu->AppendCheckItem(IDM_TOGGLE_LOGWINDOW, _T("View &Logwindow"));
|
||||
toolsMenu->Check(IDM_TOGGLE_LOGWINDOW, m_bLogWindow);
|
||||
toolsMenu->AppendSeparator();
|
||||
toolsMenu->Append(IDM_MEMCARD, _T("&Memcard Manager"));
|
||||
toolsMenu->Append(IDM_CHEATS, _T("Action &Replay Manager"));
|
||||
@ -350,7 +352,8 @@ void CFrame::InitBitmaps()
|
||||
//////////////////////////
|
||||
|
||||
// Update in case the bitmap has been updated
|
||||
if (GetToolBar() != NULL) RecreateToolbar();
|
||||
if (GetToolBar() != NULL)
|
||||
RecreateToolbar();
|
||||
}
|
||||
|
||||
|
||||
@ -733,7 +736,7 @@ void CFrame::OnToggleToolbar(wxCommandEvent& event)
|
||||
{
|
||||
wxToolBarBase* toolBar = GetToolBar();
|
||||
|
||||
if (event.IsChecked())
|
||||
if (SConfig::GetInstance().m_InterfaceToolbar = event.IsChecked() == true)
|
||||
{
|
||||
CFrame::RecreateToolbar();
|
||||
}
|
||||
@ -749,7 +752,7 @@ void CFrame::OnToggleToolbar(wxCommandEvent& event)
|
||||
// Let us enable and disable the status bar
|
||||
void CFrame::OnToggleStatusbar(wxCommandEvent& event)
|
||||
{
|
||||
if (event.IsChecked())
|
||||
if (SConfig::GetInstance().m_InterfaceStatusbar = event.IsChecked() == true)
|
||||
m_pStatusBar->Show();
|
||||
else
|
||||
m_pStatusBar->Hide();
|
||||
@ -757,6 +760,17 @@ void CFrame::OnToggleStatusbar(wxCommandEvent& event)
|
||||
this->SendSizeEvent();
|
||||
}
|
||||
|
||||
// Let us enable and disable the log window
|
||||
void CFrame::OnToggleLogWindow(wxCommandEvent& event)
|
||||
{
|
||||
if (SConfig::GetInstance().m_InterfaceLogWindow = event.IsChecked() == true)
|
||||
m_LogWindow->Show();
|
||||
else
|
||||
m_LogWindow->Hide();
|
||||
|
||||
this->SendSizeEvent();
|
||||
}
|
||||
|
||||
|
||||
// Update the enabled/disabled status
|
||||
void CFrame::UpdateGUI()
|
||||
@ -815,7 +829,8 @@ void CFrame::UpdateGUI()
|
||||
m_pMenuItemPlay->SetText(_("&Play"));
|
||||
|
||||
}
|
||||
if (GetToolBar() != NULL) GetToolBar()->Realize();
|
||||
if (GetToolBar() != NULL)
|
||||
GetToolBar()->Realize();
|
||||
|
||||
|
||||
if (!initialized)
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "Frame.h"
|
||||
#include "FileUtil.h"
|
||||
#include "StringUtil.h"
|
||||
#include "ConsoleWindow.h"
|
||||
|
||||
#include "GameListCtrl.h"
|
||||
#include "BootManager.h"
|
||||
@ -414,7 +413,7 @@ void CFrame::DoMoveIcons()
|
||||
for (int i = 0; i < 4; i++) m_StatBmp[i]->Hide();
|
||||
else // if(!m_StatBmp[0]->IsShown())
|
||||
for (int i = 0; i < 4; i++) m_StatBmp[i]->Show();
|
||||
//Console::Print("LED: %i ", Rect.GetWidth());
|
||||
//INFO_LOG(CONSOLE, "LED: %i ", Rect.GetWidth());
|
||||
}
|
||||
|
||||
// If there is not room for the speaker icons hide them
|
||||
@ -430,7 +429,7 @@ void CFrame::DoMoveIcons()
|
||||
for(int i = 0; i < 3; i++) m_StatBmp[i + 4]->Hide();
|
||||
else // if(!m_StatBmp[4]->IsShown())
|
||||
for (int i = 0; i < 3; i++) m_StatBmp[i + 4]->Show();
|
||||
//Console::Print("Speaker: %i\n", Rect.GetWidth());
|
||||
//INFO_LOG(CONSOLE, "Speaker: %i\n", Rect.GetWidth());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,7 @@ void CGameListCtrl::Update()
|
||||
SetColumnWidth(COLUMN_COMPANY, 100);
|
||||
SetColumnWidth(COLUMN_NOTES, 150);
|
||||
SetColumnWidth(COLUMN_COUNTRY, 32);
|
||||
SetColumnWidth(COLUMN_EMULATION_STATE, 150);
|
||||
SetColumnWidth(COLUMN_EMULATION_STATE, 130);
|
||||
|
||||
// add all items
|
||||
for (int i = 0; i < (int)m_ISOFiles.size(); i++)
|
||||
@ -883,10 +883,15 @@ void CGameListCtrl::AutomaticColumnWidth()
|
||||
}
|
||||
else if (GetColumnCount() > 4)
|
||||
{
|
||||
int resizable = rc.GetWidth() - (213 + GetColumnWidth(COLUMN_SIZE));
|
||||
int resizable = rc.GetWidth() - (
|
||||
GetColumnWidth(COLUMN_BANNER)
|
||||
+ GetColumnWidth(COLUMN_COUNTRY)
|
||||
+ GetColumnWidth(COLUMN_SIZE)
|
||||
+ GetColumnWidth(COLUMN_EMULATION_STATE)
|
||||
+ 5); // some pad to keep the horizontal scrollbar away :)
|
||||
|
||||
SetColumnWidth(COLUMN_TITLE, wxMax(0.3*resizable, 100));
|
||||
SetColumnWidth(COLUMN_COMPANY, wxMax(0.2*resizable, 100));
|
||||
SetColumnWidth(COLUMN_COMPANY, wxMax(0.2*resizable, 90));
|
||||
SetColumnWidth(COLUMN_NOTES, wxMax(0.5*resizable, 100));
|
||||
}
|
||||
}
|
||||
|
@ -85,6 +85,7 @@ enum
|
||||
IDM_TOGGLE_DUALCORE, // Other
|
||||
IDM_TOGGLE_SKIPIDLE,
|
||||
IDM_TOGGLE_TOOLBAR,
|
||||
IDM_TOGGLE_LOGWINDOW,
|
||||
IDM_TOGGLE_STATUSBAR,
|
||||
IDM_NOTIFYMAPLOADED,
|
||||
IDM_OPENCONTAININGFOLDER,
|
||||
|
360
Source/Core/DolphinWX/Src/LogWindow.cpp
Normal file
360
Source/Core/DolphinWX/Src/LogWindow.cpp
Normal file
@ -0,0 +1,360 @@
|
||||
// Copyright (C) 2003-2009 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 <wx/wx.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/listbox.h>
|
||||
#include <wx/checklst.h>
|
||||
|
||||
#include "Core.h" // for Core::GetState()
|
||||
#include "LogWindow.h"
|
||||
#include "Console.h"
|
||||
|
||||
#define UPDATETIME 1000
|
||||
|
||||
BEGIN_EVENT_TABLE(CLogWindow, wxDialog)
|
||||
EVT_BUTTON(IDM_SUBMITCMD, CLogWindow::OnSubmit)
|
||||
EVT_BUTTON(IDM_CLEARLOG, CLogWindow::OnClear)
|
||||
EVT_BUTTON(IDM_TOGGLEALL, CLogWindow::OnToggleAll)
|
||||
EVT_RADIOBOX(IDM_VERBOSITY, CLogWindow::OnOptionsCheck)
|
||||
EVT_CHECKBOX(IDM_WRITEFILE, CLogWindow::OnOptionsCheck)
|
||||
EVT_CHECKBOX(IDM_WRITECONSOLE, CLogWindow::OnOptionsCheck)
|
||||
EVT_CHECKLISTBOX(IDM_LOGCHECKS, CLogWindow::OnLogCheck)
|
||||
EVT_TIMER(IDTM_UPDATELOG, CLogWindow::OnLogTimer)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
CLogWindow::CLogWindow(wxWindow* parent)
|
||||
: wxDialog(parent, wxID_ANY, wxT("Log/Console"),
|
||||
wxPoint(100, 700), wxSize(800, 270),
|
||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
|
||||
Listener("LogWindow")
|
||||
{
|
||||
m_logManager = LogManager::GetInstance();
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
|
||||
m_logManager->addListener((LogTypes::LOG_TYPE)i, this);
|
||||
m_fileLog = m_logManager->getFileListener();
|
||||
m_console = m_logManager->getConsoleListener();
|
||||
|
||||
m_writeFile = true;
|
||||
m_writeConsole = true;
|
||||
|
||||
CreateGUIControls();
|
||||
|
||||
LoadSettings();
|
||||
}
|
||||
|
||||
void CLogWindow::CreateGUIControls()
|
||||
{
|
||||
wxBoxSizer* sUber = new wxBoxSizer(wxHORIZONTAL), // whole plane
|
||||
* sLeft = new wxBoxSizer(wxVERTICAL), // LEFT sizer
|
||||
* sRight = new wxBoxSizer(wxVERTICAL), // RIGHT sizer
|
||||
* sRightBottom = new wxBoxSizer(wxHORIZONTAL); // submit row
|
||||
|
||||
// Left side: buttons (-submit), options, and log type selection
|
||||
wxStaticBoxSizer* sbLeftOptions = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Options"));
|
||||
|
||||
wxArrayString wxLevels;
|
||||
for (int i = 0; i < LOGLEVEL; ++i)
|
||||
wxLevels.Add(wxString::Format(wxT("%i"), i));
|
||||
m_verbosity = new wxRadioBox(this, IDM_VERBOSITY, wxT("Verbosity"), wxDefaultPosition, wxDefaultSize, wxLevels, 0, wxRA_SPECIFY_COLS, wxDefaultValidator);
|
||||
sbLeftOptions->Add(m_verbosity);
|
||||
|
||||
m_writeFileCB = new wxCheckBox(this, IDM_WRITEFILE, wxT("Write to File"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
sbLeftOptions->Add(m_writeFileCB);
|
||||
|
||||
m_writeConsoleCB = new wxCheckBox(this, IDM_WRITECONSOLE, wxT("Write to Console"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
sbLeftOptions->Add(m_writeConsoleCB);
|
||||
|
||||
sLeft->Add(sbLeftOptions, 0, wxEXPAND);
|
||||
|
||||
wxBoxSizer* sLogCtrl = new wxBoxSizer(wxHORIZONTAL);
|
||||
sLogCtrl->Add(new wxButton(this, IDM_TOGGLEALL, wxT("Toggle all"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT), 1);
|
||||
sLogCtrl->Add(new wxButton(this, IDM_CLEARLOG, wxT("Clear"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT), 1);
|
||||
sLeft->Add(sLogCtrl, 0, wxEXPAND);
|
||||
|
||||
m_checks = new wxCheckListBox(this, IDM_LOGCHECKS, wxDefaultPosition, wxDefaultSize);
|
||||
sLeft->Add(m_checks, 1, wxEXPAND);
|
||||
|
||||
// Right side: Log viewer and submit row
|
||||
m_log = new wxTextCtrl(this, IDM_LOG, wxEmptyString, wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP);
|
||||
//m_log->SetFont(DebuggerFont);
|
||||
|
||||
m_cmdline = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition);
|
||||
//m_cmdline->SetFont(DebuggerFont);
|
||||
|
||||
sRightBottom->Add(m_cmdline, 1, wxEXPAND);
|
||||
sRightBottom->Add(new wxButton(this, IDM_SUBMITCMD, wxT("Submit"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT));
|
||||
sRight->Add(m_log, 1, wxEXPAND | wxSHRINK);
|
||||
sRight->Add(sRightBottom, 0, wxEXPAND);
|
||||
|
||||
// Take care of the main sizer and some settings
|
||||
sUber->Add(sLeft, 0, wxEXPAND);
|
||||
sUber->Add(sRight, 1, wxEXPAND);
|
||||
|
||||
SetSizer(sUber);
|
||||
SetAffirmativeId(IDM_SUBMITCMD);
|
||||
UpdateChecks();
|
||||
m_cmdline->SetFocus();
|
||||
|
||||
m_logTimer = new wxTimer(this, IDTM_UPDATELOG);
|
||||
m_logTimer->Start(UPDATETIME);
|
||||
}
|
||||
|
||||
CLogWindow::~CLogWindow()
|
||||
{
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
|
||||
{
|
||||
m_logManager->removeListener((LogTypes::LOG_TYPE)i, this);
|
||||
}
|
||||
m_logTimer->Stop();
|
||||
delete m_logTimer;
|
||||
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
void CLogWindow::SaveSettings()
|
||||
{
|
||||
IniFile ini;
|
||||
ini.Set("LogWindow", "x", GetPosition().x);
|
||||
ini.Set("LogWindow", "y", GetPosition().y);
|
||||
ini.Set("LogWindow", "w", GetSize().GetWidth());
|
||||
ini.Set("LogWindow", "h", GetSize().GetHeight());
|
||||
ini.Set("Options", "Verbosity", m_verbosity->GetSelection());
|
||||
ini.Set("Options", "WriteToFile", m_writeFile);
|
||||
ini.Set("Options", "WriteToConsole", m_writeConsole);
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
|
||||
ini.Set("Logs", m_logManager->getShortName((LogTypes::LOG_TYPE)i), m_checks->IsChecked(i));
|
||||
ini.Save(LOGGER_CONFIG_FILE);
|
||||
}
|
||||
|
||||
void CLogWindow::LoadSettings()
|
||||
{
|
||||
IniFile ini;
|
||||
ini.Load(LOGGER_CONFIG_FILE);
|
||||
int x,y,w,h,verbosity;
|
||||
ini.Get("LogWindow", "x", &x, GetPosition().x);
|
||||
ini.Get("LogWindow", "y", &y, GetPosition().y);
|
||||
ini.Get("LogWindow", "w", &w, GetSize().GetWidth());
|
||||
ini.Get("LogWindow", "h", &h, GetSize().GetHeight());
|
||||
SetSize(x, y, w, h);
|
||||
ini.Get("Options", "Verbosity", &verbosity, 2);
|
||||
m_verbosity->SetSelection(verbosity);
|
||||
ini.Get("Options", "WriteToFile", &m_writeFile, true);
|
||||
m_writeFileCB->SetValue(m_writeFile);
|
||||
ini.Get("Options", "WriteToConsole", &m_writeConsole, true);
|
||||
m_writeConsoleCB->SetValue(m_writeConsole);
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
|
||||
{
|
||||
bool enable;
|
||||
ini.Get("Logs", m_logManager->getShortName((LogTypes::LOG_TYPE)i), &enable, true);
|
||||
|
||||
if (enable)
|
||||
m_logManager->addListener((LogTypes::LOG_TYPE)i, this);
|
||||
else
|
||||
m_logManager->removeListener((LogTypes::LOG_TYPE)i, this);
|
||||
|
||||
if (m_writeFile && enable)
|
||||
m_logManager->addListener((LogTypes::LOG_TYPE)i, m_fileLog);
|
||||
else
|
||||
m_logManager->removeListener((LogTypes::LOG_TYPE)i, m_fileLog);
|
||||
|
||||
if (m_writeConsole && enable)
|
||||
m_logManager->addListener((LogTypes::LOG_TYPE)i, m_console);
|
||||
else
|
||||
m_logManager->removeListener((LogTypes::LOG_TYPE)i, m_console);
|
||||
}
|
||||
UpdateChecks();
|
||||
}
|
||||
|
||||
void CLogWindow::OnSubmit(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
Console_Submit(m_cmdline->GetValue().To8BitData());
|
||||
m_cmdline->SetValue(wxEmptyString);
|
||||
NotifyUpdate();
|
||||
}
|
||||
|
||||
void CLogWindow::OnClear(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
m_log->Clear();
|
||||
|
||||
//msgQueue.Clear()
|
||||
for (unsigned int i = 0; i < msgQueue.size(); i++)
|
||||
msgQueue.pop();
|
||||
|
||||
m_console->ClearScreen();
|
||||
NOTICE_LOG(CONSOLE, "Console cleared");
|
||||
NotifyUpdate();
|
||||
}
|
||||
|
||||
// Enable or disable all boxes for the current verbosity level and save the changes.
|
||||
void CLogWindow::OnToggleAll(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
static bool enable = false;
|
||||
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
|
||||
{
|
||||
m_checks->Check(i, enable);
|
||||
m_logManager->setEnable((LogTypes::LOG_TYPE)i, enable);
|
||||
|
||||
if (enable)
|
||||
{
|
||||
m_logManager->addListener((LogTypes::LOG_TYPE)i, this);
|
||||
|
||||
if (m_writeFile)
|
||||
m_logManager->addListener((LogTypes::LOG_TYPE)i, m_fileLog);
|
||||
if (m_writeConsole)
|
||||
m_logManager->addListener((LogTypes::LOG_TYPE)i, m_console);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_logManager->removeListener((LogTypes::LOG_TYPE)i, this);
|
||||
m_logManager->removeListener((LogTypes::LOG_TYPE)i, m_fileLog);
|
||||
m_logManager->removeListener((LogTypes::LOG_TYPE)i, m_console);
|
||||
}
|
||||
}
|
||||
|
||||
enable = !enable;
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
// Append checkboxes and update checked groups.
|
||||
void CLogWindow::UpdateChecks()
|
||||
{
|
||||
// This is only run once to append checkboxes to the wxCheckListBox.
|
||||
if (m_checks->GetCount() == 0)
|
||||
{
|
||||
// [F|RES] hide the window while we fill it... wxwidgets gets trouble
|
||||
// if you don't do it (at least the win version)
|
||||
m_checks->Show(false);
|
||||
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
|
||||
{
|
||||
m_checks->Append(wxString::FromAscii(m_logManager->getFullName( (LogTypes::LOG_TYPE)i )));
|
||||
}
|
||||
m_checks->Show(true);
|
||||
}
|
||||
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
|
||||
{
|
||||
m_checks->Check(i, m_logManager->isListener((LogTypes::LOG_TYPE)i, this));
|
||||
}
|
||||
}
|
||||
|
||||
// When an option is changed, save the change
|
||||
void CLogWindow::OnOptionsCheck(wxCommandEvent& event)
|
||||
{
|
||||
switch (event.GetId())
|
||||
{
|
||||
case IDM_VERBOSITY:
|
||||
{
|
||||
// get selection
|
||||
int v = m_verbosity->GetSelection();
|
||||
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
|
||||
{
|
||||
m_logManager->setLogLevel((LogTypes::LOG_TYPE)i, (LogTypes::LOG_LEVELS)v);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IDM_WRITEFILE:
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
|
||||
{
|
||||
m_writeFile = event.IsChecked();
|
||||
if (m_checks->IsChecked(i))
|
||||
{
|
||||
if (m_writeFile)
|
||||
m_logManager->addListener((LogTypes::LOG_TYPE)i, m_fileLog);
|
||||
else
|
||||
m_logManager->removeListener((LogTypes::LOG_TYPE)i, m_fileLog);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IDM_WRITECONSOLE:
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
|
||||
{
|
||||
m_writeConsole = event.IsChecked();
|
||||
if (m_checks->IsChecked(i))
|
||||
{
|
||||
if (m_writeConsole)
|
||||
m_logManager->addListener((LogTypes::LOG_TYPE)i, m_console);
|
||||
else
|
||||
m_logManager->removeListener((LogTypes::LOG_TYPE)i, m_console);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
// When a checkbox is changed
|
||||
void CLogWindow::OnLogCheck(wxCommandEvent& event)
|
||||
{
|
||||
int i = event.GetInt();
|
||||
if (m_checks->IsChecked(i))
|
||||
{
|
||||
m_logManager->addListener((LogTypes::LOG_TYPE)i, this);
|
||||
|
||||
if (m_writeFile)
|
||||
m_logManager->addListener((LogTypes::LOG_TYPE)i, m_fileLog);
|
||||
if (m_writeConsole)
|
||||
m_logManager->addListener((LogTypes::LOG_TYPE)i, m_console);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_logManager->removeListener((LogTypes::LOG_TYPE)i, this);
|
||||
m_logManager->removeListener((LogTypes::LOG_TYPE)i, m_fileLog);
|
||||
m_logManager->removeListener((LogTypes::LOG_TYPE)i, m_console);
|
||||
}
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
void CLogWindow::OnLogTimer(wxTimerEvent& WXUNUSED(event))
|
||||
{
|
||||
UpdateLog();
|
||||
}
|
||||
|
||||
void CLogWindow::NotifyUpdate()
|
||||
{
|
||||
UpdateChecks();
|
||||
UpdateLog();
|
||||
}
|
||||
|
||||
void CLogWindow::UpdateLog()
|
||||
{
|
||||
m_logTimer->Stop();
|
||||
for (unsigned int i = 0; i < msgQueue.size(); i++)
|
||||
{
|
||||
m_log->AppendText(msgQueue.front());
|
||||
msgQueue.pop();
|
||||
}
|
||||
m_logTimer->Start(UPDATETIME);
|
||||
}
|
||||
|
||||
void CLogWindow::Log(LogTypes::LOG_LEVELS level, const char *text)
|
||||
{
|
||||
if (level > NOTICE_LEVEL)
|
||||
return;
|
||||
|
||||
if (msgQueue.size() >= 100)
|
||||
msgQueue.pop();
|
||||
msgQueue.push(wxString::FromAscii(text));
|
||||
}
|
80
Source/Core/DolphinWX/Src/LogWindow.h
Normal file
80
Source/Core/DolphinWX/Src/LogWindow.h
Normal file
@ -0,0 +1,80 @@
|
||||
// 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_
|
||||
#include "LogManager.h"
|
||||
#include "IniFile.h"
|
||||
#include <queue>
|
||||
|
||||
enum
|
||||
{
|
||||
IDM_LOG,
|
||||
IDM_CLEARLOG,
|
||||
IDM_LOGCHECKS,
|
||||
IDM_OPTIONS,
|
||||
IDM_TOGGLEALL,
|
||||
IDM_WRITEFILE,
|
||||
IDM_WRITECONSOLE,
|
||||
IDTM_UPDATELOG,
|
||||
IDM_VERBOSITY,
|
||||
IDM_SUBMITCMD = 300,
|
||||
};
|
||||
|
||||
class wxTextCtrl;
|
||||
class wxCheckListBox;
|
||||
class wxString;
|
||||
|
||||
class CLogWindow : public wxDialog,Listener
|
||||
{
|
||||
public:
|
||||
CLogWindow(wxWindow* parent);
|
||||
~CLogWindow();
|
||||
void NotifyUpdate();
|
||||
|
||||
void SaveSettings();
|
||||
void LoadSettings();
|
||||
void Log(LogTypes::LOG_LEVELS, const char *text);
|
||||
|
||||
private:
|
||||
wxTextCtrl* m_log, * m_cmdline;
|
||||
bool m_writeFile, m_writeConsole;
|
||||
wxCheckBox* m_writeFileCB, * m_writeConsoleCB;
|
||||
wxTimer *m_logTimer;
|
||||
wxCheckListBox* m_checks;
|
||||
wxRadioBox *m_verbosity;
|
||||
FileLogListener *m_fileLog;
|
||||
ConsoleListener *m_console;
|
||||
LogManager *m_logManager;
|
||||
std::queue<wxString> msgQueue;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
void CreateGUIControls();
|
||||
void OnSubmit(wxCommandEvent& event);
|
||||
void OnOptionsCheck(wxCommandEvent& event);
|
||||
void OnLogCheck(wxCommandEvent& event);
|
||||
void OnClear(wxCommandEvent& event);
|
||||
void OnToggleAll(wxCommandEvent& event);
|
||||
void OnLogTimer(wxTimerEvent& WXUNUSED(event));
|
||||
|
||||
void UpdateChecks();
|
||||
void UpdateLog();
|
||||
|
||||
};
|
||||
|
||||
#endif /*LOGWINDOW_H_*/
|
@ -35,10 +35,10 @@
|
||||
#include "CPUDetect.h"
|
||||
#include "IniFile.h"
|
||||
#include "FileUtil.h"
|
||||
#include "ConsoleWindow.h"
|
||||
#include "Setup.h"
|
||||
|
||||
#include "Host.h" // Core
|
||||
#include "PluginManager.h"
|
||||
|
||||
#include "Globals.h" // Local
|
||||
#include "Main.h"
|
||||
@ -62,6 +62,7 @@ IMPLEMENT_APP(DolphinApp)
|
||||
|
||||
CFrame* main_frame = NULL;
|
||||
CCodeWindow* g_pCodeWindow = NULL;
|
||||
LogManager *logManager = NULL;
|
||||
|
||||
#ifdef WIN32
|
||||
//Has no error handling.
|
||||
@ -100,6 +101,7 @@ bool DolphinApp::OnInit()
|
||||
{
|
||||
//Console::Open();
|
||||
|
||||
NOTICE_LOG(BOOT, "Starting application");
|
||||
// Declarations and definitions
|
||||
bool UseDebugger = false;
|
||||
bool UseLogger = false;
|
||||
@ -220,7 +222,7 @@ bool DolphinApp::OnInit()
|
||||
#endif
|
||||
|
||||
// Load CONFIG_FILE settings
|
||||
SConfig::GetInstance().LoadSettings();
|
||||
SConfig::GetInstance().LoadSettings();
|
||||
|
||||
// Enable the PNG image handler
|
||||
wxInitAllImageHandlers();
|
||||
@ -232,10 +234,7 @@ bool DolphinApp::OnInit()
|
||||
const char *title = "Dolphin SVN R " SVN_REV_STR;
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// If we are debugging let use save the main window position and size
|
||||
// TODO: Save position and size on exit
|
||||
// ------------
|
||||
IniFile ini;
|
||||
ini.Load(DEBUGGER_CONFIG_FILE);
|
||||
|
||||
@ -245,19 +244,17 @@ bool DolphinApp::OnInit()
|
||||
ini.Get("MainWindow", "y", &y, 100);
|
||||
ini.Get("MainWindow", "w", &w, 800);
|
||||
ini.Get("MainWindow", "h", &h, 600);
|
||||
// -------------------
|
||||
|
||||
if (UseDebugger)
|
||||
{
|
||||
main_frame = new CFrame((wxFrame*) NULL, wxID_ANY, wxString::FromAscii(title),
|
||||
main_frame = new CFrame(UseLogger, (wxFrame*) NULL, wxID_ANY, wxString::FromAscii(title),
|
||||
wxPoint(x, y), wxSize(w, h));
|
||||
}
|
||||
else
|
||||
{
|
||||
main_frame = new CFrame((wxFrame*) NULL, wxID_ANY, wxString::FromAscii(title),
|
||||
wxPoint(100, 100), wxSize(w, h));
|
||||
main_frame = new CFrame(UseLogger, (wxFrame*) NULL, wxID_ANY, wxString::FromAscii(title),
|
||||
wxPoint(100, 100), wxSize(800, 600));
|
||||
}
|
||||
// ------------------
|
||||
|
||||
|
||||
// Create debugging window
|
||||
if (UseDebugger)
|
||||
@ -265,16 +262,6 @@ bool DolphinApp::OnInit()
|
||||
g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, main_frame);
|
||||
g_pCodeWindow->Show(true);
|
||||
}
|
||||
if(!UseDebugger && UseLogger)
|
||||
{
|
||||
#if LOGLEVEL > 0
|
||||
// We aren't using debugger, just logger
|
||||
// Should be fine for a local copy
|
||||
CLogWindow* m_LogWindow = new CLogWindow(main_frame);
|
||||
m_LogWindow->Show(true);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------
|
||||
// Check the autoboot options.
|
||||
|
@ -26,11 +26,7 @@
|
||||
#include "BootManager.h"
|
||||
void* g_pCodeWindow = NULL;
|
||||
void* main_frame = NULL;
|
||||
bool wxPanicAlert(const char* text, bool /*yes_no*/)
|
||||
{
|
||||
return(true);
|
||||
}
|
||||
|
||||
LogManager *logManager = NULL;
|
||||
|
||||
// OK, this thread boundary is DANGEROUS on linux
|
||||
// wxPostEvent / wxAddPendingEvent is the solution.
|
||||
@ -195,6 +191,7 @@ int main(int argc, char* argv[])
|
||||
return(1);
|
||||
}
|
||||
std::string bootFile(args_info.inputs[0]);
|
||||
logManager = (LogManager *)CPluginManager::GetInstance().GetGlobals()->logManager;
|
||||
|
||||
updateMainFrameEvent.Init();
|
||||
cpu_info.Detect();
|
||||
|
@ -7,7 +7,6 @@ wxenv = env.Clone()
|
||||
|
||||
files = [
|
||||
'BootManager.cpp',
|
||||
# 'Config.cpp',
|
||||
'cmdline.c',
|
||||
]
|
||||
|
||||
@ -22,6 +21,7 @@ if wxenv['HAVE_WX']:
|
||||
'ARCodeAddEdit.cpp',
|
||||
'ConfigMain.cpp',
|
||||
'Frame.cpp',
|
||||
'LogWindow.cpp',
|
||||
'FrameTools.cpp',
|
||||
'GameListCtrl.cpp',
|
||||
'Globals.cpp',
|
||||
@ -29,7 +29,6 @@ if wxenv['HAVE_WX']:
|
||||
'ISOProperties.cpp',
|
||||
'MemcardManager.cpp',
|
||||
'MemoryCards/GCMemcard.cpp',
|
||||
# 'PluginManager.cpp',
|
||||
'PatchAddEdit.cpp',
|
||||
'CheatsWindow.cpp',
|
||||
'stdafx.cpp',
|
||||
|
@ -201,9 +201,9 @@ void GetJoyState(CONTROLLER_STATE &_PadState, CONTROLLER_MAPPING _PadMapping, in
|
||||
|
||||
#ifdef SHOW_PAD_STATUS
|
||||
// Show the status of all connected pads
|
||||
if ((g_LastPad == 0 && Controller == 0) || Controller < g_LastPad) Console::ClearScreen();
|
||||
//if ((g_LastPad == 0 && Controller == 0) || Controller < g_LastPad) Console::ClearScreen();
|
||||
g_LastPad = Controller;
|
||||
Console::Print(
|
||||
DEBUG_LOG(CONSOLE,
|
||||
"Pad | Number:%i Enabled:%i Handle:%i\n"
|
||||
"Main Stick | X:%03i Y:%03i\n"
|
||||
"C Stick | X:%03i Y:%03i\n"
|
||||
|
@ -45,7 +45,6 @@
|
||||
#endif
|
||||
|
||||
#include "Common.h" // Common
|
||||
#include "ConsoleWindow.h"
|
||||
////////////////////////////
|
||||
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "MemoryUtil.h"
|
||||
#include "Thread.h"
|
||||
#include "OpcodeDecoding.h"
|
||||
#include "ConsoleWindow.h"
|
||||
|
||||
#include "Fifo.h"
|
||||
|
||||
|
@ -65,12 +65,10 @@ int TexDecoder_GetTextureSizeInBytes(int width, int height, int format)
|
||||
u32 TexDecoder_GetTlutHash(const u8* src, int len)
|
||||
{
|
||||
//char str[40000], st[20]; str[0]='\0';for (int i=0;i<len;i++){sprintf(st,"%02x ",src[i]);strcat(str,st);}
|
||||
//DebugLog("tlut: %s", str);
|
||||
u32 hash = 0xbeefbabe;
|
||||
for (int i = 0; i < len / 4; i ++) {
|
||||
hash = _rotl(hash, 7) ^ ((u32 *)src)[i];
|
||||
hash += 7; // to add a bit more entropy/mess in here
|
||||
//DebugLog("%02i | hash: %08x | src: %08x", i, hash, ((u32 *)src)[i]);
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
@ -49,8 +49,6 @@ extern SVideoInitialize g_VideoInitialize;
|
||||
// (mb2) for XFB update hack. TODO: find a static better place
|
||||
extern volatile u32 g_XFBUpdateRequested;
|
||||
|
||||
void DebugLog(const char* _fmt, ...);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
inline u8 *Memory_GetPtr(u32 _uAddress)
|
||||
{
|
||||
@ -140,7 +138,6 @@ struct TRectangle
|
||||
|
||||
// Logging
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void DebugLog(const char *_fmt, ...); // This one goes to the main program
|
||||
void HandleGLError();
|
||||
|
||||
|
||||
|
@ -667,10 +667,6 @@
|
||||
RelativePath=".\Src\VideoCommon.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\VideoLog.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
|
Reference in New Issue
Block a user