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

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

View File

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

View File

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

View File

@ -0,0 +1,137 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include <string> // System: To be able to add strings with "+"
#include <stdio.h>
#ifdef _WIN32
#include <windows.h>
#else
#include <stdarg.h>
#endif
#include "Common.h"
#include "LogManager.h" // Common
/* Start console window - width and height is the size of console window */
ConsoleListener::ConsoleListener(int Width, int Height, char * Name) :
Listener("console")
{
#ifdef _WIN32
// Open the console window and create the window handle for GetStdHandle()
AllocConsole();
// Save the window handle that AllocConsole() created
m_hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
// Set the console window title
SetConsoleTitle(Name);
// Set the total letter space
COORD co = {Width, Height};
SetConsoleScreenBufferSize(m_hStdOut, co);
/* Set the window size in number of letters. The height is hardcoded here
because it can be changed with MoveWindow() later */
SMALL_RECT coo = {0,0, (Width - 1),50}; // Top, left, right, bottom
SetConsoleWindowInfo(m_hStdOut, TRUE, &coo);
#endif
}
/* Close the console window and close the eventual file handle */
ConsoleListener::~ConsoleListener()
{
#ifdef _WIN32
FreeConsole(); // Close the console window
#else
fflush(NULL);
#endif
}
// Logs the message to screen
void ConsoleListener::Log(LogTypes::LOG_LEVELS, const char *text)
{
#if defined(_WIN32)
DWORD cCharsWritten; // We will get a value back here
WriteConsole(m_hStdOut, text, (DWORD)strlen(text),
&cCharsWritten, NULL);
#else
fprintf(stderr, "%s", text);
#endif
}
// Clear console screen
void ConsoleListener::ClearScreen()
{
#if defined(_WIN32)
COORD coordScreen = { 0, 0 };
DWORD cCharsWritten;
CONSOLE_SCREEN_BUFFER_INFO csbi;
DWORD dwConSize;
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
GetConsoleScreenBufferInfo(hConsole, &csbi);
dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
FillConsoleOutputCharacter(hConsole, TEXT(' '), dwConSize,
coordScreen, &cCharsWritten);
GetConsoleScreenBufferInfo(hConsole, &csbi);
FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize,
coordScreen, &cCharsWritten);
SetConsoleCursorPosition(hConsole, coordScreen);
#endif
}
/* Get window handle of console window to be able to resize it. We use
GetConsoleTitle() and FindWindow() to locate the console window handle. */
#if defined(_WIN32)
HWND GetHwnd(void)
{
#define MY_BUFSIZE 1024 // Buffer size for console window titles
HWND hwndFound; // This is what is returned to the caller
char pszNewWindowTitle[MY_BUFSIZE]; // Contains fabricated WindowTitle
char pszOldWindowTitle[MY_BUFSIZE]; // Contains original WindowTitle
// Fetch current window title.
GetConsoleTitle(pszOldWindowTitle, MY_BUFSIZE);
// Format a "unique" NewWindowTitle
wsprintf(pszNewWindowTitle, "%d/%d", GetTickCount(), GetCurrentProcessId());
// Change current window title
SetConsoleTitle(pszNewWindowTitle);
// Ensure window title has been updated
Sleep(40);
// Look for NewWindowTitle
hwndFound = FindWindow(NULL, pszNewWindowTitle);
// Restore original window title
SetConsoleTitle(pszOldWindowTitle);
return(hwndFound);
}
#endif // _WIN32

View File

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

View File

@ -18,6 +18,12 @@
#ifndef _LOG_H #ifndef _LOG_H
#define _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 namespace LogTypes
{ {
@ -41,6 +47,7 @@ enum LOG_TYPE {
MASTER_LOG, MASTER_LOG,
MEMMAP, MEMMAP,
OSREPORT, OSREPORT,
PAD,
PERIPHERALINTERFACE, PERIPHERALINTERFACE,
PIXELENGINE, PIXELENGINE,
SERIALINTERFACE, SERIALINTERFACE,
@ -56,15 +63,18 @@ enum LOG_TYPE {
WII_IPC_NET, WII_IPC_NET,
WII_IPC_SD, WII_IPC_SD,
WII_IPC_WIIMOTE, WII_IPC_WIIMOTE,
WIIMOTE,
NUMBER_OF_LOGS // Must be last NUMBER_OF_LOGS // Must be last
}; };
// FIXME: should this be removed?
enum LOG_LEVELS { enum LOG_LEVELS {
LERROR = 1, // Bad errors - that still don't deserve a PanicAlert. LERROR = ERROR_LEVEL,
LWARNING, // Something is suspicious. LWARNING = WARNING_LEVEL,
LINFO, // General information. LNOTICE = NOTICE_LEVEL,
LDEBUG, // Strictly for detailed debugging - might make things slow. LINFO = INFO_LEVEL,
LDEBUG = DEBUG_LEVEL,
}; };
} // namespace } // namespace
@ -73,47 +83,52 @@ enum LOG_LEVELS {
/* /*
FIXME: FIXME:
- Debug_run() - run only in debug time - Debug_run() - run only in debug time
- Compile the log functions according to LOGLEVEL
*/ */
#ifdef LOGGING #if defined LOGGING || defined _DEBUG || defined DEBUGFAST
#define LOGLEVEL 4 //LogTypes::LDEBUG #define LOGLEVEL DEBUG_LEVEL
#else #else
#ifndef LOGLEVEL #ifndef LOGLEVEL
#define LOGLEVEL 2 //LogTypes::LWARNING #define LOGLEVEL NOTICE_LEVEL
#endif // loglevel #endif // loglevel
#endif // logging #endif // logging
#define ERROR_LOG(...) {} #define ERROR_LOG(...) {}
#define WARN_LOG(...) {} #define WARN_LOG(...) {}
#define NOTICE_LOG(...) {}
#define INFO_LOG(...) {} #define INFO_LOG(...) {}
#define DEBUG_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 // 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 #undef ERROR_LOG
#define ERROR_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LERROR, __VA_ARGS__)} #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 #undef WARN_LOG
#define WARN_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LWARNING, __VA_ARGS__)} #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 #undef INFO_LOG
#define INFO_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LINFO, __VA_ARGS__)} #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 #undef DEBUG_LOG
#define DEBUG_LOG(t,...) {GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, __VA_ARGS__)} #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_) \ #define _dbg_assert_(_t_, _a_) \
if (!(_a_)) {\ if (!(_a_)) {\
ERROR_LOG(_t_, "Error...\n\n Line: %d\n File: %s\n Time: %s\n\nIgnore and continue?", \ 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_(_t_, _a_) ;
#define _dbg_assert_msg_(_t_, _a_, _desc_, ...) ; #define _dbg_assert_msg_(_t_, _a_, _desc_, ...) ;
#endif // dbg_assert #endif // dbg_assert
#endif // LOGLEVEL LDEBUG #endif // LOGLEVEL DEBUG
#define _assert_(_a_) _dbg_assert_(MASTER_LOG, _a_) #define _assert_(_a_) _dbg_assert_(MASTER_LOG, _a_)
#ifdef _WIN32 #ifdef _WIN32

View File

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

View File

@ -0,0 +1,206 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _LOGMANAGER_H
#define _LOGMANAGER_H
#include "Log.h"
#include "Thread.h"
#include "StringUtil.h"
#ifdef _WIN32
#include <windows.h>
#endif
#include <vector>
#include <string.h>
#include <stdio.h>
#define MAX_MESSAGES 8000
#define MAX_MSGLEN 512
class Listener {
public:
Listener(const char *name) : m_name(name) {}
virtual void Log(LogTypes::LOG_LEVELS, const char *msg) = 0;
virtual const char *getName() { return m_name; }
private:
const char *m_name;
};
class FileLogListener : public Listener {
public:
FileLogListener(const char *filename);
~FileLogListener();
void Log(LogTypes::LOG_LEVELS, const char *msg);
bool isValid() {
return (m_logfile != NULL);
}
bool isEnable() {
return m_enable;
}
void setEnable(bool enable) {
m_enable = enable;
}
private:
char *m_filename;
FILE *m_logfile;
bool m_enable;
};
class ConsoleListener : public Listener
{
public:
ConsoleListener(int Width = 150, int Height = 100,
char * Name = "Console");
~ConsoleListener();
void Log(LogTypes::LOG_LEVELS, const char *text);
void ClearScreen();
private:
#ifdef _WIN32
HWND GetHwnd(void);
HANDLE m_hStdOut;
#endif
};
class LogContainer {
public:
LogContainer(const char* shortName, const char* fullName,
bool enable = false) : m_enable(enable) {
strncpy(m_fullName, fullName, 128);
strncpy(m_shortName, shortName, 32);
m_level = LogTypes::LWARNING;
}
const char *getShortName() {
return m_shortName;
}
const char *getFullName() {
return m_fullName;
}
bool isListener(Listener *listener);
void addListener(Listener *listener);
void removeListener(Listener *listener);
void trigger(LogTypes::LOG_LEVELS, const char *msg);
bool isEnable() {
return m_enable;
}
void setEnable(bool enable) {
m_enable = enable;
}
LogTypes::LOG_LEVELS getLevel() {
return m_level;
}
void setLevel(LogTypes::LOG_LEVELS level) {
m_level = level;
}
private:
char m_fullName[128];
char m_shortName[32];
bool m_enable;
LogTypes::LOG_LEVELS m_level;
std::vector<Listener *> listeners;
};
class LogManager
{
private:
LogContainer* m_Log[LogTypes::NUMBER_OF_LOGS];
Common::CriticalSection* logMutex;
FileLogListener *m_fileLog;
ConsoleListener *m_consoleLog;
static LogManager *m_logManager; // FIXME: find a way without singletone
public:
static u32 GetMaxLevel() {
return LOGLEVEL;
}
void Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
const char *fmt, ...);
void setLogLevel(LogTypes::LOG_TYPE type, LogTypes::LOG_LEVELS level){
m_Log[type]->setLevel(level);
}
void setEnable(LogTypes::LOG_TYPE type, bool enable) {
m_Log[type]->setEnable(enable);
}
const char *getShortName(LogTypes::LOG_TYPE type) {
return m_Log[type]->getShortName();
}
const char *getFullName(LogTypes::LOG_TYPE type) {
return m_Log[type]->getFullName();
}
bool isListener(LogTypes::LOG_TYPE type, Listener *listener) {
return m_Log[type]->isListener(listener);
}
void addListener(LogTypes::LOG_TYPE type, Listener *listener) {
m_Log[type]->addListener(listener);
}
void removeListener(LogTypes::LOG_TYPE type, Listener *listener);
FileLogListener *getFileListener() {
return m_fileLog;
}
ConsoleListener *getConsoleListener() {
return m_consoleLog;
}
static LogManager* GetInstance() {
if (! m_logManager)
m_logManager = new LogManager();
return m_logManager;
}
static void SetInstance(LogManager *logManager) {
m_logManager = logManager;
}
LogManager();
~LogManager();
};
#endif // LOGMANAGER_H

View File

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

View File

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

View File

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

View File

@ -34,10 +34,12 @@
#endif #endif
#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 // Definitions
// ------------ // ------------
// This may not be defined outside _WIN32 // This may not be defined outside _WIN32

View File

@ -2264,14 +2264,6 @@
RelativePath=".\Src\Host.h" RelativePath=".\Src\Host.h"
> >
</File> </File>
<File
RelativePath=".\Src\LogManager.cpp"
>
</File>
<File
RelativePath=".\Src\LogManager.h"
>
</File>
<File <File
RelativePath=".\Src\MemTools.cpp" RelativePath=".\Src\MemTools.cpp"
> >

View File

@ -178,7 +178,7 @@ void LogInfo(const char *format, ...)
{ {
if (!b_RanOnce) if (!b_RanOnce)
{ {
if (LogManager::GetLevel() >= LogTypes::LINFO || logSelf) if (LogManager::GetMaxLevel() >= LogTypes::LINFO || logSelf)
{ {
char* temp = (char*)alloca(strlen(format)+512); char* temp = (char*)alloca(strlen(format)+512);
va_list args; va_list args;

View File

@ -20,6 +20,7 @@
#include "Common.h" #include "Common.h"
#include "IniFile.h" #include "IniFile.h"
#include "ConfigManager.h" #include "ConfigManager.h"
#include "PluginManager.h"
#include "FileUtil.h" #include "FileUtil.h"
SConfig SConfig::m_Instance; SConfig SConfig::m_Instance;
@ -27,6 +28,7 @@ SConfig SConfig::m_Instance;
SConfig::SConfig() SConfig::SConfig()
{ {
// Make sure we have log manager
LoadSettings(); LoadSettings();
} }
@ -39,6 +41,7 @@ SConfig::~SConfig()
void SConfig::SaveSettings() void SConfig::SaveSettings()
{ {
NOTICE_LOG(BOOT, "Saving Settings to %s", CONFIG_FILE);
IniFile ini; IniFile ini;
#if defined(__APPLE__) #if defined(__APPLE__)
ini.Load(File::GetConfigDirectory()); // yes we must load first to not kill unknown stuff ini.Load(File::GetConfigDirectory()); // yes we must load first to not kill unknown stuff
@ -72,6 +75,9 @@ void SConfig::SaveSettings()
ini.Set("Interface", "ShowWiimoteSpeakers", m_LocalCoreStartupParameter.bWiiSpeakers); ini.Set("Interface", "ShowWiimoteSpeakers", m_LocalCoreStartupParameter.bWiiSpeakers);
// interface(UI) language // 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 // Core
ini.Set("Core", "HLEBios", m_LocalCoreStartupParameter.bHLEBios); ini.Set("Core", "HLEBios", m_LocalCoreStartupParameter.bHLEBios);
@ -123,6 +129,8 @@ void SConfig::SaveSettings()
void SConfig::LoadSettings() void SConfig::LoadSettings()
{ {
NOTICE_LOG(BOOT, "Loading Settings from %s", CONFIG_FILE);
IniFile ini; IniFile ini;
#if defined(__APPLE__) #if defined(__APPLE__)
ini.Load(File::GetConfigDirectory()); ini.Load(File::GetConfigDirectory());
@ -167,6 +175,9 @@ void SConfig::LoadSettings()
ini.Get("Interface", "ShowWiimoteSpeakers", &m_LocalCoreStartupParameter.bWiiSpeakers, false); ini.Get("Interface", "ShowWiimoteSpeakers", &m_LocalCoreStartupParameter.bWiiSpeakers, false);
// interface(UI) language // 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 // Core
ini.Get("Core", "HLEBios", &m_LocalCoreStartupParameter.bHLEBios, true); ini.Get("Core", "HLEBios", &m_LocalCoreStartupParameter.bHLEBios, true);

View File

@ -61,6 +61,11 @@ struct SConfig
// interface language // interface language
INTERFACE_LANGUAGE m_InterfaceLanguage; INTERFACE_LANGUAGE m_InterfaceLanguage;
// other interface settings
bool m_InterfaceToolbar;
bool m_InterfaceStatusbar;
bool m_InterfaceLogWindow;
// save settings // save settings
void SaveSettings(); void SaveSettings();

View File

@ -30,8 +30,8 @@
#include "PowerPCDisasm.h" #include "PowerPCDisasm.h"
#include "Console.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 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) void Console_Submit(const char *cmd)
{ {
@ -53,7 +53,7 @@ void Console_Submit(const char *cmd)
if (addr) if (addr)
{ {
#if LOGLEVEL >= 3 #if LOGLEVEL >= INFO_LEVEL
u32 EA = u32 EA =
#endif #endif
Memory::CheckDTLB(addr, Memory::FLAG_NO_EXCEPTION); Memory::CheckDTLB(addr, Memory::FLAG_NO_EXCEPTION);
@ -120,7 +120,8 @@ void Console_Submit(const char *cmd)
TCHAR temp[256]; TCHAR temp[256];
sscanf(cmd, "%s %08x %08x", temp, &start, &end); sscanf(cmd, "%s %08x %08x", temp, &start, &end);
char disasm[256]; 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); u32 data = Memory::ReadUnchecked_U32(addr);
DisassembleGekko(data, addr, disasm, 256); DisassembleGekko(data, addr, disasm, 256);
printf("%08x: %08x: %s\n", addr, data, disasm); printf("%08x: %08x: %s\n", addr, data, disasm);
@ -149,7 +150,8 @@ void Console_Submit(const char *cmd)
{ {
g_symbolDB.List(); g_symbolDB.List();
} }
else { else
{
printf("blach\n"); printf("blach\n");
ERROR_LOG(CONSOLE, "Invalid command"); ERROR_LOG(CONSOLE, "Invalid command");
} }

View File

@ -28,7 +28,6 @@
#include "Thread.h" #include "Thread.h"
#include "Timer.h" #include "Timer.h"
#include "Common.h" #include "Common.h"
#include "ConsoleWindow.h"
#include "StringUtil.h" #include "StringUtil.h"
#include "Console.h" #include "Console.h"
@ -161,7 +160,7 @@ void ReconnectPad()
CPluginManager &Plugins = CPluginManager::GetInstance(); CPluginManager &Plugins = CPluginManager::GetInstance();
Plugins.FreePad(0); Plugins.FreePad(0);
Plugins.GetPad(0)->Config(g_pWindowHandle); 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 // 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 /* JP: Yes, it's basically nothing right now, I could not figure out how to reset the Wiimote
for reconnection */ for reconnection */
HW::InitWiimote(); HW::InitWiimote();
Console::Print("ReconnectWiimote()\n"); INFO_LOG(CONSOLE, "ReconnectWiimote()\n");
} }
// ----------------------------------------- // -----------------------------------------
@ -182,7 +181,7 @@ void ReconnectWiimote()
VideoThreadRunning = false; VideoThreadRunning = false;
VideoThreadEvent.SetTimer(); VideoThreadEvent.SetTimer();
VideoThreadEvent2.SetTimer(); VideoThreadEvent2.SetTimer();
//Console::Print("VideoThreadEnd\n"); //INFO_LOG(CONSOLE, "VideoThreadEnd\n");
} }
#endif #endif
// --------------------------- // ---------------------------
@ -207,7 +206,8 @@ bool Init()
SCoreStartupParameter &_CoreParameter = SConfig::GetInstance().m_LocalCoreStartupParameter; SCoreStartupParameter &_CoreParameter = SConfig::GetInstance().m_LocalCoreStartupParameter;
g_CoreStartupParameter = _CoreParameter; g_CoreStartupParameter = _CoreParameter;
LogManager::Init(); NOTICE_LOG(BOOT, "Starting core");
// FIXME DEBUG_LOG(BOOT, dump_params());
Host_SetWaitCursor(true); Host_SetWaitCursor(true);
// Start the thread again // Start the thread again
@ -241,8 +241,8 @@ void Stop()
#ifdef SETUP_TIMER_WAITING #ifdef SETUP_TIMER_WAITING
if (!StopUpToVideoDone) if (!StopUpToVideoDone)
{ {
Console::Print("--------------------------------------------------------------\n"); INFO_LOG(CONSOLE, "--------------------------------------------------------------\n");
Console::Print("Stop [Main Thread]: Shutting down...\n"); INFO_LOG(CONSOLE, "Stop [Main Thread]: Shutting down...\n");
// Reset variables // Reset variables
StopReachedEnd = false; StopReachedEnd = false;
EmuThreadReachedEnd = false; EmuThreadReachedEnd = false;
@ -265,7 +265,7 @@ void Stop()
// If dual core mode, the CPU thread should immediately exit here. // If dual core mode, the CPU thread should immediately exit here.
if (_CoreParameter.bUseDualCore) { 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(); CPluginManager::GetInstance().GetVideo()->Video_ExitLoop();
} }
@ -276,7 +276,7 @@ void Stop()
//if (!VideoThreadEvent.TimerWait(Stop, 1, EmuThreadReachedEnd) || !EmuThreadReachedEnd) return; //if (!VideoThreadEvent.TimerWait(Stop, 1, EmuThreadReachedEnd) || !EmuThreadReachedEnd) return;
if (!VideoThreadEvent.TimerWait(Stop, 1)) return; if (!VideoThreadEvent.TimerWait(Stop, 1)) return;
//Console::Print("Stop() will continue\n"); //INFO_LOG(CONSOLE, "Stop() will continue\n");
#endif #endif
// Video_EnterLoop() should now exit so that EmuThread() will continue concurrently with the rest // Video_EnterLoop() should now exit so that EmuThread() will continue concurrently with the rest
@ -284,9 +284,8 @@ void Stop()
// Close the trace file // Close the trace file
Core::StopTrace(); Core::StopTrace();
#ifndef SETUP_TIMER_WAITING // This hangs NOTICE_LOG(BOOT, "Shutting core");
LogManager::Shutdown();
#endif
// Update mouse pointer // Update mouse pointer
Host_SetWaitCursor(false); Host_SetWaitCursor(false);
#ifdef SETUP_AVOID_CHILD_WINDOW_RENDERING_HANG #ifdef SETUP_AVOID_CHILD_WINDOW_RENDERING_HANG
@ -307,8 +306,8 @@ void Stop()
Host_UpdateGUI(); Host_UpdateGUI();
StopUpToVideoDone = false; StopUpToVideoDone = false;
StopReachedEnd = true; StopReachedEnd = true;
//Console::Print("Stop() reached the end\n"); //INFO_LOG(CONSOLE, "Stop() reached the end\n");
if (EmuThreadReachedEnd) Console::Print("--------------------------------------------------------------\n"); if (EmuThreadReachedEnd) INFO_LOG(CONSOLE, "--------------------------------------------------------------\n");
#endif #endif
} }
@ -521,7 +520,7 @@ THREAD_RETURN EmuThread(void *pArg)
#ifdef SETUP_TIMER_WAITING #ifdef SETUP_TIMER_WAITING
VideoThreadEvent2.TimerWait(EmuThreadEnd, 2); VideoThreadEvent2.TimerWait(EmuThreadEnd, 2);
//Console::Print("Video loop [Video Thread]: Stopped\n"); //INFO_LOG(CONSOLE, "Video loop [Video Thread]: Stopped\n");
return 0; return 0;
} }
@ -530,23 +529,23 @@ void EmuThreadEnd()
CPluginManager &Plugins = CPluginManager::GetInstance(); CPluginManager &Plugins = CPluginManager::GetInstance();
const SCoreStartupParameter& _CoreParameter = SConfig::GetInstance().m_LocalCoreStartupParameter; 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)) return;
if (!VideoThreadEvent2.TimerWait(EmuThreadEnd, 2, StopReachedEnd) || !StopReachedEnd) 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; 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 /* There will be a few problems with the OpenGL ShutDown() after this, for example the "Release
Device Context Failed" error message */ Device Context Failed" error message */
#endif #endif
Console::Print("Stop [Video Thread]: Stop() and Video Loop Ended\n"); INFO_LOG(CONSOLE, "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]: Shutting down HW and Plugins\n");
// We have now exited the Video Loop and will shut down // We have now exited the Video Loop and will shut down
@ -582,10 +581,10 @@ void EmuThreadEnd()
Host_UpdateMainFrame(); Host_UpdateMainFrame();
#ifdef SETUP_TIMER_WAITING #ifdef SETUP_TIMER_WAITING
EmuThreadReachedEnd = true; EmuThreadReachedEnd = true;
//Console::Print("EmuThread() reached the end\n"); //INFO_LOG(CONSOLE, "EmuThread() reached the end\n");
Host_UpdateGUI(); Host_UpdateGUI();
Console::Print("Stop [Video Thread]: Done\n"); INFO_LOG(CONSOLE, "Stop [Video Thread]: Done\n");
if (StopReachedEnd) Console::Print("--------------------------------------------------------------\n"); if (StopReachedEnd) INFO_LOG(CONSOLE, "--------------------------------------------------------------\n");
delete g_EmuThread; // Wait for emuthread to close. delete g_EmuThread; // Wait for emuthread to close.
g_EmuThread = 0; g_EmuThread = 0;
#endif #endif
@ -717,7 +716,7 @@ void Callback_VideoCopiedToXFB()
// WARNING - THIS MAY EXECUTED FROM DSP THREAD // 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);
} }
// __________________________________________________________________________________________________ // __________________________________________________________________________________________________
@ -733,6 +732,7 @@ void Callback_DSPInterrupt()
// //
void Callback_PADLog(const TCHAR* _szMessage) void Callback_PADLog(const TCHAR* _szMessage)
{ {
// FIXME add levels
INFO_LOG(SERIALINTERFACE, _szMessage); 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) 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 // TODO: Get rid of at some point

View File

@ -115,7 +115,7 @@ void RerecordingStart()
ReRecTimer.Start(); ReRecTimer.Start();
// Logging // Logging
//Console::Print("RerecordingStart: %i\n", g_FrameCounter); //DEBUG_LOG(CONSOLE, "RerecordingStart: %i\n", g_FrameCounter);
} }
// Reset the frame counter // Reset the frame counter
@ -159,7 +159,7 @@ void WindBack(int Counter)
ReRecTimer.WindBackStartingTime((u64)CurrentTimeSeconds * 1000); ReRecTimer.WindBackStartingTime((u64)CurrentTimeSeconds * 1000);
// Logging // Logging
Console::Print("WindBack: %i %u\n", Counter, (u64)CurrentTimeSeconds); DEBUG_LOG(CONSOLE, "WindBack: %i %u\n", Counter, (u64)CurrentTimeSeconds);
} }
//////////////////////////////////////// ////////////////////////////////////////

View File

@ -241,7 +241,7 @@ void CEXIMemoryCard::TransferByte(u8 &byte)
{ {
command = byte; // first byte is command command = byte; // first byte is command
byte = 0xFF; // would be tristate, but we don't care. 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) if(command == cmdClearStatus)
{ {

View File

@ -136,7 +136,7 @@ protected:
of 4 byte commands. */ of 4 byte commands. */
// ---------------- // ----------------
void DumpCommands(u32 _CommandAddress, size_t _NumberOfCommands = 8, 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", GENERIC_LOG(LogType, Verbosity, "CommandDump of %s",
GetDeviceName().c_str()); 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,"%s - IOCtlV OutBuffer[%i]:", GetDeviceName().c_str(), i);
INFO_LOG(WII_IPC_HLE, " OutBuffer: 0x%08x (0x%x):", OutBuffer, OutBufferSize); INFO_LOG(WII_IPC_HLE, " OutBuffer: 0x%08x (0x%x):", OutBuffer, OutBufferSize);
#if defined LOGLEVEL && LOGLEVEL > 2 #if defined LOGLEVEL && LOGLEVEL > NOTICE_LEVEL
DumpCommands(OutBuffer, OutBufferSize, LogTypes::WII_IPC_HLE, 1); DumpCommands(OutBuffer, OutBufferSize, LogTypes::WII_IPC_HLE, LogTypes::LINFO);
#endif #endif
} }
} }

View File

@ -18,8 +18,6 @@
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// Include // Include
#include "ConsoleWindow.h" // Common
#include "../Core.h" // Local core functions #include "../Core.h" // Local core functions
#include "../Debugger/Debugger_SymbolMap.h" #include "../Debugger/Debugger_SymbolMap.h"
#include "../Host.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" "anyway. It is strongly recommed to save and/or restart the\n"
"emulation."); "emulation.");
} }
Console::Print("IPC CommandDisconnect\n"); INFO_LOG(CONSOLE, "IPC CommandDisconnect\n");
// Send message to plugin // Send message to plugin
/* /*

View File

@ -54,8 +54,6 @@
if it works I'd rather be without FreeLibrary() between Start and Stop. if it works I'd rather be without FreeLibrary() between Start and Stop.
//////////////////////////////////////*/ //////////////////////////////////////*/
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// Include // Include
// ¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯
@ -71,7 +69,6 @@
#include "FileSearch.h" // Common #include "FileSearch.h" // Common
#include "FileUtil.h" #include "FileUtil.h"
#include "StringUtil.h" #include "StringUtil.h"
#include "ConsoleWindow.h"
#include "Setup.h" #include "Setup.h"
// Create the plugin manager class // Create the plugin manager class
@ -84,13 +81,16 @@ CPluginManager CPluginManager::m_Instance;
// ¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯
// The plugin manager is some sort of singleton that runs during Dolphin's entire lifespan. // The plugin manager is some sort of singleton that runs during Dolphin's entire lifespan.
CPluginManager::CPluginManager() : CPluginManager::CPluginManager()
m_params(SConfig::GetInstance().m_LocalCoreStartupParameter)
{ {
m_PluginGlobals = new PLUGIN_GLOBALS; m_PluginGlobals = new PLUGIN_GLOBALS;
// Start LogManager
m_PluginGlobals->logManager = LogManager::GetInstance();
m_PluginGlobals->eventHandler = EventHandler::GetInstance(); m_PluginGlobals->eventHandler = EventHandler::GetInstance();
m_PluginGlobals->config = (void *)&SConfig::GetInstance(); m_PluginGlobals->config = (void *)&SConfig::GetInstance();
m_PluginGlobals->messageLogger = NULL;
m_params = &(SConfig::GetInstance().m_LocalCoreStartupParameter);
// Set initial values to NULL. // Set initial values to NULL.
m_video = NULL; m_video = NULL;
@ -104,7 +104,7 @@ CPluginManager::CPluginManager() :
// This will call FreeLibrary() for all plugins // This will call FreeLibrary() for all plugins
CPluginManager::~CPluginManager() CPluginManager::~CPluginManager()
{ {
Console::Print("Delete CPluginManager\n"); INFO_LOG(CONSOLE, "Delete CPluginManager\n");
delete m_PluginGlobals; delete m_PluginGlobals;
delete m_dsp; delete m_dsp;
@ -113,7 +113,7 @@ CPluginManager::~CPluginManager()
{ {
if (m_pad[i] && OkayToInitPlugin(i)) if (m_pad[i] && OkayToInitPlugin(i))
{ {
Console::Print("Delete: %i\n", i); INFO_LOG(CONSOLE, "Delete: %i\n", i);
delete m_pad[i]; delete m_pad[i];
} }
m_pad[i] = NULL; m_pad[i] = NULL;
@ -138,13 +138,13 @@ bool CPluginManager::InitPlugins()
PanicAlert("Can't init DSP Plugin"); PanicAlert("Can't init DSP Plugin");
return false; return false;
} }
Console::Print("Before GetVideo\n"); INFO_LOG(CONSOLE, "Before GetVideo\n");
if (!GetVideo()) { if (!GetVideo()) {
PanicAlert("Can't init Video Plugin"); PanicAlert("Can't init Video Plugin");
return false; return false;
} }
Console::Print("After GetVideo\n"); INFO_LOG(CONSOLE, "After GetVideo\n");
// Check if we get at least one pad or wiimote // Check if we get at least one pad or wiimote
bool pad = false; bool pad = false;
@ -154,7 +154,7 @@ bool CPluginManager::InitPlugins()
for (int i = 0; i < MAXPADS; i++) for (int i = 0; i < MAXPADS; i++)
{ {
// Check that the plugin has a name // Check that the plugin has a name
if (!m_params.m_strPadPlugin[i].empty()) if (!m_params->m_strPadPlugin[i].empty())
GetPad(i); GetPad(i);
// Check that GetPad succeeded // Check that GetPad succeeded
if (m_pad[i] != NULL) if (m_pad[i] != NULL)
@ -167,9 +167,9 @@ bool CPluginManager::InitPlugins()
} }
// Init wiimote // Init wiimote
if (m_params.bWii) { if (m_params->bWii) {
for (int i = 0; i < MAXWIIMOTES; i++) { for (int i = 0; i < MAXWIIMOTES; i++) {
if (!m_params.m_strWiimotePlugin[i].empty()) if (!m_params->m_strWiimotePlugin[i].empty())
GetWiimote(i); GetWiimote(i);
if (m_wiimote[i] != NULL) 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() // We are now done with this plugin and will call FreeLibrary()
delete plugin; 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) if (m_PluginInfos.at(i).GetFilename() == Filename)
{ {
info = &m_PluginInfos.at(i); info = &m_PluginInfos.at(i);
if (info == NULL)
{
PanicAlert("error reading info from dll");
}
return; return;
} }
} }
@ -292,29 +289,23 @@ void *CPluginManager::LoadPlugin(const char *_rFilename, int Number)
{ {
// Create a string of the filename // Create a string of the filename
std::string Filename = _rFilename; 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 /* Avoid calling LoadLibrary() again and instead point to the plugin info that we found when
Dolphin was started */ Dolphin was started */
CPluginInfo *info = NULL; CPluginInfo *info = NULL;
if (!Filename.empty()){
GetPluginInfo(info, Filename); GetPluginInfo(info, Filename);
if (info == NULL) if (! info) {
{ PanicAlert("Error loading %s: can't read info", _rFilename);
PanicAlert("Can't open %s, it's missing", _rFilename);
return NULL;
}
}
else{
PanicAlert("error with dll Filename (its NULL)");
return NULL; return NULL;
} }
PLUGIN_TYPE type = info->GetPluginInfo().Type; PLUGIN_TYPE type = info->GetPluginInfo().Type;
Common::CPlugin *plugin = NULL; 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) switch (type)
{ {
case PLUGIN_TYPE_VIDEO: case PLUGIN_TYPE_VIDEO:
@ -355,7 +346,7 @@ int CPluginManager::OkayToInitPlugin(int Plugin)
{ {
// Compare it to the earlier plugins // Compare it to the earlier plugins
for (int i = 0; i < Plugin; i++) 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; return i;
// No there is no duplicate plugin // No there is no duplicate plugin
@ -424,16 +415,16 @@ void CPluginManager::ScanForPlugins()
Common::PluginPAD *CPluginManager::GetPad(int controller) Common::PluginPAD *CPluginManager::GetPad(int controller)
{ {
if (m_pad[controller] != NULL) 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]; return m_pad[controller];
// Else do this // Else do this
if (OkayToInitPlugin(controller) == -1) { if (OkayToInitPlugin(controller) == -1) {
m_pad[controller] = (Common::PluginPAD*)LoadPlugin(m_params.m_strPadPlugin[controller].c_str(), controller); m_pad[controller] = (Common::PluginPAD*)LoadPlugin(m_params->m_strPadPlugin[controller].c_str(), controller);
Console::Print("LoadPlugin: %i\n", controller); INFO_LOG(CONSOLE, "LoadPlugin: %i\n", controller);
} }
else { 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)]; m_pad[controller] = m_pad[OkayToInitPlugin(controller)];
} }
return m_pad[controller]; return m_pad[controller];
@ -442,21 +433,21 @@ Common::PluginPAD *CPluginManager::GetPad(int controller)
Common::PluginWiimote *CPluginManager::GetWiimote(int controller) Common::PluginWiimote *CPluginManager::GetWiimote(int controller)
{ {
if (m_wiimote[controller] != NULL) 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]; return m_wiimote[controller];
// Else load a new plugin // 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]; return m_wiimote[controller];
} }
Common::PluginDSP *CPluginManager::GetDSP() Common::PluginDSP *CPluginManager::GetDSP()
{ {
if (m_dsp != NULL) if (m_dsp != NULL)
if (m_dsp->GetFilename() == m_params.m_strDSPPlugin) if (m_dsp->GetFilename() == m_params->m_strDSPPlugin)
return m_dsp; return m_dsp;
// Else load a new plugin // 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; return m_dsp;
} }
@ -467,7 +458,7 @@ Common::PluginVideo *CPluginManager::GetVideo()
if (m_video != NULL) if (m_video != NULL)
{ {
// Check if the video plugin has been changed // 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; return m_video;
// Then free the current video plugin, // Then free the current video plugin,
else else
@ -475,7 +466,7 @@ Common::PluginVideo *CPluginManager::GetVideo()
} }
// and load a new plugin // 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; return m_video;
} }

View File

@ -76,7 +76,7 @@ private:
Common::PluginWiimote *m_wiimote[4]; Common::PluginWiimote *m_wiimote[4];
Common::PluginDSP *m_dsp; Common::PluginDSP *m_dsp;
SCoreStartupParameter& m_params; SCoreStartupParameter * m_params;
CPluginManager(); CPluginManager();
~CPluginManager(); ~CPluginManager();
void GetPluginInfo(CPluginInfo *&info, std::string Filename); void GetPluginInfo(CPluginInfo *&info, std::string Filename);

View File

@ -12,7 +12,6 @@ files = ["ActionReplay.cpp",
"CoreRerecording.cpp", "CoreRerecording.cpp",
"CoreTiming.cpp", "CoreTiming.cpp",
"Host.cpp", "Host.cpp",
"LogManager.cpp",
"MemTools.cpp", "MemTools.cpp",
"PatchEngine.cpp", "PatchEngine.cpp",
"PluginManager.cpp", "PluginManager.cpp",

View File

@ -642,14 +642,6 @@
RelativePath=".\src\JitWindow.h" RelativePath=".\src\JitWindow.h"
> >
</File> </File>
<File
RelativePath=".\src\LogWindow.cpp"
>
</File>
<File
RelativePath=".\src\LogWindow.h"
>
</File>
<File <File
RelativePath=".\src\MemoryCheckDlg.cpp" RelativePath=".\src\MemoryCheckDlg.cpp"
> >

View File

@ -37,7 +37,6 @@
#include "Debugger.h" #include "Debugger.h"
#include "RegisterWindow.h" #include "RegisterWindow.h"
#include "LogWindow.h"
#include "BreakpointWindow.h" #include "BreakpointWindow.h"
#include "MemoryWindow.h" #include "MemoryWindow.h"
#include "JitWindow.h" #include "JitWindow.h"
@ -121,8 +120,7 @@ BEGIN_EVENT_TABLE(CCodeWindow, wxFrame)
EVT_MENU(IDM_JITPOFF, CCodeWindow::OnCPUMode) EVT_MENU(IDM_JITPOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITSROFF, CCodeWindow::OnCPUMode) EVT_MENU(IDM_JITSROFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_LOGWINDOW, CCodeWindow::OnToggleLogWindow) // Views EVT_MENU(IDM_REGISTERWINDOW, CCodeWindow::OnToggleRegisterWindow) //views
EVT_MENU(IDM_REGISTERWINDOW, CCodeWindow::OnToggleRegisterWindow)
EVT_MENU(IDM_BREAKPOINTWINDOW, CCodeWindow::OnToggleBreakPointWindow) EVT_MENU(IDM_BREAKPOINTWINDOW, CCodeWindow::OnToggleBreakPointWindow)
EVT_MENU(IDM_MEMORYWINDOW, CCodeWindow::OnToggleMemoryWindow) EVT_MENU(IDM_MEMORYWINDOW, CCodeWindow::OnToggleMemoryWindow)
EVT_MENU(IDM_JITWINDOW, CCodeWindow::OnToggleJitWindow) 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 /* Remember to initialize potential new controls with NULL there, otherwise m_dialog = true and
things may crash */ things may crash */
, m_LogWindow(NULL)
, m_RegisterWindow(NULL) , m_RegisterWindow(NULL)
, m_BreakpointWindow(NULL) , m_BreakpointWindow(NULL)
, m_MemoryWindow(NULL) , m_MemoryWindow(NULL)
@ -208,7 +205,6 @@ CCodeWindow::~CCodeWindow()
this->Save(file); this->Save(file);
if (m_BreakpointWindow) m_BreakpointWindow->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_RegisterWindow) m_RegisterWindow->Save(file);
if (m_MemoryWindow) m_MemoryWindow->Save(file); if (m_MemoryWindow) m_MemoryWindow->Save(file);
if (m_JitWindow) m_JitWindow->Save(file); if (m_JitWindow) m_JitWindow->Save(file);
@ -236,7 +232,7 @@ void CCodeWindow::OnHostMessage(wxCommandEvent& event)
NotifyMapLoaded(); NotifyMapLoaded();
break; break;
case IDM_UPDATELOGDISPLAY: /* case IDM_UPDATELOGDISPLAY:
if (m_LogWindow) if (m_LogWindow)
{ {
@ -244,7 +240,7 @@ void CCodeWindow::OnHostMessage(wxCommandEvent& event)
} }
break; break;
*/
case IDM_UPDATEDISASMDIALOG: case IDM_UPDATEDISASMDIALOG:
Update(); Update();
@ -295,7 +291,6 @@ void CCodeWindow::Load_( IniFile &ini )
DebuggerFont.SetNativeFontInfoUserDesc(wxString(fontDesc.c_str(), wxConvUTF8)); DebuggerFont.SetNativeFontInfoUserDesc(wxString(fontDesc.c_str(), wxConvUTF8));
// Decide what windows to use // Decide what windows to use
ini.Get("ShowOnStart", "LogWindow", &bLogWindow, true);
ini.Get("ShowOnStart", "RegisterWindow", &bRegisterWindow, true); ini.Get("ShowOnStart", "RegisterWindow", &bRegisterWindow, true);
ini.Get("ShowOnStart", "BreakpointWindow", &bBreakpointWindow, true); ini.Get("ShowOnStart", "BreakpointWindow", &bBreakpointWindow, true);
ini.Get("ShowOnStart", "MemoryWindow", &bMemoryWindow, 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", "w", &w, GetSize().GetWidth());
ini.Get("CodeWindow", "h", &h, GetSize().GetHeight()); ini.Get("CodeWindow", "h", &h, GetSize().GetHeight());
this->SetSize(x, y, w, h); 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", "y", GetPosition().y);
ini.Set("CodeWindow", "w", GetSize().GetWidth()); ini.Set("CodeWindow", "w", GetSize().GetWidth());
ini.Set("CodeWindow", "h", GetSize().GetHeight()); 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())); 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)); ini.Set("ShowOnStart", "BootToPause", GetMenuBar()->IsChecked(IDM_BOOTTOPAUSE));
// Save windows settings // Save windows settings
ini.Set("ShowOnStart", "LogWindow", GetMenuBar()->IsChecked(IDM_LOGWINDOW));
ini.Set("ShowOnStart", "RegisterWindow", GetMenuBar()->IsChecked(IDM_REGISTERWINDOW)); ini.Set("ShowOnStart", "RegisterWindow", GetMenuBar()->IsChecked(IDM_REGISTERWINDOW));
ini.Set("ShowOnStart", "BreakpointWindow", GetMenuBar()->IsChecked(IDM_BREAKPOINTWINDOW)); ini.Set("ShowOnStart", "BreakpointWindow", GetMenuBar()->IsChecked(IDM_BREAKPOINTWINDOW));
ini.Set("ShowOnStart", "MemoryWindow", GetMenuBar()->IsChecked(IDM_MEMORYWINDOW)); 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) if (bRegisterWindow)
{ {
m_RegisterWindow = new CRegisterWindow(this); m_RegisterWindow = new CRegisterWindow(this);
@ -504,12 +498,6 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam
// --------------- // ---------------
wxMenu* pDebugDialogs = new wxMenu; 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); wxMenuItem* pRegister = pDebugDialogs->Append(IDM_REGISTERWINDOW, _T("&Registers"), wxEmptyString, wxITEM_CHECK);
pRegister->Check(bRegisterWindow); pRegister->Check(bRegisterWindow);

View File

@ -27,7 +27,6 @@
#include "CoreParameter.h" #include "CoreParameter.h"
class CRegisterWindow; class CRegisterWindow;
class CLogWindow;
class CBreakPointWindow; class CBreakPointWindow;
class CMemoryWindow; class CMemoryWindow;
class CJitWindow; class CJitWindow;
@ -146,7 +145,6 @@ class CCodeWindow
// Settings // Settings
bool bAutomaticStart; bool bBootToPause; bool bAutomaticStart; bool bBootToPause;
bool bLogWindow;
bool bRegisterWindow; bool bRegisterWindow;
bool bBreakpointWindow; bool bBreakpointWindow;
bool bMemoryWindow; bool bMemoryWindow;
@ -156,7 +154,6 @@ class CCodeWindow
// Sub dialogs // Sub dialogs
wxMenuBar* pMenuBar; wxMenuBar* pMenuBar;
CLogWindow* m_LogWindow;
CRegisterWindow* m_RegisterWindow; CRegisterWindow* m_RegisterWindow;
CBreakPointWindow* m_BreakpointWindow; CBreakPointWindow* m_BreakpointWindow;
CMemoryWindow* m_MemoryWindow; CMemoryWindow* m_MemoryWindow;
@ -195,7 +192,6 @@ class CCodeWindow
void OnToggleRegisterWindow(wxCommandEvent& event); void OnToggleRegisterWindow(wxCommandEvent& event);
void OnToggleBreakPointWindow(wxCommandEvent& event); void OnToggleBreakPointWindow(wxCommandEvent& event);
void OnToggleLogWindow(wxCommandEvent& event);
void OnToggleMemoryWindow(wxCommandEvent& event); void OnToggleMemoryWindow(wxCommandEvent& event);
void OnToggleJitWindow(wxCommandEvent& event); void OnToggleJitWindow(wxCommandEvent& event);
void OnToggleSoundWindow(wxCommandEvent& event); void OnToggleSoundWindow(wxCommandEvent& event);

View File

@ -41,7 +41,6 @@
#include "Debugger.h" #include "Debugger.h"
#include "RegisterWindow.h" #include "RegisterWindow.h"
#include "LogWindow.h"
#include "BreakpointWindow.h" #include "BreakpointWindow.h"
#include "MemoryWindow.h" #include "MemoryWindow.h"
#include "JitWindow.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) void CCodeWindow::OnToggleRegisterWindow(wxCommandEvent& event)
{ {
bool show = GetMenuBar()->IsChecked(event.GetId()); bool show = GetMenuBar()->IsChecked(event.GetId());

View File

@ -18,17 +18,6 @@
#ifndef _DEBUGGER_H #ifndef _DEBUGGER_H
#define _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 wxUSE_XPM_IN_MSW 1
#define USE_XPM_BITMAPS 1 #define USE_XPM_BITMAPS 1

View File

@ -29,7 +29,6 @@
#include "CoreParameter.h" #include "CoreParameter.h"
class CRegisterWindow; class CRegisterWindow;
class CLogWindow;
class CBreakPointWindow; class CBreakPointWindow;
class CMemoryWindow class CMemoryWindow

View File

@ -5,7 +5,7 @@ Import('env')
if not env['HAVE_WX']: if not env['HAVE_WX']:
Return() Return()
files = ["LogWindow.cpp", files = [
"BreakPointDlg.cpp", "BreakPointDlg.cpp",
"BreakpointView.cpp", "BreakpointView.cpp",
"CodeView.cpp", "CodeView.cpp",

View File

@ -1051,6 +1051,14 @@
RelativePath=".\Src\FrameWiimote.cpp" RelativePath=".\Src\FrameWiimote.cpp"
> >
</File> </File>
<File
RelativePath=".\src\LogWindow.cpp"
>
</File>
<File
RelativePath=".\src\LogWindow.h"
>
</File>
<File <File
RelativePath=".\src\GameListCtrl.cpp" RelativePath=".\src\GameListCtrl.cpp"
> >

View File

@ -21,7 +21,6 @@
#include "Core.h" // Core #include "Core.h" // Core
#include "HW/EXI.h" #include "HW/EXI.h"
#include "HW/SI.h" #include "HW/SI.h"
#include "ConsoleWindow.h"
#include "Globals.h" // Local #include "Globals.h" // Local
#include "ConfigMain.h" #include "ConfigMain.h"
@ -875,7 +874,7 @@ void CConfigMain::OnConfig(wxCommandEvent& event)
void CConfigMain::CallConfig(wxChoice* _pChoice) void CConfigMain::CallConfig(wxChoice* _pChoice)
{ {
int Index = _pChoice->GetSelection(); int Index = _pChoice->GetSelection();
Console::Print("CallConfig: %i\n", Index); INFO_LOG(CONSOLE, "CallConfig: %i\n", Index);
if (Index >= 0) if (Index >= 0)
{ {
@ -888,7 +887,7 @@ void CConfigMain::CallConfig(wxChoice* _pChoice)
void CConfigMain::FillChoiceBox(wxChoice* _pChoice, int _PluginType, const std::string& _SelectFilename) void CConfigMain::FillChoiceBox(wxChoice* _pChoice, int _PluginType, const std::string& _SelectFilename)
{ {
Console::Print("FillChoiceBox\n"); INFO_LOG(CONSOLE, "FillChoiceBox\n");
_pChoice->Clear(); _pChoice->Clear();
@ -924,7 +923,7 @@ bool CConfigMain::GetFilename(wxChoice* _pChoice, std::string& _rFilename)
{ {
const CPluginInfo* pInfo = static_cast<CPluginInfo*>(_pChoice->GetClientData(Index)); const CPluginInfo* pInfo = static_cast<CPluginInfo*>(_pChoice->GetClientData(Index));
_rFilename = pInfo->GetFilename(); _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); return(true);
} }

View File

@ -48,7 +48,6 @@ be accessed from Core::GetWindowHandle().
#include "FileUtil.h" #include "FileUtil.h"
#include "Timer.h" #include "Timer.h"
#include "Setup.h" #include "Setup.h"
#include "ConsoleWindow.h"
#include "ConfigManager.h" // Core #include "ConfigManager.h" // Core
#include "Core.h" #include "Core.h"
@ -190,7 +189,7 @@ int abc = 0;
case WIIMOTE_RECONNECT: case WIIMOTE_RECONNECT:
// The Wiimote plugin has been shut down, now reconnect the Wiimote // The Wiimote plugin has been shut down, now reconnect the Wiimote
//Console::Print("WIIMOTE_RECONNECT\n"); //INFO_LOG(CONSOLE, "WIIMOTE_RECONNECT\n");
Core::ReconnectWiimote(); Core::ReconnectWiimote();
return 0; return 0;
@ -210,7 +209,7 @@ int abc = 0;
case OPENGL_VIDEO_STOP: case OPENGL_VIDEO_STOP:
// The Video thread has been shut down // The Video thread has been shut down
Core::VideoThreadEnd(); Core::VideoThreadEnd();
//Console::Print("OPENGL_VIDEO_STOP\n"); //INFO_LOG(CONSOLE, "OPENGL_VIDEO_STOP\n");
return 0; return 0;
#endif #endif
// ----------------------------- // -----------------------------
@ -273,6 +272,7 @@ EVT_MENU(IDM_TOGGLE_FULLSCREEN, CFrame::OnToggleFullscreen)
EVT_MENU(IDM_TOGGLE_DUALCORE, CFrame::OnToggleDualCore) EVT_MENU(IDM_TOGGLE_DUALCORE, CFrame::OnToggleDualCore)
EVT_MENU(IDM_TOGGLE_SKIPIDLE, CFrame::OnToggleSkipIdle) EVT_MENU(IDM_TOGGLE_SKIPIDLE, CFrame::OnToggleSkipIdle)
EVT_MENU(IDM_TOGGLE_TOOLBAR, CFrame::OnToggleToolbar) EVT_MENU(IDM_TOGGLE_TOOLBAR, CFrame::OnToggleToolbar)
EVT_MENU(IDM_TOGGLE_LOGWINDOW, CFrame::OnToggleLogWindow)
EVT_MENU(IDM_TOGGLE_STATUSBAR, CFrame::OnToggleStatusbar) EVT_MENU(IDM_TOGGLE_STATUSBAR, CFrame::OnToggleStatusbar)
EVT_MENU_RANGE(IDM_LOADSLOT1, IDM_LOADSLOT10, CFrame::OnLoadState) EVT_MENU_RANGE(IDM_LOADSLOT1, IDM_LOADSLOT10, CFrame::OnLoadState)
@ -293,13 +293,15 @@ END_EVENT_TABLE()
// Creation and close, quit functions // Creation and close, quit functions
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
CFrame::CFrame(wxFrame* parent, CFrame::CFrame(bool showLogWindow,
wxFrame* parent,
wxWindowID id, wxWindowID id,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxPoint& pos,
const wxSize& size, const wxSize& size,
long style) long style)
: wxFrame(parent, id, title, pos, size, style) : wxFrame(parent, id, title, pos, size, style)
, m_bLogWindow(showLogWindow || SConfig::GetInstance().m_InterfaceLogWindow)
, m_pStatusBar(NULL), bRenderToMain(true) , m_pStatusBar(NULL), bRenderToMain(true)
, HaveLeds(false), HaveSpeakers(false) , HaveLeds(false), HaveSpeakers(false)
, m_Panel(NULL) , m_Panel(NULL)
@ -326,6 +328,8 @@ CFrame::CFrame(wxFrame* parent,
// Give it a status bar // Give it a status bar
m_pStatusBar = CreateStatusBar(1, wxST_SIZEGRIP, ID_STATUSBAR); m_pStatusBar = CreateStatusBar(1, wxST_SIZEGRIP, ID_STATUSBAR);
if (!SConfig::GetInstance().m_InterfaceStatusbar)
m_pStatusBar->Hide();
// Give it a menu bar // Give it a menu bar
CreateMenu(); CreateMenu();
@ -334,6 +338,10 @@ CFrame::CFrame(wxFrame* parent,
//m_Panel = new wxPanel(this, IDM_MPANEL); //m_Panel = new wxPanel(this, IDM_MPANEL);
m_Panel = new CPanel(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, m_GameListCtrl = new CGameListCtrl(m_Panel, LIST_CTRL,
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT); wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT);
@ -348,6 +356,8 @@ CFrame::CFrame(wxFrame* parent,
// Create the toolbar // Create the toolbar
RecreateToolbar(); RecreateToolbar();
if (!SConfig::GetInstance().m_InterfaceToolbar)
TheToolBar->Hide();
FitInside(); FitInside();

View File

@ -27,6 +27,7 @@
#include <wx/mstream.h> #include <wx/mstream.h>
//////////////////////////////// ////////////////////////////////
#include "CDUtils.h" #include "CDUtils.h"
#include "LogWindow.h"
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// A shortcut to access the bitmaps // A shortcut to access the bitmaps
@ -48,7 +49,8 @@ class CFrame : public wxFrame
{ {
public: public:
CFrame(wxFrame* parent, CFrame(bool showLogWindow,
wxFrame* parent,
wxWindowID id = wxID_ANY, wxWindowID id = wxID_ANY,
const wxString& title = wxT("Dolphin"), const wxString& title = wxT("Dolphin"),
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
@ -98,6 +100,8 @@ class CFrame : public wxFrame
wxPanel* m_Panel; wxPanel* m_Panel;
wxToolBar* TheToolBar; wxToolBar* TheToolBar;
wxToolBarToolBase* m_ToolPlay; wxToolBarToolBase* m_ToolPlay;
bool m_bLogWindow;
CLogWindow* m_LogWindow;
char **drives; char **drives;
@ -199,6 +203,7 @@ class CFrame : public wxFrame
void OnToggleThrottle(wxCommandEvent& event); void OnToggleThrottle(wxCommandEvent& event);
void OnResize(wxSizeEvent& event); void OnResize(wxSizeEvent& event);
void OnToggleToolbar(wxCommandEvent& event); void OnToggleToolbar(wxCommandEvent& event);
void OnToggleLogWindow(wxCommandEvent& event);
void OnToggleStatusbar(wxCommandEvent& event); void OnToggleStatusbar(wxCommandEvent& event);
void OnKeyDown(wxKeyEvent& event); void OnKeyUp(wxKeyEvent& event); void OnKeyDown(wxKeyEvent& event); void OnKeyUp(wxKeyEvent& event);
void OnDoubleClick(wxMouseEvent& event); void OnMotion(wxMouseEvent& event); void OnDoubleClick(wxMouseEvent& event); void OnMotion(wxMouseEvent& event);

View File

@ -44,11 +44,11 @@ be accessed from Core::GetWindowHandle().
#include "GameListCtrl.h" #include "GameListCtrl.h"
#include "BootManager.h" #include "BootManager.h"
#include "SDCardWindow.h" #include "SDCardWindow.h"
#include "LogWindow.h"
#include "Common.h" // Common #include "Common.h" // Common
#include "FileUtil.h" #include "FileUtil.h"
#include "Timer.h" #include "Timer.h"
#include "ConsoleWindow.h"
#include "Setup.h" #include "Setup.h"
#include "ConfigManager.h" // Core #include "ConfigManager.h" // Core
@ -153,9 +153,11 @@ void CFrame::CreateMenu()
// Tools menu // Tools menu
wxMenu* toolsMenu = new wxMenu; wxMenu* toolsMenu = new wxMenu;
toolsMenu->AppendCheckItem(IDM_TOGGLE_TOOLBAR, _T("View &Toolbar")); 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->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->AppendSeparator();
toolsMenu->Append(IDM_MEMCARD, _T("&Memcard Manager")); toolsMenu->Append(IDM_MEMCARD, _T("&Memcard Manager"));
toolsMenu->Append(IDM_CHEATS, _T("Action &Replay Manager")); toolsMenu->Append(IDM_CHEATS, _T("Action &Replay Manager"));
@ -350,7 +352,8 @@ void CFrame::InitBitmaps()
////////////////////////// //////////////////////////
// Update in case the bitmap has been updated // 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(); wxToolBarBase* toolBar = GetToolBar();
if (event.IsChecked()) if (SConfig::GetInstance().m_InterfaceToolbar = event.IsChecked() == true)
{ {
CFrame::RecreateToolbar(); CFrame::RecreateToolbar();
} }
@ -749,7 +752,7 @@ void CFrame::OnToggleToolbar(wxCommandEvent& event)
// Let us enable and disable the status bar // Let us enable and disable the status bar
void CFrame::OnToggleStatusbar(wxCommandEvent& event) void CFrame::OnToggleStatusbar(wxCommandEvent& event)
{ {
if (event.IsChecked()) if (SConfig::GetInstance().m_InterfaceStatusbar = event.IsChecked() == true)
m_pStatusBar->Show(); m_pStatusBar->Show();
else else
m_pStatusBar->Hide(); m_pStatusBar->Hide();
@ -757,6 +760,17 @@ void CFrame::OnToggleStatusbar(wxCommandEvent& event)
this->SendSizeEvent(); 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 // Update the enabled/disabled status
void CFrame::UpdateGUI() void CFrame::UpdateGUI()
@ -815,7 +829,8 @@ void CFrame::UpdateGUI()
m_pMenuItemPlay->SetText(_("&Play")); m_pMenuItemPlay->SetText(_("&Play"));
} }
if (GetToolBar() != NULL) GetToolBar()->Realize(); if (GetToolBar() != NULL)
GetToolBar()->Realize();
if (!initialized) if (!initialized)

View File

@ -23,7 +23,6 @@
#include "Frame.h" #include "Frame.h"
#include "FileUtil.h" #include "FileUtil.h"
#include "StringUtil.h" #include "StringUtil.h"
#include "ConsoleWindow.h"
#include "GameListCtrl.h" #include "GameListCtrl.h"
#include "BootManager.h" #include "BootManager.h"
@ -414,7 +413,7 @@ void CFrame::DoMoveIcons()
for (int i = 0; i < 4; i++) m_StatBmp[i]->Hide(); for (int i = 0; i < 4; i++) m_StatBmp[i]->Hide();
else // if(!m_StatBmp[0]->IsShown()) else // if(!m_StatBmp[0]->IsShown())
for (int i = 0; i < 4; i++) m_StatBmp[i]->Show(); 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 // 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(); for(int i = 0; i < 3; i++) m_StatBmp[i + 4]->Hide();
else // if(!m_StatBmp[4]->IsShown()) else // if(!m_StatBmp[4]->IsShown())
for (int i = 0; i < 3; i++) m_StatBmp[i + 4]->Show(); 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());
} }
} }

View File

@ -183,7 +183,7 @@ void CGameListCtrl::Update()
SetColumnWidth(COLUMN_COMPANY, 100); SetColumnWidth(COLUMN_COMPANY, 100);
SetColumnWidth(COLUMN_NOTES, 150); SetColumnWidth(COLUMN_NOTES, 150);
SetColumnWidth(COLUMN_COUNTRY, 32); SetColumnWidth(COLUMN_COUNTRY, 32);
SetColumnWidth(COLUMN_EMULATION_STATE, 150); SetColumnWidth(COLUMN_EMULATION_STATE, 130);
// add all items // add all items
for (int i = 0; i < (int)m_ISOFiles.size(); i++) for (int i = 0; i < (int)m_ISOFiles.size(); i++)
@ -883,10 +883,15 @@ void CGameListCtrl::AutomaticColumnWidth()
} }
else if (GetColumnCount() > 4) 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_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)); SetColumnWidth(COLUMN_NOTES, wxMax(0.5*resizable, 100));
} }
} }

View File

@ -85,6 +85,7 @@ enum
IDM_TOGGLE_DUALCORE, // Other IDM_TOGGLE_DUALCORE, // Other
IDM_TOGGLE_SKIPIDLE, IDM_TOGGLE_SKIPIDLE,
IDM_TOGGLE_TOOLBAR, IDM_TOGGLE_TOOLBAR,
IDM_TOGGLE_LOGWINDOW,
IDM_TOGGLE_STATUSBAR, IDM_TOGGLE_STATUSBAR,
IDM_NOTIFYMAPLOADED, IDM_NOTIFYMAPLOADED,
IDM_OPENCONTAININGFOLDER, IDM_OPENCONTAININGFOLDER,

View 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));
}

View 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_*/

View File

@ -35,10 +35,10 @@
#include "CPUDetect.h" #include "CPUDetect.h"
#include "IniFile.h" #include "IniFile.h"
#include "FileUtil.h" #include "FileUtil.h"
#include "ConsoleWindow.h"
#include "Setup.h" #include "Setup.h"
#include "Host.h" // Core #include "Host.h" // Core
#include "PluginManager.h"
#include "Globals.h" // Local #include "Globals.h" // Local
#include "Main.h" #include "Main.h"
@ -62,6 +62,7 @@ IMPLEMENT_APP(DolphinApp)
CFrame* main_frame = NULL; CFrame* main_frame = NULL;
CCodeWindow* g_pCodeWindow = NULL; CCodeWindow* g_pCodeWindow = NULL;
LogManager *logManager = NULL;
#ifdef WIN32 #ifdef WIN32
//Has no error handling. //Has no error handling.
@ -100,6 +101,7 @@ bool DolphinApp::OnInit()
{ {
//Console::Open(); //Console::Open();
NOTICE_LOG(BOOT, "Starting application");
// Declarations and definitions // Declarations and definitions
bool UseDebugger = false; bool UseDebugger = false;
bool UseLogger = false; bool UseLogger = false;
@ -232,10 +234,7 @@ bool DolphinApp::OnInit()
const char *title = "Dolphin SVN R " SVN_REV_STR; const char *title = "Dolphin SVN R " SVN_REV_STR;
#endif #endif
// ---------------------------------------------------------------------------------------
// If we are debugging let use save the main window position and size // If we are debugging let use save the main window position and size
// TODO: Save position and size on exit
// ------------
IniFile ini; IniFile ini;
ini.Load(DEBUGGER_CONFIG_FILE); ini.Load(DEBUGGER_CONFIG_FILE);
@ -245,19 +244,17 @@ bool DolphinApp::OnInit()
ini.Get("MainWindow", "y", &y, 100); ini.Get("MainWindow", "y", &y, 100);
ini.Get("MainWindow", "w", &w, 800); ini.Get("MainWindow", "w", &w, 800);
ini.Get("MainWindow", "h", &h, 600); ini.Get("MainWindow", "h", &h, 600);
// -------------------
if (UseDebugger) 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)); wxPoint(x, y), wxSize(w, h));
} }
else else
{ {
main_frame = new CFrame((wxFrame*) NULL, wxID_ANY, wxString::FromAscii(title), main_frame = new CFrame(UseLogger, (wxFrame*) NULL, wxID_ANY, wxString::FromAscii(title),
wxPoint(100, 100), wxSize(w, h)); wxPoint(100, 100), wxSize(800, 600));
} }
// ------------------
// Create debugging window // Create debugging window
if (UseDebugger) if (UseDebugger)
@ -265,16 +262,6 @@ bool DolphinApp::OnInit()
g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, main_frame); g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, main_frame);
g_pCodeWindow->Show(true); 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. // Check the autoboot options.

View File

@ -26,11 +26,7 @@
#include "BootManager.h" #include "BootManager.h"
void* g_pCodeWindow = NULL; void* g_pCodeWindow = NULL;
void* main_frame = NULL; void* main_frame = NULL;
bool wxPanicAlert(const char* text, bool /*yes_no*/) LogManager *logManager = NULL;
{
return(true);
}
// OK, this thread boundary is DANGEROUS on linux // OK, this thread boundary is DANGEROUS on linux
// wxPostEvent / wxAddPendingEvent is the solution. // wxPostEvent / wxAddPendingEvent is the solution.
@ -195,6 +191,7 @@ int main(int argc, char* argv[])
return(1); return(1);
} }
std::string bootFile(args_info.inputs[0]); std::string bootFile(args_info.inputs[0]);
logManager = (LogManager *)CPluginManager::GetInstance().GetGlobals()->logManager;
updateMainFrameEvent.Init(); updateMainFrameEvent.Init();
cpu_info.Detect(); cpu_info.Detect();

View File

@ -7,7 +7,6 @@ wxenv = env.Clone()
files = [ files = [
'BootManager.cpp', 'BootManager.cpp',
# 'Config.cpp',
'cmdline.c', 'cmdline.c',
] ]
@ -22,6 +21,7 @@ if wxenv['HAVE_WX']:
'ARCodeAddEdit.cpp', 'ARCodeAddEdit.cpp',
'ConfigMain.cpp', 'ConfigMain.cpp',
'Frame.cpp', 'Frame.cpp',
'LogWindow.cpp',
'FrameTools.cpp', 'FrameTools.cpp',
'GameListCtrl.cpp', 'GameListCtrl.cpp',
'Globals.cpp', 'Globals.cpp',
@ -29,7 +29,6 @@ if wxenv['HAVE_WX']:
'ISOProperties.cpp', 'ISOProperties.cpp',
'MemcardManager.cpp', 'MemcardManager.cpp',
'MemoryCards/GCMemcard.cpp', 'MemoryCards/GCMemcard.cpp',
# 'PluginManager.cpp',
'PatchAddEdit.cpp', 'PatchAddEdit.cpp',
'CheatsWindow.cpp', 'CheatsWindow.cpp',
'stdafx.cpp', 'stdafx.cpp',

View File

@ -201,9 +201,9 @@ void GetJoyState(CONTROLLER_STATE &_PadState, CONTROLLER_MAPPING _PadMapping, in
#ifdef SHOW_PAD_STATUS #ifdef SHOW_PAD_STATUS
// Show the status of all connected pads // 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; g_LastPad = Controller;
Console::Print( DEBUG_LOG(CONSOLE,
"Pad | Number:%i Enabled:%i Handle:%i\n" "Pad | Number:%i Enabled:%i Handle:%i\n"
"Main Stick | X:%03i Y:%03i\n" "Main Stick | X:%03i Y:%03i\n"
"C Stick | X:%03i Y:%03i\n" "C Stick | X:%03i Y:%03i\n"

View File

@ -45,7 +45,6 @@
#endif #endif
#include "Common.h" // Common #include "Common.h" // Common
#include "ConsoleWindow.h"
//////////////////////////// ////////////////////////////

View File

@ -24,7 +24,6 @@
#include "MemoryUtil.h" #include "MemoryUtil.h"
#include "Thread.h" #include "Thread.h"
#include "OpcodeDecoding.h" #include "OpcodeDecoding.h"
#include "ConsoleWindow.h"
#include "Fifo.h" #include "Fifo.h"

View File

@ -65,12 +65,10 @@ int TexDecoder_GetTextureSizeInBytes(int width, int height, int format)
u32 TexDecoder_GetTlutHash(const u8* src, int len) 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);} //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; u32 hash = 0xbeefbabe;
for (int i = 0; i < len / 4; i ++) { for (int i = 0; i < len / 4; i ++) {
hash = _rotl(hash, 7) ^ ((u32 *)src)[i]; hash = _rotl(hash, 7) ^ ((u32 *)src)[i];
hash += 7; // to add a bit more entropy/mess in here hash += 7; // to add a bit more entropy/mess in here
//DebugLog("%02i | hash: %08x | src: %08x", i, hash, ((u32 *)src)[i]);
} }
return hash; return hash;
} }

View File

@ -49,8 +49,6 @@ extern SVideoInitialize g_VideoInitialize;
// (mb2) for XFB update hack. TODO: find a static better place // (mb2) for XFB update hack. TODO: find a static better place
extern volatile u32 g_XFBUpdateRequested; extern volatile u32 g_XFBUpdateRequested;
void DebugLog(const char* _fmt, ...);
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
inline u8 *Memory_GetPtr(u32 _uAddress) inline u8 *Memory_GetPtr(u32 _uAddress)
{ {
@ -140,7 +138,6 @@ struct TRectangle
// Logging // Logging
// ¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯
void DebugLog(const char *_fmt, ...); // This one goes to the main program
void HandleGLError(); void HandleGLError();

View File

@ -667,10 +667,6 @@
RelativePath=".\Src\VideoCommon.h" RelativePath=".\Src\VideoCommon.h"
> >
</File> </File>
<File
RelativePath=".\Src\VideoLog.cpp"
>
</File>
</Files> </Files>
<Globals> <Globals>
</Globals> </Globals>

View File

@ -98,7 +98,7 @@ typedef struct
{ {
void *eventHandler; void *eventHandler;
void *config; void *config;
void *messageLogger; void *logManager;
} PLUGIN_GLOBALS; } PLUGIN_GLOBALS;
/////////////////////////////// ///////////////////////////////

View File

@ -69,7 +69,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib Rpcrt4.lib comctl32.lib" AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib rpcrt4.lib comctl32.lib winmm.lib"
OutputFile="../../../Binary/Win32/Plugins/Plugin_DSP_HLED.dll" OutputFile="../../../Binary/Win32/Plugins/Plugin_DSP_HLED.dll"
LinkIncremental="2" LinkIncremental="2"
GenerateManifest="false" GenerateManifest="false"
@ -154,7 +154,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib Rpcrt4.lib comctl32.lib" AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib rpcrt4.lib comctl32.lib winmm.lib"
OutputFile="../../../Binary/x64/Plugins/Plugin_DSP_HLED.dll" OutputFile="../../../Binary/x64/Plugins/Plugin_DSP_HLED.dll"
LinkIncremental="2" LinkIncremental="2"
GenerateManifest="false" GenerateManifest="false"
@ -242,7 +242,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib comctl32.lib" AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib comctl32.lib winmm.lib"
OutputFile="../../../Binary/Win32/Plugins/Plugin_DSP_HLE.dll" OutputFile="../../../Binary/Win32/Plugins/Plugin_DSP_HLE.dll"
LinkIncremental="1" LinkIncremental="1"
GenerateManifest="false" GenerateManifest="false"
@ -331,7 +331,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib comctl32.lib" AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib comctl32.lib winmm.lib"
OutputFile="../../../Binary/x64/Plugins/Plugin_DSP_HLE.dll" OutputFile="../../../Binary/x64/Plugins/Plugin_DSP_HLE.dll"
LinkIncremental="1" LinkIncremental="1"
GenerateManifest="false" GenerateManifest="false"
@ -420,7 +420,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib comctl32.lib" AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib comctl32.lib winmm.lib"
OutputFile="../../../Binary/Win32/Plugins/Plugin_DSP_HLEDF.dll" OutputFile="../../../Binary/Win32/Plugins/Plugin_DSP_HLEDF.dll"
LinkIncremental="1" LinkIncremental="1"
GenerateManifest="false" GenerateManifest="false"
@ -509,7 +509,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib comctl32.lib" AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib comctl32.lib winmm.lib"
OutputFile="../../../Binary/x64/Plugins/Plugin_DSP_HLEDF.dll" OutputFile="../../../Binary/x64/Plugins/Plugin_DSP_HLEDF.dll"
LinkIncremental="1" LinkIncremental="1"
GenerateManifest="false" GenerateManifest="false"

View File

@ -31,8 +31,6 @@
#include <stdlib.h> #include <stdlib.h>
#endif #endif
#include "ConsoleWindow.h" // Open and close console
#include "Debugger.h" #include "Debugger.h"
#include "PBView.h" #include "PBView.h"
#include "IniFile.h" #include "IniFile.h"
@ -61,7 +59,7 @@ void CDebugger::DoScrollBlocks()
else if(GetAsyncKeyState(VK_NUMPAD2)) else if(GetAsyncKeyState(VK_NUMPAD2))
A += 0.11; A += 0.11;
Console::Print("GetScrollPos:%i GetScrollRange:%i GetPosition:%i GetLastPosition:%i GetMaxWidth:%i \ DEBUG_LOG(CONSOLE, "GetScrollPos:%i GetScrollRange:%i GetPosition:%i GetLastPosition:%i GetMaxWidth:%i \
GetLineLength:%i XYToPosition:%i\n \ GetLineLength:%i XYToPosition:%i\n \
GetScrollPos * GetLineLength + GetScrollRange:%i A:%f\n", GetScrollPos * GetLineLength + GetScrollRange:%i A:%f\n",
m_bl95->GetScrollPos(wxVERTICAL), m_bl95->GetScrollRange(wxVERTICAL), m_bl95->GetScrollPos(wxVERTICAL), m_bl95->GetScrollRange(wxVERTICAL),

View File

@ -31,8 +31,6 @@
#include <stdlib.h> #include <stdlib.h>
#endif #endif
#include "ConsoleWindow.h" // Open and close console
#include "Debugger.h" #include "Debugger.h"
#include "PBView.h" #include "PBView.h"
#include "IniFile.h" #include "IniFile.h"
@ -165,17 +163,11 @@ void CDebugger::OnClose(wxCloseEvent& /*event*/)
file.Save(DEBUGGER_CONFIG_FILE); file.Save(DEBUGGER_CONFIG_FILE);
EndModal(0); EndModal(0);
#ifdef _WIN32
Console::Close(); // Take the console window with it
#endif
} }
void CDebugger::DoHide() void CDebugger::DoHide()
{ {
Hide(); Hide();
#ifdef _WIN32
Console::Close(); // The console goes with the wx window
#endif
} }
void CDebugger::DoShow() void CDebugger::DoShow()
@ -683,12 +675,13 @@ void CDebugger::ShowHideConsole(wxCommandEvent& event)
void CDebugger::DoShowHideConsole() void CDebugger::DoShowHideConsole()
{ {
#ifdef _WIN32 // #ifdef _WIN32
if(m_options->IsChecked(3)) // if(m_options->IsChecked(3))
OpenConsole(); // OpenConsole();
else // else
CloseConsole(); // CloseConsole();
#endif // #endif
PanicAlert("oh crap");
} }
// ============== // ==============

View File

@ -33,7 +33,6 @@
#endif #endif
#include "StringUtil.h" // Common #include "StringUtil.h" // Common
#include "ConsoleWindow.h" // Open, close, clear console window
#include "../Debugger/Debugger.h" // Local #include "../Debugger/Debugger.h" // Local
#include "../Debugger/PBView.h" #include "../Debugger/PBView.h"
@ -887,8 +886,8 @@ void Logging_(short* _pBuffer, int _iSize, int a, bool Wii, ParamBlockType &PBs,
// ======================================================================================= // =======================================================================================
// Print // Print
// ---------------- // ----------------
Console::ClearScreen(); // FIXME: Console::ClearScreen();
Console::Print("%s", sbuff.c_str()); INFO_LOG(CONSOLE, "%s", sbuff.c_str());
sbuff.clear(); strcpy(buffer, ""); sbuff.clear(); strcpy(buffer, "");
// ================ // ================

View File

@ -21,40 +21,6 @@
#include "Globals.h" #include "Globals.h"
#include "Common.h" #include "Common.h"
void __Log(int, const char *fmt, ...)
{
DebugLog(fmt);
}
void __Log_(int v, const char *fmt, ...)
{
char Msg[512];
va_list ap;
va_start(ap, fmt);
vsprintf(Msg, fmt, ap);
va_end(ap);
g_dspInitialize.pLog(Msg, v);
}
void DebugLog(const char* _fmt, ...)
{
#if defined(_DEBUG) || defined(DEBUGFAST)
//if(strncmp (_fmt, "AX", 2)) // match = 0, in that case this is ignored
{
char Msg[512];
va_list ap;
va_start(ap, _fmt);
vsprintf(Msg, _fmt, ap);
va_end(ap);
g_dspInitialize.pLog(Msg, 0);
}
#endif
}
extern u8* g_pMemory; extern u8* g_pMemory;
// debugger externals that are needed even in Release builds // debugger externals that are needed even in Release builds

View File

@ -20,18 +20,9 @@
#include "Common.h" #include "Common.h"
#include "pluginspecs_dsp.h" #include "pluginspecs_dsp.h"
#include "ConsoleWindow.h"
#include "StringUtil.h" #include "StringUtil.h"
extern DSPInitialize g_dspInitialize; extern DSPInitialize g_dspInitialize;
void DebugLog(const char* _fmt, ...);
void __Log_(int v, const char *fmt, ...);
#if defined(_DEBUG) || defined(DEBUGFAST)
#define LOG_(v, ...) __Log_(v, __VA_ARGS__);
#else
#define LOG_(_v_, ...)
#endif
extern bool gSSBM; extern bool gSSBM;
extern bool gSSBMremedy1; extern bool gSSBMremedy1;

View File

@ -20,7 +20,6 @@
#include <queue> // System #include <queue> // System
#include "Thread.h" // Common #include "Thread.h" // Common
#include "ConsoleWindow.h"
#include "../Config.h" // Local #include "../Config.h" // Local
#include "../Globals.h" #include "../Globals.h"

View File

@ -147,7 +147,7 @@ if(m_frame->ScanMails)
#endif #endif
TmpMailLog += Msg; TmpMailLog += Msg;
TmpMailLog += "\n"; TmpMailLog += "\n";
LOG_(1, Msg); // also write it to the log DEBUG_LOG(DSPHLE, "%s", Msg); // also write it to the log
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
} }
} }
@ -415,11 +415,11 @@ void CUCode_AX::HandleMail(u32 _uMail)
if ((_uMail & 0xFFFF0000) == MAIL_AX_ALIST) if ((_uMail & 0xFFFF0000) == MAIL_AX_ALIST)
{ {
// a new List // a new List
DebugLog(" >>>> u32 MAIL : General Mail (%08x)", _uMail); DEBUG_LOG(DSPHLE, " >>>> u32 MAIL : General Mail (%08x)", _uMail);
} }
else else
{ {
DebugLog(" >>>> u32 MAIL : AXTask Mail (%08x)", _uMail); DEBUG_LOG(DSPHLE, " >>>> u32 MAIL : AXTask Mail (%08x)", _uMail);
AXTask(_uMail); AXTask(_uMail);
} }

View File

@ -178,7 +178,7 @@ void CUCode_AXWii::MixAdd_(short* _pBuffer, int _iSize, ParamBlockType &PBs)
&& gSequenced) // on and off option && gSequenced) // on and off option
{ {
//PanicAlert("Update %i: %i = %04x", i, updpar, upddata); //PanicAlert("Update %i: %i = %04x", i, updpar, upddata);
//DebugLog("Update: %i = %04x", updpar, upddata); //DEBUG_LOG(DSPHLE, "Update: %i = %04x", updpar, upddata);
pDest[updpar] = upddata; pDest[updpar] = upddata;
} }
if (updpar == 7 && upddata == 1) on++; if (updpar == 7 && upddata == 1) on++;
@ -364,7 +364,7 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
/* case 0x0009: /* case 0x0009:
Addr__9 = Memory_Read_U32(uAddress); Addr__9 = Memory_Read_U32(uAddress);
uAddress += 4; uAddress += 4;
DebugLog("AXLIST 6 address: %08x", Addr__9); DEBUG_LOG(DSPHLE, "AXLIST 6 address: %08x", Addr__9);
break;*/ break;*/
case 0x000a: // AXLIST_COMPRESSORTABLE case 0x000a: // AXLIST_COMPRESSORTABLE

View File

@ -24,7 +24,7 @@
CUCode_CARD::CUCode_CARD(CMailHandler& _rMailHandler) CUCode_CARD::CUCode_CARD(CMailHandler& _rMailHandler)
: IUCode(_rMailHandler) : IUCode(_rMailHandler)
{ {
DebugLog("CUCode_CARD - initialized"); DEBUG_LOG(DSPHLE, "CUCode_CARD - initialized");
m_rMailHandler.PushMail(DSP_INIT); m_rMailHandler.PushMail(DSP_INIT);
} }
@ -52,7 +52,7 @@ void CUCode_CARD::HandleMail(u32 _uMail)
} }
else else
{ {
DebugLog("CUCode_CARD - unknown cmd: %x (size %i)", _uMail); DEBUG_LOG(DSPHLE, "CUCode_CARD - unknown cmd: %x (size %i)", _uMail);
} }
m_rMailHandler.PushMail(DSP_DONE); m_rMailHandler.PushMail(DSP_DONE);

View File

@ -26,7 +26,7 @@ CUCode_InitAudioSystem::CUCode_InitAudioSystem(CMailHandler& _rMailHandler)
, m_NextParameter(0) , m_NextParameter(0)
, IsInitialized(false) , IsInitialized(false)
{ {
DebugLog("CUCode_InitAudioSystem - initialized"); DEBUG_LOG(DSPHLE, "CUCode_InitAudioSystem - initialized");
} }

View File

@ -24,7 +24,7 @@ CUCode_Jac::CUCode_Jac(CMailHandler& _rMailHandler)
: IUCode(_rMailHandler) : IUCode(_rMailHandler)
, m_bListInProgress(false) , m_bListInProgress(false)
{ {
DebugLog("CUCode_Jac: init"); DEBUG_LOG(DSPHLE, "CUCode_Jac: init");
m_rMailHandler.PushMail(0xDCD10000); m_rMailHandler.PushMail(0xDCD10000);
m_rMailHandler.PushMail(0x80000000); m_rMailHandler.PushMail(0x80000000);
} }
@ -69,7 +69,7 @@ void CUCode_Jac::HandleMail(u32 _uMail)
default: default:
PanicAlert("UCode Jac"); PanicAlert("UCode Jac");
DebugLog("UCode Jac - unknown cmd: %x", _uMail & 0xFFFF); DEBUG_LOG(DSPHLE, "UCode Jac - unknown cmd: %x", _uMail & 0xFFFF);
break; break;
} }
} }
@ -105,8 +105,8 @@ void CUCode_Jac::ExecuteList()
u16 cmd = Read16(); u16 cmd = Read16();
u16 sync = Read16(); u16 sync = Read16();
DebugLog("=============================================================================="); DEBUG_LOG(DSPHLE, "==============================================================================");
DebugLog("UCode Jac - execute dlist (cmd: 0x%04x : sync: 0x%04x)", cmd, sync); DEBUG_LOG(DSPHLE, "UCode Jac - execute dlist (cmd: 0x%04x : sync: 0x%04x)", cmd, sync);
switch (cmd) switch (cmd)
{ {
@ -121,11 +121,11 @@ void CUCode_Jac::ExecuteList()
tmp[2] = Read32(); tmp[2] = Read32();
tmp[3] = Read32(); tmp[3] = Read32();
DebugLog("DsetupTable"); DEBUG_LOG(DSPHLE, "DsetupTable");
DebugLog("???: 0x%08x", tmp[0]); DEBUG_LOG(DSPHLE, "???: 0x%08x", tmp[0]);
DebugLog("DSPRES_FILTER (size: 0x40): 0x%08x", tmp[1]); DEBUG_LOG(DSPHLE, "DSPRES_FILTER (size: 0x40): 0x%08x", tmp[1]);
DebugLog("DSPADPCM_FILTER (size: 0x500): 0x%08x", tmp[2]); DEBUG_LOG(DSPHLE, "DSPADPCM_FILTER (size: 0x500): 0x%08x", tmp[2]);
DebugLog("???: 0x%08x", tmp[3]); DEBUG_LOG(DSPHLE, "???: 0x%08x", tmp[3]);
} }
break; break;
@ -140,16 +140,16 @@ void CUCode_Jac::ExecuteList()
tmp[1] = Read32(); tmp[1] = Read32();
tmp[2] = Read32(); tmp[2] = Read32();
DebugLog("UpdateDSPChannel"); DEBUG_LOG(DSPHLE, "UpdateDSPChannel");
DebugLog("audiomemory: 0x%08x", tmp[0]); DEBUG_LOG(DSPHLE, "audiomemory: 0x%08x", tmp[0]);
DebugLog("audiomemory: 0x%08x", tmp[1]); DEBUG_LOG(DSPHLE, "audiomemory: 0x%08x", tmp[1]);
DebugLog("DSPADPCM_FILTER (size: 0x40): 0x%08x", tmp[2]); DEBUG_LOG(DSPHLE, "DSPADPCM_FILTER (size: 0x40): 0x%08x", tmp[2]);
} }
break; break;
default: default:
PanicAlert("UCode Jac unknown cmd: %s (size %i)", cmd, m_numSteps); PanicAlert("UCode Jac unknown cmd: %s (size %i)", cmd, m_numSteps);
DebugLog("Jac UCode - unknown cmd: %x (size %i)", cmd, m_numSteps); DEBUG_LOG(DSPHLE, "Jac UCode - unknown cmd: %x (size %i)", cmd, m_numSteps);
break; break;
} }

View File

@ -25,7 +25,7 @@ CUCode_Rom::CUCode_Rom(CMailHandler& _rMailHandler)
, m_BootTask_numSteps(0) , m_BootTask_numSteps(0)
, m_NextParameter(0) , m_NextParameter(0)
{ {
DebugLog("UCode_Rom - initialized"); DEBUG_LOG(DSPHLE, "UCode_Rom - initialized");
m_rMailHandler.Clear(); m_rMailHandler.Clear();
m_rMailHandler.PushMail(0x8071FEED); m_rMailHandler.PushMail(0x8071FEED);
} }
@ -98,13 +98,13 @@ void CUCode_Rom::BootUCode()
crc = (crc << 3) | (crc >> 29); crc = (crc << 3) | (crc >> 29);
} }
DebugLog("CurrentUCode SOURCE Addr: 0x%08x", m_CurrentUCode.m_RAMAddress); DEBUG_LOG(DSPHLE, "CurrentUCode SOURCE Addr: 0x%08x", m_CurrentUCode.m_RAMAddress);
DebugLog("CurrentUCode Length: 0x%08x", m_CurrentUCode.m_Length); DEBUG_LOG(DSPHLE, "CurrentUCode Length: 0x%08x", m_CurrentUCode.m_Length);
DebugLog("CurrentUCode DEST Addr: 0x%08x", m_CurrentUCode.m_IMEMAddress); DEBUG_LOG(DSPHLE, "CurrentUCode DEST Addr: 0x%08x", m_CurrentUCode.m_IMEMAddress);
DebugLog("CurrentUCode ???: 0x%08x", m_CurrentUCode.m_Unk); DEBUG_LOG(DSPHLE, "CurrentUCode ???: 0x%08x", m_CurrentUCode.m_Unk);
DebugLog("CurrentUCode init_vector: 0x%08x", m_CurrentUCode.m_StartPC); DEBUG_LOG(DSPHLE, "CurrentUCode init_vector: 0x%08x", m_CurrentUCode.m_StartPC);
DebugLog("CurrentUCode CRC: 0x%08x", crc); DEBUG_LOG(DSPHLE, "CurrentUCode CRC: 0x%08x", crc);
DebugLog("BootTask - done"); DEBUG_LOG(DSPHLE, "BootTask - done");
CDSPHandler::GetInstance().SetUCode(crc); CDSPHandler::GetInstance().SetUCode(crc);
} }

View File

@ -34,7 +34,7 @@ CUCode_Zelda::CUCode_Zelda(CMailHandler& _rMailHandler)
, m_step(0) , m_step(0)
, m_readOffset(0) , m_readOffset(0)
{ {
DebugLog("UCode_Zelda - add boot mails for handshake"); DEBUG_LOG(DSPHLE, "UCode_Zelda - add boot mails for handshake");
m_rMailHandler.PushMail(DSP_INIT); m_rMailHandler.PushMail(DSP_INIT);
m_rMailHandler.PushMail(0x80000000); // handshake m_rMailHandler.PushMail(0x80000000); // handshake
memset(m_Buffer, 0, sizeof(m_Buffer)); memset(m_Buffer, 0, sizeof(m_Buffer));
@ -126,8 +126,8 @@ void CUCode_Zelda::ExecuteList()
u32 Command = (Temp >> 24) & 0x7f; u32 Command = (Temp >> 24) & 0x7f;
u32 Sync = Temp >> 16; u32 Sync = Temp >> 16;
DebugLog("=============================================================================="); DEBUG_LOG(DSPHLE, "==============================================================================");
DebugLog("Zelda UCode - execute dlist (cmd: 0x%04x : sync: 0x%04x)", Command, Sync); DEBUG_LOG(DSPHLE, "Zelda UCode - execute dlist (cmd: 0x%04x : sync: 0x%04x)", Command, Sync);
switch (Command) switch (Command)
{ {
@ -140,11 +140,11 @@ void CUCode_Zelda::ExecuteList()
tmp[2] = Read32(); tmp[2] = Read32();
tmp[3] = Read32(); tmp[3] = Read32();
DebugLog("DsetupTable"); DEBUG_LOG(DSPHLE, "DsetupTable");
DebugLog("???: 0x%08x", tmp[0]); DEBUG_LOG(DSPHLE, "???: 0x%08x", tmp[0]);
DebugLog("DSPRES_FILTER (size: 0x40): 0x%08x", tmp[1]); DEBUG_LOG(DSPHLE, "DSPRES_FILTER (size: 0x40): 0x%08x", tmp[1]);
DebugLog("DSPADPCM_FILTER (size: 0x500): 0x%08x", tmp[2]); DEBUG_LOG(DSPHLE, "DSPADPCM_FILTER (size: 0x500): 0x%08x", tmp[2]);
DebugLog("???: 0x%08x", tmp[3]); DEBUG_LOG(DSPHLE, "???: 0x%08x", tmp[3]);
} }
break; break;
@ -159,14 +159,14 @@ void CUCode_Zelda::ExecuteList()
// We're ready to mix // We're ready to mix
mixer_HLEready = true; mixer_HLEready = true;
DebugLog("Update the SoundThread to be in sync"); DEBUG_LOG(DSPHLE, "Update the SoundThread to be in sync");
soundStream->Update(); //do it in this thread to avoid sync problems soundStream->Update(); //do it in this thread to avoid sync problems
DebugLog("DsyncFrame"); DEBUG_LOG(DSPHLE, "DsyncFrame");
DebugLog("???: 0x%08x", tmp[0]); DEBUG_LOG(DSPHLE, "???: 0x%08x", tmp[0]);
DebugLog("???: 0x%08x", tmp[1]); DEBUG_LOG(DSPHLE, "???: 0x%08x", tmp[1]);
DebugLog("DSPADPCM_FILTER (size: 0x500): 0x%08x", tmp[2]); DEBUG_LOG(DSPHLE, "DSPADPCM_FILTER (size: 0x500): 0x%08x", tmp[2]);
} }
break; break;
@ -188,9 +188,9 @@ void CUCode_Zelda::ExecuteList()
tmp[0] = Read32(); tmp[0] = Read32();
tmp[1] = Read32(); tmp[1] = Read32();
DebugLog("DSetDolbyDelay"); DEBUG_LOG(DSPHLE, "DSetDolbyDelay");
DebugLog("DOLBY2_DELAY_BUF (size 0x960): 0x%08x", tmp[0]); DEBUG_LOG(DSPHLE, "DOLBY2_DELAY_BUF (size 0x960): 0x%08x", tmp[0]);
DebugLog("DSPRES_FILTER (size 0x500): 0x%08x", tmp[1]); DEBUG_LOG(DSPHLE, "DSPRES_FILTER (size 0x500): 0x%08x", tmp[1]);
} }
break; break;

View File

@ -44,7 +44,7 @@ IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler)
case 0xd73338cf: // IPL case 0xd73338cf: // IPL
case 0x42f64ac4: // Luigi (after fix) case 0x42f64ac4: // Luigi (after fix)
case 0x4be6a5cb: // AC, Pikmin (after fix) case 0x4be6a5cb: // AC, Pikmin (after fix)
Console::Print("JAC ucode chosen\n"); INFO_LOG(CONSOLE, "JAC ucode chosen\n");
return new CUCode_Jac(_rMailHandler); return new CUCode_Jac(_rMailHandler);
case 0x3ad3b7ac: // Naruto3 case 0x3ad3b7ac: // Naruto3
@ -56,20 +56,20 @@ IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler)
case 0x07f88145: // bustamove, ikaruga, fzero, robotech battle cry, star soldier, soul calibur2, case 0x07f88145: // bustamove, ikaruga, fzero, robotech battle cry, star soldier, soul calibur2,
// Zelda:OOT, Tony hawk, viewtiful joe // Zelda:OOT, Tony hawk, viewtiful joe
case 0xe2136399: // billy hatcher, dragonballz, mario party 5, TMNT, ava1080 case 0xe2136399: // billy hatcher, dragonballz, mario party 5, TMNT, ava1080
Console::Print("AX ucode chosen, yay!\n"); INFO_LOG(CONSOLE, "AX ucode chosen, yay!\n");
return new CUCode_AX(_rMailHandler); return new CUCode_AX(_rMailHandler);
case 0x6CA33A6D: // DK Jungle Beat case 0x6CA33A6D: // DK Jungle Beat
case 0x86840740: // zelda case 0x86840740: // zelda
case 0x56d36052: // mario case 0x56d36052: // mario
case 0x2fcdf1ec: // mariokart, zelda 4 swords case 0x2fcdf1ec: // mariokart, zelda 4 swords
Console::Print("Zelda ucode chosen\n"); INFO_LOG(CONSOLE, "Zelda ucode chosen\n");
return new CUCode_Zelda(_rMailHandler); return new CUCode_Zelda(_rMailHandler);
// WII CRCs // WII CRCs
case 0x6c3f6f94: // zelda - PAL case 0x6c3f6f94: // zelda - PAL
case 0xd643001f: // mario galaxy - PAL case 0xd643001f: // mario galaxy - PAL
Console::Print("Zelda Wii ucode chosen\n"); INFO_LOG(CONSOLE, "Zelda Wii ucode chosen\n");
return new CUCode_Zelda(_rMailHandler); return new CUCode_Zelda(_rMailHandler);
case 0x5ef56da3: // AX demo case 0x5ef56da3: // AX demo
@ -79,7 +79,7 @@ IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler)
case 0xb7eb9a9c: // Wii Pikmin - JAP case 0xb7eb9a9c: // Wii Pikmin - JAP
case 0x4cc52064: // Bleach: Versus Crusade case 0x4cc52064: // Bleach: Versus Crusade
case 0xd9c4bf34: // WiiMenu ... pray case 0xd9c4bf34: // WiiMenu ... pray
Console::Print("Wii - AXWii chosen\n"); INFO_LOG(CONSOLE, "Wii - AXWii chosen\n");
return new CUCode_AXWii(_rMailHandler, _CRC); return new CUCode_AXWii(_rMailHandler, _CRC);
default: default:

View File

@ -26,7 +26,6 @@
CDebugger* m_frame = NULL; CDebugger* m_frame = NULL;
#endif #endif
#include "ConsoleWindow.h" // Common: For the Windows console
#include "ChunkFile.h" #include "ChunkFile.h"
#include "WaveFile.h" #include "WaveFile.h"
#include "PCHW/Mixer.h" #include "PCHW/Mixer.h"
@ -40,6 +39,7 @@ CDebugger* m_frame = NULL;
#include "PCHW/NullSoundStream.h" #include "PCHW/NullSoundStream.h"
// Declarations and definitions // Declarations and definitions
PLUGIN_GLOBALS* globals = NULL;
DSPInitialize g_dspInitialize; DSPInitialize g_dspInitialize;
u8* g_pMemory; u8* g_pMemory;
extern std::vector<std::string> sMailLog, sMailTime; extern std::vector<std::string> sMailLog, sMailTime;
@ -127,12 +127,13 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
#endif #endif
/*
// Open and close console // Open and close console
void OpenConsole() void OpenConsole()
{ {
#if defined (_WIN32) #if defined (_WIN32)
Console::Open(155, 100, "Sound Debugging"); // give room for 100 rows Console::Open(155, 100, "Sound Debugging"); // give room for 100 rows
Console::Print("OpenConsole > Console opened\n"); DEBUG_LOG(CONSOLE, "OpenConsole > Console opened\n");
MoveWindow(Console::GetHwnd(), 0,400, 1280,550, true); // move window, TODO: make this MoveWindow(Console::GetHwnd(), 0,400, 1280,550, true); // move window, TODO: make this
// adjustable from the debugging window // adjustable from the debugging window
#endif #endif
@ -144,7 +145,7 @@ void CloseConsole()
FreeConsole(); FreeConsole();
#endif #endif
} }
*/
// Exported fuctions // Exported fuctions
@ -186,7 +187,11 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo)
#endif #endif
} }
void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) {
void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals)
{
globals = _pPluginGlobals;
LogManager::SetInstance((LogManager *)globals->logManager);
} }
void DllConfig(HWND _hParent) void DllConfig(HWND _hParent)

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="9,00" Version="9.00"
Name="Plugin_DSP_LLE" Name="Plugin_DSP_LLE"
ProjectGUID="{C60D0E7A-ED05-4C67-9EE7-3A6C0D7801C8}" ProjectGUID="{C60D0E7A-ED05-4C67-9EE7-3A6C0D7801C8}"
RootNamespace="Plugin_DSP_LLE" RootNamespace="Plugin_DSP_LLE"
@ -68,7 +68,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib" AdditionalDependencies="dxguid.lib dsound.lib winmm.lib"
OutputFile="../../../Binary/Win32/Plugins/Plugin_DSP_LLED.dll" OutputFile="../../../Binary/Win32/Plugins/Plugin_DSP_LLED.dll"
LinkIncremental="2" LinkIncremental="2"
GenerateManifest="false" GenerateManifest="false"
@ -153,7 +153,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib" AdditionalDependencies="dxguid.lib dsound.lib winmm.lib"
OutputFile="../../../Binary/x64/Plugins/Plugin_DSP_LLED.dll" OutputFile="../../../Binary/x64/Plugins/Plugin_DSP_LLED.dll"
LinkIncremental="2" LinkIncremental="2"
GenerateManifest="false" GenerateManifest="false"
@ -240,7 +240,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib" AdditionalDependencies="dxguid.lib dsound.lib winmm.lib"
OutputFile="../../../Binary/Win32/Plugins/Plugin_DSP_LLE.dll" OutputFile="../../../Binary/Win32/Plugins/Plugin_DSP_LLE.dll"
LinkIncremental="1" LinkIncremental="1"
GenerateManifest="false" GenerateManifest="false"
@ -329,7 +329,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib" AdditionalDependencies="dxguid.lib dsound.lib winmm.lib"
OutputFile="../../../Binary/x64/Plugins/Plugin_DSP_LLE.dll" OutputFile="../../../Binary/x64/Plugins/Plugin_DSP_LLE.dll"
LinkIncremental="1" LinkIncremental="1"
GenerateManifest="false" GenerateManifest="false"
@ -417,7 +417,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib" AdditionalDependencies="dxguid.lib dsound.lib winmm.lib"
OutputFile="../../../Binary/Win32/Plugins/Plugin_DSP_LLEDF.dll" OutputFile="../../../Binary/Win32/Plugins/Plugin_DSP_LLEDF.dll"
LinkIncremental="1" LinkIncremental="1"
GenerateManifest="false" GenerateManifest="false"
@ -506,7 +506,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib" AdditionalDependencies="dxguid.lib dsound.lib winmm.lib"
OutputFile="../../../Binary/x64/Plugins/Plugin_DSP_LLEDF.dll" OutputFile="../../../Binary/x64/Plugins/Plugin_DSP_LLEDF.dll"
LinkIncremental="1" LinkIncremental="1"
GenerateManifest="false" GenerateManifest="false"

View File

@ -23,55 +23,6 @@
#include "Globals.h" #include "Globals.h"
#include "gdsp_interpreter.h" #include "gdsp_interpreter.h"
// =======================================================================================
// This is to verbose, it has to be turned on manually for now
// --------------
void DebugLog(const char* _fmt, ...)
{
#if defined(_DEBUG) || defined(DEBUGFAST)
char Msg[512];
va_list ap;
va_start( ap, _fmt );
vsprintf( Msg, _fmt, ap );
va_end( ap );
// Only show certain messages
std::string sMsg = Msg;
if(sMsg.find("Mail") != -1 || sMsg.find("AX") != -1)
// no match = -1
{
#ifdef _WIN32
OutputDebugString(Msg);
#endif
g_dspInitialize.pLog(Msg,0);
}
#endif
}
// =============
void ErrorLog(const char* _fmt, ...)
{
char Msg[512];
va_list ap;
va_start(ap, _fmt);
vsprintf(Msg, _fmt, ap);
va_end(ap);
g_dspInitialize.pLog(Msg,0);
#ifdef _WIN32
::MessageBox(NULL, Msg, "Error", MB_OK);
#endif
DSP_DebugBreak(); // NOTICE: we also break the emulation if this happens
}
// ======================================================================================= // =======================================================================================
// For PB address detection // For PB address detection
// -------------- // --------------

View File

@ -27,8 +27,6 @@
#define PROFILE 1 #define PROFILE 1
extern DSPInitialize g_dspInitialize; extern DSPInitialize g_dspInitialize;
void DebugLog(const char* _fmt, ...);
void ErrorLog(const char* _fmt, ...);
void DSP_DebugBreak(); void DSP_DebugBreak();

View File

@ -30,8 +30,8 @@ extern u32 m_addressPBs;
bool AXTask(u32& _uMail) bool AXTask(u32& _uMail)
{ {
u32 uAddress = _uMail; u32 uAddress = _uMail;
DebugLog("AXTask - ================================================================"); DEBUG_LOG(DSPHLE, "AXTask - ================================================================");
DebugLog("AXTask - AXCommandList-Addr: 0x%08x", uAddress); DEBUG_LOG(DSPHLE, "AXTask - AXCommandList-Addr: 0x%08x", uAddress);
bool bExecuteList = true; bool bExecuteList = true;
@ -50,7 +50,7 @@ bool AXTask(u32& _uMail)
case 0: // AXLIST_STUDIOADDR: //00 case 0: // AXLIST_STUDIOADDR: //00
{ {
uAddress += 4; uAddress += 4;
DebugLog("AXLIST AXLIST_SBUFFER: %08x", uAddress); DEBUG_LOG(DSPHLE, "AXLIST AXLIST_SBUFFER: %08x", uAddress);
} }
break; break;
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
@ -61,7 +61,7 @@ bool AXTask(u32& _uMail)
{ {
m_addressPBs = Memory_Read_U32(uAddress); m_addressPBs = Memory_Read_U32(uAddress);
uAddress += 4; uAddress += 4;
DebugLog("AXLIST PB address: %08x", m_addressPBs); DEBUG_LOG(DSPHLE, "AXLIST PB address: %08x", m_addressPBs);
bExecuteList = false; bExecuteList = false;
} }
break; break;
@ -71,7 +71,7 @@ bool AXTask(u32& _uMail)
{ {
// Hopefully this is where in main ram to write. // Hopefully this is where in main ram to write.
uAddress += 4; uAddress += 4;
DebugLog("AXLIST AXLIST_SBUFFER: %08x", uAddress); DEBUG_LOG(DSPHLE, "AXLIST AXLIST_SBUFFER: %08x", uAddress);
} }
break; break;
@ -81,7 +81,7 @@ bool AXTask(u32& _uMail)
{ {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// Stop the execution of this TaskList // Stop the execution of this TaskList
DebugLog("AXLIST default: %08x", uAddress); DEBUG_LOG(DSPHLE, "AXLIST default: %08x", uAddress);
bExecuteList = false; bExecuteList = false;
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
} }
@ -89,8 +89,8 @@ bool AXTask(u32& _uMail)
} // end of switch } // end of switch
} }
DebugLog("AXTask - done, send resume"); DEBUG_LOG(DSPHLE, "AXTask - done, send resume");
DebugLog("AXTask - ================================================================"); DEBUG_LOG(DSPHLE, "AXTask - ================================================================");
// now resume // now resume
return true; return true;

View File

@ -30,7 +30,6 @@
#include "Common.h" #include "Common.h"
#include "UCode_AXStructs.h" // they are only in a virtual dir called UCodes AX #include "UCode_AXStructs.h" // they are only in a virtual dir called UCodes AX
#include "ConsoleWindow.h" // For Console::Print, Console::ClearScreen
// ===================== // =====================
@ -362,8 +361,8 @@ void Logging()
// ======================================================================================= // =======================================================================================
// Print // Print
// --------------- // ---------------
Console::ClearScreen(); // Console::ClearScreen();
Console::Print("%s", sbuff.c_str()); INFO_LOG(DSPHLE, "%s", sbuff.c_str());
sbuff.clear(); strcpy(buffer, ""); sbuff.clear(); strcpy(buffer, "");
// --------------- // ---------------
k=0; k=0;

View File

@ -28,7 +28,6 @@
#include "CommonTypes.h" // Pluginspecs #include "CommonTypes.h" // Pluginspecs
#include "UCode_AXStructs.h" // For the AXParamBlock structure #include "UCode_AXStructs.h" // For the AXParamBlock structure
#include "ConsoleWindow.h" // For Console::Print, Console::ClearScreen
u32 m_addressPBs = 0; u32 m_addressPBs = 0;
@ -54,7 +53,7 @@ int ReadOutPBs(AXParamBlock * _pPBs, int _num)
// reading and 'halfword' swap // reading and 'halfword' swap
n++; n++;
if (n > 20 && logall) {Console::ClearScreen();} //FIXME if (n > 20 && logall) {Console::ClearScreen();}
for (int i = 0; i < _num; i++) for (int i = 0; i < _num; i++)
{ {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
@ -68,7 +67,7 @@ int ReadOutPBs(AXParamBlock * _pPBs, int _num)
// Create a shortcut that let us update struct members // Create a shortcut that let us update struct members
short * pDest = (short *) & _pPBs[i]; short * pDest = (short *) & _pPBs[i];
if (n > 20 && logall) {Console::Print("%c%i:", 223, i);} // logging if (n > 20 && logall) {DEBUG_LOG(DSPHLE, "%c%i:", 223, i);} // logging
// -------------- // --------------
// Here we update the PB. We do it by going through all 192 / 2 = 96 u16 values // Here we update the PB. We do it by going through all 192 / 2 = 96 u16 values
@ -80,7 +79,7 @@ int ReadOutPBs(AXParamBlock * _pPBs, int _num)
{ {
if (pSrc[p] != 0 && n > 20 && logall) if (pSrc[p] != 0 && n > 20 && logall)
{ {
Console::Print("%i %04x | ", p, Common::swap16(pSrc[p])); DEBUG_LOG(DSPHLE, "%i %04x | ", p, Common::swap16(pSrc[p]));
} }
} }
@ -88,7 +87,7 @@ int ReadOutPBs(AXParamBlock * _pPBs, int _num)
} }
if(n > 20 && logall) {Console::Print("\n");} // logging if(n > 20 && logall) {DEBUG_LOG(DSPHLE, "\n");} // logging
// -------------- // --------------
// Here we update the block address to the starting point of the next PB // Here we update the block address to the starting point of the next PB
blockAddr = (_pPBs[i].next_pb_hi << 16) | _pPBs[i].next_pb_lo; blockAddr = (_pPBs[i].next_pb_hi << 16) | _pPBs[i].next_pb_lo;

View File

@ -258,7 +258,7 @@ char* gd_dis_params(gd_globals_t* gdg, opc_t* opc, uint16 op1, uint16 op2, char*
break; break;
default: default:
ErrorLog("Unknown parameter type: %x\n", opc->params[j].type); ERROR_LOG(DSPHLE, "Unknown parameter type: %x\n", opc->params[j].type);
exit(-1); exit(-1);
break; break;
} }
@ -313,7 +313,7 @@ uint16 gd_dis_get_opcode_size(gd_globals_t* gdg)
if (!opc) if (!opc)
{ {
ErrorLog("get_opcode_size ARGH"); ERROR_LOG(DSPHLE, "get_opcode_size ARGH");
exit(0); exit(0);
} }
@ -341,7 +341,7 @@ uint16 gd_dis_get_opcode_size(gd_globals_t* gdg)
if (!opc_ext) if (!opc_ext)
{ {
ErrorLog("get_opcode_size ext ARGH"); ERROR_LOG(DSPHLE, "get_opcode_size ext ARGH");
} }
return(opc_ext->size); return(opc_ext->size);

View File

@ -91,7 +91,7 @@ uint16 dsp_read_aram()
default: default:
val = (g_dspInitialize.pARAM_Read_U8(Address) << 8) | g_dspInitialize.pARAM_Read_U8(Address + 1); val = (g_dspInitialize.pARAM_Read_U8(Address) << 8) | g_dspInitialize.pARAM_Read_U8(Address + 1);
Address += 2; Address += 2;
ErrorLog("Unknown DSP Format %i", gdsp_ifx_regs[DSP_FORMAT]); ERROR_LOG(DSPHLE, "Unknown DSP Format %i", gdsp_ifx_regs[DSP_FORMAT]);
break; break;
} }

View File

@ -41,7 +41,7 @@ void dsp_op_ext_r_epi(uint16 _Opcode)
switch (op) switch (op)
{ {
case 0x00: case 0x00:
ErrorLog("dsp_op_ext_r_epi"); ERROR_LOG(DSPHLE, "dsp_op_ext_r_epi");
break; break;
case 0x01: case 0x01:

View File

@ -133,7 +133,7 @@ void gdsp_mbox_write_l(uint8 mbx, uint16 val)
if (mbx == GDSP_MBOX_DSP) if (mbx == GDSP_MBOX_DSP)
{ {
DebugLog("- Write DSP Mail: 0x%08x (pc=0x%04x)\n", gdsp_mbox_peek(GDSP_MBOX_DSP), g_dsp.err_pc); DEBUG_LOG(DSPHLE, "- Write DSP Mail: 0x%08x (pc=0x%04x)\n", gdsp_mbox_peek(GDSP_MBOX_DSP), g_dsp.err_pc);
} }
} }
@ -199,9 +199,9 @@ void gdsp_ifx_write(uint16 addr, uint16 val)
default: default:
/* if ((addr & 0xff) >= 0xa0 && reg_names[addr - 0xa0]) /* if ((addr & 0xff) >= 0xa0 && reg_names[addr - 0xa0])
DebugLog("%04x MW %s (%04x)\n", g_dsp.pc, reg_names[addr - 0xa0], val); DEBUG_LOG(DSPHLE, "%04x MW %s (%04x)\n", g_dsp.pc, reg_names[addr - 0xa0], val);
else else
DebugLog("%04x MW %04x (%04x)\n", g_dsp.pc, addr, val);*/ DEBUG_LOG(DSPHLE, "%04x MW %04x (%04x)\n", g_dsp.pc, addr, val);*/
gdsp_ifx_regs[addr] = val; gdsp_ifx_regs[addr] = val;
break; break;
} }
@ -259,7 +259,7 @@ void gdsp_idma_in(uint16 dsp_addr, uint32 addr, uint32 size)
} }
g_dsp.iram_crc = GenerateCRC(g_dsp.cpu_ram + (addr & 0x0fffffff), size); g_dsp.iram_crc = GenerateCRC(g_dsp.cpu_ram + (addr & 0x0fffffff), size);
DebugLog("*** Copy new UCode from 0x%08x to 0x%04x (crc: %8x)\n", addr, dsp_addr, g_dsp.iram_crc); DEBUG_LOG(DSPHLE, "*** Copy new UCode from 0x%08x to 0x%04x (crc: %8x)\n", addr, dsp_addr, g_dsp.iram_crc);
#if DUMP_DSP_IMEM #if DUMP_DSP_IMEM
DumpDSPCode(addr, size, g_dsp.iram_crc ); DumpDSPCode(addr, size, g_dsp.iram_crc );
@ -269,7 +269,7 @@ void gdsp_idma_in(uint16 dsp_addr, uint32 addr, uint32 size)
void gdsp_idma_out(uint16 dsp_addr, uint32 addr, uint32 size) void gdsp_idma_out(uint16 dsp_addr, uint32 addr, uint32 size)
{ {
ErrorLog("*** idma_out IRAM_DSP (0x%04x) -> RAM (0x%08x) : size (0x%08x)\n", dsp_addr / 2, addr, size); ERROR_LOG(DSPHLE, "*** idma_out IRAM_DSP (0x%04x) -> RAM (0x%08x) : size (0x%08x)\n", dsp_addr / 2, addr, size);
} }
@ -277,7 +277,7 @@ void gdsp_ddma_in(uint16 dsp_addr, uint32 addr, uint32 size)
{ {
if ((addr & 0x7FFFFFFF) > 0x01FFFFFF) if ((addr & 0x7FFFFFFF) > 0x01FFFFFF)
{ {
ErrorLog("*** ddma_in read from invalid addr (0x%08x)\n", addr); ERROR_LOG(DSPHLE, "*** ddma_in read from invalid addr (0x%08x)\n", addr);
return; return;
} }
@ -288,7 +288,7 @@ void gdsp_ddma_in(uint16 dsp_addr, uint32 addr, uint32 size)
*(uint16*)&dst[dsp_addr + i] = *(uint16*)&g_dsp.cpu_ram[(addr + i) & 0x7FFFFFFF]; *(uint16*)&dst[dsp_addr + i] = *(uint16*)&g_dsp.cpu_ram[(addr + i) & 0x7FFFFFFF];
} }
DebugLog("*** ddma_in RAM (0x%08x) -> DRAM_DSP (0x%04x) : size (0x%08x)\n", addr, dsp_addr / 2, size); DEBUG_LOG(DSPHLE, "*** ddma_in RAM (0x%08x) -> DRAM_DSP (0x%04x) : size (0x%08x)\n", addr, dsp_addr / 2, size);
} }
@ -296,7 +296,7 @@ void gdsp_ddma_out(uint16 dsp_addr, uint32 addr, uint32 size)
{ {
if ((addr & 0x7FFFFFFF) > 0x01FFFFFF) if ((addr & 0x7FFFFFFF) > 0x01FFFFFF)
{ {
ErrorLog("*** gdsp_ddma_out to invalid addr (0x%08x)\n", addr); ERROR_LOG(DSPHLE, "*** gdsp_ddma_out to invalid addr (0x%08x)\n", addr);
return; return;
} }
@ -307,7 +307,7 @@ void gdsp_ddma_out(uint16 dsp_addr, uint32 addr, uint32 size)
*(uint16*)&g_dsp.cpu_ram[(addr + i) & 0x7FFFFFFF] = *(uint16*)&src[dsp_addr + i]; *(uint16*)&g_dsp.cpu_ram[(addr + i) & 0x7FFFFFFF] = *(uint16*)&src[dsp_addr + i];
} }
DebugLog("*** ddma_out DRAM_DSP (0x%04x) -> RAM (0x%08x) : size (0x%08x)\n", dsp_addr / 2, addr, size); DEBUG_LOG(DSPHLE, "*** ddma_out DRAM_DSP (0x%04x) -> RAM (0x%08x) : size (0x%08x)\n", dsp_addr / 2, addr, size);
} }
@ -330,7 +330,7 @@ void gdsp_dma()
if ((ctl > 3) || (len > 0x4000)) if ((ctl > 3) || (len > 0x4000))
{ {
ErrorLog("DMA ERROR pc: %04x ctl: %04x addr: %08x da: %04x size: %04x\n", g_dsp.pc, ctl, addr, dsp_addr, len); ERROR_LOG(DSPHLE, "DMA ERROR pc: %04x ctl: %04x addr: %08x da: %04x size: %04x\n", g_dsp.pc, ctl, addr, dsp_addr, len);
exit(0); exit(0);
} }

View File

@ -88,7 +88,7 @@ uint16 dsp_dmem_read(uint16 addr)
break; break;
case 0x8: // 8xxx DROM case 0x8: // 8xxx DROM
DebugLog("someone reads from ROM\n"); DEBUG_LOG(DSPHLE, "someone reads from ROM\n");
val = g_dsp.drom[addr & DSP_DROM_MASK]; val = g_dsp.drom[addr & DSP_DROM_MASK];
val = dsp_swap16(val); val = dsp_swap16(val);
break; break;
@ -103,7 +103,7 @@ uint16 dsp_dmem_read(uint16 addr)
break; break;
default: // error default: // error
// ErrorLog("%04x DSP ERROR: Read from UNKNOWN (%04x) memory\n", g_dsp.pc, addr); // ERROR_LOG(DSPHLE, "%04x DSP ERROR: Read from UNKNOWN (%04x) memory\n", g_dsp.pc, addr);
val = 0; val = 0;
break; break;
} }
@ -117,7 +117,7 @@ bool dsp_dmem_write(uint16 addr, uint16 val)
switch (addr >> 12) switch (addr >> 12)
{ {
case 0x8: // 8xxx DROM case 0x8: // 8xxx DROM
DebugLog("someone writes to ROM\n"); DEBUG_LOG(DSPHLE, "someone writes to ROM\n");
/* val = dsp_swap16(val); /* val = dsp_swap16(val);
g_dsp.drom[addr & DSP_DROM_MASK] = val;*/ g_dsp.drom[addr & DSP_DROM_MASK] = val;*/
break; break;
@ -132,7 +132,7 @@ bool dsp_dmem_write(uint16 addr, uint16 val)
break; break;
default: // error default: // error
DebugLog("%04x DSP ERROR: Write to UNKNOWN (%04x) memory\n", g_dsp.pc, addr); DEBUG_LOG(DSPHLE, "%04x DSP ERROR: Write to UNKNOWN (%04x) memory\n", g_dsp.pc, addr);
break; break;
} }

View File

@ -187,7 +187,7 @@ bool CheckCondition(uint8 _Condition)
break; break;
default: default:
// DebugLog("Unknown condition check: 0x%04x\n", _Condition & 0xf); // DEBUG_LOG(DSPHLE, "Unknown condition check: 0x%04x\n", _Condition & 0xf);
break; break;
} }
@ -200,7 +200,7 @@ bool CheckCondition(uint8 _Condition)
void dsp_op_unknown(uint16 opc) void dsp_op_unknown(uint16 opc)
{ {
_assert_msg_(MASTER_LOG, !g_dsp.exception_in_progress_hack, "assert while exception"); _assert_msg_(MASTER_LOG, !g_dsp.exception_in_progress_hack, "assert while exception");
ErrorLog("dsp_op_unknown somewhere"); ERROR_LOG(DSPHLE, "dsp_op_unknown somewhere");
g_dsp.pc = g_dsp.err_pc; g_dsp.pc = g_dsp.err_pc;
} }
@ -244,7 +244,7 @@ void dsp_opc_jmpa(uint16 opc)
if ((opc & 0xf) != 0xf) if ((opc & 0xf) != 0xf)
{ {
ErrorLog("dsp_opc_jmpa"); ERROR_LOG(DSPHLE, "dsp_opc_jmpa");
} }
reg = (opc >> 5) & 0x7; reg = (opc >> 5) & 0x7;
@ -274,7 +274,7 @@ void dsp_opc_rti(uint16 opc)
{ {
if ((opc & 0xf) != 0xf) if ((opc & 0xf) != 0xf)
{ {
ErrorLog("dsp_opc_rti"); ERROR_LOG(DSPHLE, "dsp_opc_rti");
} }
g_dsp.r[R_SR] = dsp_reg_load_stack(DSP_STACK_D); g_dsp.r[R_SR] = dsp_reg_load_stack(DSP_STACK_D);
@ -452,7 +452,7 @@ void dsp_opc_ilrr(uint16 opc)
break; break;
default: default:
ErrorLog("dsp_opc_ilrr"); ERROR_LOG(DSPHLE, "dsp_opc_ilrr");
} }
} }
@ -544,14 +544,14 @@ void dsp_opc_mulc(uint16 opc)
// NEW // NEW
void dsp_opc_mulcmvz(uint16 opc) void dsp_opc_mulcmvz(uint16 opc)
{ {
ErrorLog("dsp_opc_mulcmvz ni"); ERROR_LOG(DSPHLE, "dsp_opc_mulcmvz ni");
} }
// NEW // NEW
void dsp_opc_mulcmv(uint16 opc) void dsp_opc_mulcmv(uint16 opc)
{ {
ErrorLog("dsp_opc_mulcmv ni"); ERROR_LOG(DSPHLE, "dsp_opc_mulcmv ni");
} }
@ -735,7 +735,7 @@ void dsp_opc_andfc(uint16 opc)
{ {
if (opc & 0xf) if (opc & 0xf)
{ {
ErrorLog("dsp_opc_andfc"); ERROR_LOG(DSPHLE, "dsp_opc_andfc");
} }
uint8 reg = (opc >> 8) & 0x1; uint8 reg = (opc >> 8) & 0x1;
@ -761,7 +761,7 @@ void dsp_opc_andf(uint16 opc)
if (opc & 0xf) if (opc & 0xf)
{ {
ErrorLog("dsp_opc_andf"); ERROR_LOG(DSPHLE, "dsp_opc_andf");
} }
reg = 0x1e + ((opc >> 8) & 0x1); reg = 0x1e + ((opc >> 8) & 0x1);
@ -783,7 +783,7 @@ void dsp_opc_subf(uint16 opc)
{ {
if (opc & 0xf) if (opc & 0xf)
{ {
ErrorLog("dsp_opc_subf"); ERROR_LOG(DSPHLE, "dsp_opc_subf");
} }
uint8 reg = 0x1e + ((opc >> 8) & 0x1); uint8 reg = 0x1e + ((opc >> 8) & 0x1);
@ -800,7 +800,7 @@ void dsp_opc_xori(uint16 opc)
{ {
if (opc & 0xf) if (opc & 0xf)
{ {
ErrorLog("dsp_opc_xori"); ERROR_LOG(DSPHLE, "dsp_opc_xori");
} }
uint8 reg = 0x1e + ((opc >> 8) & 0x1); uint8 reg = 0x1e + ((opc >> 8) & 0x1);
@ -815,7 +815,7 @@ void dsp_opc_andi(uint16 opc)
{ {
if (opc & 0xf) if (opc & 0xf)
{ {
ErrorLog("dsp_opc_andi"); ERROR_LOG(DSPHLE, "dsp_opc_andi");
} }
uint8 reg = 0x1e + ((opc >> 8) & 0x1); uint8 reg = 0x1e + ((opc >> 8) & 0x1);
@ -832,7 +832,8 @@ void dsp_opc_ori(uint16 opc)
{ {
if (opc & 0xf) if (opc & 0xf)
{ {
return(ErrorLog("dsp_opc_ori")); ERROR_LOG(DSPHLE, "dsp_opc_ori");
return;
} }
uint8 reg = 0x1e + ((opc >> 8) & 0x1); uint8 reg = 0x1e + ((opc >> 8) & 0x1);
@ -980,7 +981,7 @@ void dsp_opc_neg(uint16 opc)
void dsp_opc_movnp(uint16 opc) void dsp_opc_movnp(uint16 opc)
{ {
ErrorLog("dsp_opc_movnp\n"); ERROR_LOG(DSPHLE, "dsp_opc_movnp\n");
} }
@ -1525,7 +1526,7 @@ void dsp_op0(uint16 opc)
break; break;
default: default:
ErrorLog("dsp_op0"); ERROR_LOG(DSPHLE, "dsp_op0");
break; break;
} }
@ -1565,7 +1566,7 @@ void dsp_op0(uint16 opc)
break; break;
default: default:
ErrorLog("dsp_op0"); ERROR_LOG(DSPHLE, "dsp_op0");
break; break;
} }
@ -1628,7 +1629,7 @@ void dsp_op0(uint16 opc)
break; break;
default: default:
ErrorLog("dsp_op0"); ERROR_LOG(DSPHLE, "dsp_op0");
break; break;
} }
@ -1671,7 +1672,7 @@ void dsp_op0(uint16 opc)
break; break;
default: default:
ErrorLog("dsp_op0"); ERROR_LOG(DSPHLE, "dsp_op0");
break; break;
} }
@ -1699,7 +1700,7 @@ void dsp_op0(uint16 opc)
break; break;
default: default:
ErrorLog("dsp_op0"); ERROR_LOG(DSPHLE, "dsp_op0");
break; break;
} }
} }
@ -1756,7 +1757,7 @@ void dsp_op1(uint16 opc)
break; break;
default: default:
ErrorLog("dsp_op1"); ERROR_LOG(DSPHLE, "dsp_op1");
break; break;
} }
} }
@ -1814,7 +1815,7 @@ void dsp_op3(uint16 opc)
break; break;
default: default:
ErrorLog("dsp_op3"); ERROR_LOG(DSPHLE, "dsp_op3");
break; break;
} }
@ -1857,7 +1858,7 @@ void dsp_op4(uint16 opc)
break; break;
default: default:
ErrorLog("dsp_op4"); ERROR_LOG(DSPHLE, "dsp_op4");
break; break;
} }
@ -1895,7 +1896,7 @@ void dsp_op5(uint16 opc)
break; break;
default: default:
ErrorLog("dsp_op5: %x", (opc >> 8) & 0xf); ERROR_LOG(DSPHLE, "dsp_op5: %x", (opc >> 8) & 0xf);
break; break;
} }
@ -1933,7 +1934,7 @@ void dsp_op6(uint16 opc)
break; break;
default: default:
ErrorLog("dsp_op6"); ERROR_LOG(DSPHLE, "dsp_op6");
break; break;
} }
@ -1985,7 +1986,7 @@ void dsp_op7(uint16 opc)
break; break;
default: default:
ErrorLog("dsp_op7"); ERROR_LOG(DSPHLE, "dsp_op7");
break; break;
} }
@ -2032,7 +2033,7 @@ void dsp_op8(uint16 opc)
break; break;
default: default:
ErrorLog("dsp_op8"); ERROR_LOG(DSPHLE, "dsp_op8");
break; break;
} }
@ -2078,7 +2079,7 @@ void dsp_op9(uint16 opc)
break; break;
default: default:
ErrorLog("dsp_op9"); ERROR_LOG(DSPHLE, "dsp_op9");
break; break;
} }
@ -2116,7 +2117,7 @@ void dsp_opab(uint16 opc)
break; break;
default: default:
ErrorLog("dsp_opab"); ERROR_LOG(DSPHLE, "dsp_opab");
} }
dsp_op_ext_ops_epi(opc); dsp_op_ext_ops_epi(opc);
@ -2153,7 +2154,7 @@ void dsp_opcd(uint16 opc)
break; break;
default: default:
ErrorLog("dsp_opcd"); ERROR_LOG(DSPHLE, "dsp_opcd");
} }
dsp_op_ext_ops_epi(opc); dsp_op_ext_ops_epi(opc);
@ -2183,7 +2184,7 @@ void dsp_ope(uint16 opc)
break; break;
default: default:
ErrorLog("dsp_ope"); ERROR_LOG(DSPHLE, "dsp_ope");
} }
dsp_op_ext_ops_epi(opc); dsp_op_ext_ops_epi(opc);
@ -2224,7 +2225,7 @@ void dsp_opf(uint16 opc)
break; break;
default: default:
ErrorLog("dsp_opf"); ERROR_LOG(DSPHLE, "dsp_opf");
break; break;
} }

View File

@ -23,7 +23,6 @@
#include "WaveFile.h" #include "WaveFile.h"
#include "CommonTypes.h" #include "CommonTypes.h"
#include "Mixer.h" #include "Mixer.h"
#include "ConsoleWindow.h" // For Console::Open, Console::Print
#include "Globals.h" // Local #include "Globals.h" // Local
#include "gdsp_interpreter.h" #include "gdsp_interpreter.h"
@ -57,6 +56,7 @@
// ======================================================================================= // =======================================================================================
// Global declarations and definitions // Global declarations and definitions
// -------------- // --------------
PLUGIN_GLOBALS* globals = NULL;
DSPInitialize g_dspInitialize; DSPInitialize g_dspInitialize;
#define GDSP_MBOX_CPU 0 #define GDSP_MBOX_CPU 0
@ -114,7 +114,10 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo)
#endif #endif
} }
void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) { void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals)
{
globals = _pPluginGlobals;
LogManager::SetInstance((LogManager *)globals->logManager);
} }
void DllAbout(HWND _hParent) void DllAbout(HWND _hParent)
@ -135,13 +138,13 @@ void DllDebugger(HWND _hParent, bool Show)
#if defined (_DEBUG) || defined (DEBUGFAST) #if defined (_DEBUG) || defined (DEBUGFAST)
g_Dialog.Create(NULL); //_hParent); g_Dialog.Create(NULL); //_hParent);
g_Dialog.ShowWindow(SW_SHOW); g_Dialog.ShowWindow(SW_SHOW);
MoveWindow(g_Dialog.m_hWnd, 450,0, 780,530, true); // MoveWindow(g_Dialog.m_hWnd, 450,0, 780,530, true);
// Open the console window // Open the console window
Console::Open(155, 100, "Sound Debugging"); // give room for 100 rows // Console::Open(155, 100, "Sound Debugging"); // give room for 100 rows
Console::Print("DllDebugger > Console opened\n"); // Console::Print("DllDebugger > Console opened\n");
// Todo: Make this adjustable from the Debugging window // Todo: Make this adjustable from the Debugging window
MoveWindow(Console::GetHwnd(), 0,400, 1280,500, true); // MoveWindow(Console::GetHwnd(), 0,400, 1280,500, true);
#else #else
MessageBox(0, "Can't open debugging window in the Release build of this plugin.", "DSP LLE", 0); MessageBox(0, "Can't open debugging window in the Release build of this plugin.", "DSP LLE", 0);
#endif #endif
@ -235,14 +238,14 @@ void Initialize(void *init)
{ {
bCanWork = false; bCanWork = false;
PanicAlert("No DSP ROM"); PanicAlert("No DSP ROM");
ErrorLog("Cannot load DSP ROM\n"); ERROR_LOG(DSPHLE, "Cannot load DSP ROM\n");
} }
if (!gdsp_load_coef((char *)DSP_COEF_FILE)) if (!gdsp_load_coef((char *)DSP_COEF_FILE))
{ {
bCanWork = false; bCanWork = false;
PanicAlert("No DSP COEF"); PanicAlert("No DSP COEF");
ErrorLog("Cannot load DSP COEF\n"); ERROR_LOG(DSPHLE, "Cannot load DSP COEF\n");
} }
if(!bCanWork) if(!bCanWork)
@ -350,7 +353,7 @@ void DSP_WriteMailboxHigh(bool _CPUMailbox, u16 _uHighMail)
{ {
if (gdsp_mbox_peek(GDSP_MBOX_CPU) & 0x80000000) if (gdsp_mbox_peek(GDSP_MBOX_CPU) & 0x80000000)
{ {
ErrorLog("Mailbox isnt empty ... strange"); ERROR_LOG(DSPHLE, "Mailbox isnt empty ... strange");
} }
#if PROFILE #if PROFILE
@ -364,7 +367,7 @@ void DSP_WriteMailboxHigh(bool _CPUMailbox, u16 _uHighMail)
} }
else else
{ {
ErrorLog("CPU cant write to DSP mailbox"); ERROR_LOG(DSPHLE, "CPU cant write to DSP mailbox");
} }
} }
@ -377,7 +380,7 @@ void DSP_WriteMailboxLow(bool _CPUMailbox, u16 _uLowMail)
u32 uAddress = gdsp_mbox_peek(GDSP_MBOX_CPU); u32 uAddress = gdsp_mbox_peek(GDSP_MBOX_CPU);
u16 errpc = g_dsp.err_pc; u16 errpc = g_dsp.err_pc;
DebugLog("Write CPU Mail: 0x%08x (pc=0x%04x)\n", uAddress, errpc); DEBUG_LOG(DSPHLE, "Write CPU Mail: 0x%08x (pc=0x%04x)\n", uAddress, errpc);
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// I couldn't find any better way to detect the AX mails so this had to do. Please feel free // I couldn't find any better way to detect the AX mails so this had to do. Please feel free
@ -385,13 +388,13 @@ void DSP_WriteMailboxLow(bool _CPUMailbox, u16 _uLowMail)
// -------------- // --------------
if ((errpc == 0x0054 || errpc == 0x0055) && m_addressPBs == 0) if ((errpc == 0x0054 || errpc == 0x0055) && m_addressPBs == 0)
{ {
DebugLog("AXTask ======== 0x%08x (pc=0x%04x)", uAddress, errpc); DEBUG_LOG(DSPHLE, "AXTask ======== 0x%08x (pc=0x%04x)", uAddress, errpc);
AXTask(uAddress); AXTask(uAddress);
} }
} }
else else
{ {
ErrorLog("CPU cant write to DSP mailbox"); ERROR_LOG(DSPHLE, "CPU cant write to DSP mailbox");
} }
} }
@ -433,7 +436,3 @@ void DSP_SendAIBuffer(unsigned int address, int sample_rate)
void __Log(int, const char *fmt, ...)
{
//DebugLog(fmt);
}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="9,00" Version="9.00"
Name="Plugin_PadSimple" Name="Plugin_PadSimple"
ProjectGUID="{9A183B48-ECC2-4121-876A-9B3793686073}" ProjectGUID="{9A183B48-ECC2-4121-876A-9B3793686073}"
RootNamespace="Plugin_PadSimple" RootNamespace="Plugin_PadSimple"
@ -86,7 +86,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dxerr9.lib dinput8.lib xinput.lib comctl32.lib" AdditionalDependencies="dxguid.lib dxerr9.lib dinput8.lib xinput.lib comctl32.lib winmm.lib"
OutputFile="..\..\..\Binary\Win32\plugins\Plugin_PadSimple.dll" OutputFile="..\..\..\Binary\Win32\plugins\Plugin_PadSimple.dll"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="true" SuppressStartupBanner="true"
@ -188,7 +188,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dxerr9.lib dinput8.lib xinput.lib comctl32.lib" AdditionalDependencies="dxguid.lib dxerr9.lib dinput8.lib xinput.lib comctl32.lib winmm.lib"
OutputFile="..\..\..\Binary\x64\plugins\Plugin_PadSimple.dll" OutputFile="..\..\..\Binary\x64\plugins\Plugin_PadSimple.dll"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="true" SuppressStartupBanner="true"
@ -285,7 +285,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dxerr9.lib dinput8.lib xinput.lib comctl32.lib rpcrt4.lib" AdditionalDependencies="dxguid.lib dxerr9.lib dinput8.lib xinput.lib comctl32.lib winmm.lib rpcrt4.lib"
OutputFile="..\..\..\Binary\Win32/plugins\Plugin_PadSimpleD.dll" OutputFile="..\..\..\Binary\Win32/plugins\Plugin_PadSimpleD.dll"
LinkIncremental="2" LinkIncremental="2"
SuppressStartupBanner="true" SuppressStartupBanner="true"
@ -383,7 +383,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dxerr9.lib dinput8.lib xinput.lib comctl32.lib rpcrt4.lib" AdditionalDependencies="dxguid.lib dxerr9.lib dinput8.lib xinput.lib comctl32.lib winmm.lib rpcrt4.lib"
OutputFile="..\..\..\Binary\x64\plugins\Plugin_PadSimpleD.dll" OutputFile="..\..\..\Binary\x64\plugins\Plugin_PadSimpleD.dll"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="true" SuppressStartupBanner="true"
@ -485,7 +485,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dxerr9.lib dinput8.lib xinput.lib comctl32.lib" AdditionalDependencies="dxguid.lib dxerr9.lib dinput8.lib xinput.lib comctl32.lib winmm.lib"
OutputFile="..\..\..\Binary\Win32\plugins\Plugin_PadSimpleDF.dll" OutputFile="..\..\..\Binary\Win32\plugins\Plugin_PadSimpleDF.dll"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="true" SuppressStartupBanner="true"
@ -586,7 +586,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dxerr9.lib dinput8.lib xinput.lib comctl32.lib " AdditionalDependencies="dxguid.lib dxerr9.lib dinput8.lib xinput.lib comctl32.lib winmm.lib"
OutputFile="..\..\..\Binary\x64\plugins\Plugin_PadSimpleDF.dll" OutputFile="..\..\..\Binary\x64\plugins\Plugin_PadSimpleDF.dll"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="true" SuppressStartupBanner="true"

View File

@ -254,7 +254,7 @@ void ConfigDialog::CreateGUIControls()
m_CheckRecording[0]->SetValue(pad[0].bRecording); m_CheckRecording[0]->SetValue(pad[0].bRecording);
m_CheckPlayback[0]->SetValue(pad[0].bPlayback); m_CheckPlayback[0]->SetValue(pad[0].bPlayback);
Console::Print("m_CheckRecording: %i\n", pad[0].bRecording, pad[0].bPlayback); //DEBUG_LOG(CONSOLE, "m_CheckRecording: %i\n", pad[0].bRecording, pad[0].bPlayback);
#endif #endif
////////////////////////////////////// //////////////////////////////////////

View File

@ -26,7 +26,6 @@
#include "pluginspecs_pad.h" #include "pluginspecs_pad.h"
#include "PadSimple.h" #include "PadSimple.h"
#include "IniFile.h" #include "IniFile.h"
#include "ConsoleWindow.h"
#include "StringUtil.h" #include "StringUtil.h"
#include "FileUtil.h" #include "FileUtil.h"
#include "ChunkFile.h" #include "ChunkFile.h"
@ -80,17 +79,12 @@ SPADInitialize g_PADInitialize;
// Pre defined maxium storage limit // Pre defined maxium storage limit
#define RECORD_SIZE (1024 * 128) #define RECORD_SIZE (1024 * 128)
PLUGIN_GLOBALS* globals = NULL;
SPADStatus recordBuffer[RECORD_SIZE]; SPADStatus recordBuffer[RECORD_SIZE];
int count = 0; int count = 0;
bool g_EmulatorRunning = false; bool g_EmulatorRunning = false;
//////////////////////////////// ////////////////////////////////
// TODO: fix this dirty hack to stop missing symbols
void __Log(int log, const char *format, ...) {}
void __Logv(int log, int v, const char *format, ...) {}
//****************************************************************************** //******************************************************************************
// Supporting functions // Supporting functions
//****************************************************************************** //******************************************************************************
@ -612,7 +606,11 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo)
} }
void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) {} void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals)
{
globals = _pPluginGlobals;
LogManager::SetInstance((LogManager *)globals->logManager);
}
void DllConfig(HWND _hParent) void DllConfig(HWND _hParent)
{ {

View File

@ -19,7 +19,6 @@
#define __PADSIMPLE_H__ #define __PADSIMPLE_H__
#include "Setup.h" // Common #include "Setup.h" // Common
#include "ConsoleWindow.h"
// Controls // Controls
enum enum

View File

@ -67,11 +67,6 @@ SPADInitialize g_PADInitialize;
SPADStatus recordBuffer[RECORD_SIZE]; SPADStatus recordBuffer[RECORD_SIZE];
int count = 0; int count = 0;
// TODO: fix this dirty hack to stop missing symbols
void __Log(int log, const char *format, ...) {}
void __Logv(int log, int v, const char *format, ...) {}
void RecordInput(const SPADStatus& _rPADStatus) void RecordInput(const SPADStatus& _rPADStatus)
{ {
if (count >= RECORD_SIZE) if (count >= RECORD_SIZE)
@ -216,6 +211,8 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo)
void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) { void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) {
globals = _pPluginGlobals; globals = _pPluginGlobals;
LogManager::SetInstance((LogManager *)globals->logManager);
} }
void DllConfig(HWND _hParent) void DllConfig(HWND _hParent)

View File

@ -48,6 +48,7 @@
HINSTANCE g_hInstance = NULL; HINSTANCE g_hInstance = NULL;
SVideoInitialize g_VideoInitialize; SVideoInitialize g_VideoInitialize;
PLUGIN_GLOBALS* globals = NULL;
int initCount = 0; int initCount = 0;
@ -163,6 +164,8 @@ void GetDllInfo (PLUGIN_INFO* _PluginInfo)
} }
void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) { void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) {
globals = _pPluginGlobals;
LogManager::SetInstance((LogManager *)globals->logManager);
} }
void DllAbout(HWND _hParent) void DllAbout(HWND _hParent)
@ -268,32 +271,6 @@ void Video_AddMessage(const char* pstr, u32 milliseconds)
Renderer::AddMessage(pstr,milliseconds); Renderer::AddMessage(pstr,milliseconds);
} }
void DebugLog(const char* _fmt, ...)
{
#ifdef _DEBUG
char Msg[512];
va_list ap;
va_start(ap, _fmt);
vsprintf(Msg, _fmt, ap);
va_end(ap);
g_VideoInitialize.pLog(Msg, FALSE);
#endif
}
void __Log(int log, const char *format, ...)
{
// char temp[512];
//va_list args;
//va_start(args, format);
//CharArrayFromFormatV(temp, 512, format, args);
//va_end(args);
DebugLog(format); //"%s", temp);
}
HRESULT ScreenShot(const char *File) HRESULT ScreenShot(const char *File)
{ {
if (D3D::dev == NULL) if (D3D::dev == NULL)

View File

@ -17,7 +17,6 @@
#include "../Globals.h" // The precompiled header #include "../Globals.h" // The precompiled header
#include "IniFile.h" // Common #include "IniFile.h" // Common
#include "ConsoleWindow.h" // Move console window
#include "../Config.h" // Config settings #include "../Config.h" // Config settings
#include "Debugger.h" #include "Debugger.h"
@ -57,20 +56,21 @@ void CDebugger::OnClose(wxCloseEvent& event)
SaveSettings(); SaveSettings();
event.Skip(); // This means wxDialog's Destroy is used event.Skip(); // This means wxDialog's Destroy is used
CloseConsole(); // The console goes with the wx window // CloseConsole(); // The console goes with the wx window
} }
void CDebugger::DoShowHideConsole() void CDebugger::DoShowHideConsole()
{ {
if(m_Check[1]->IsChecked() /* if(m_Check[1]->IsChecked()
#ifdef _WIN32 #ifdef _WIN32
// Check to see if we already have a console // Check to see if we already have a console
&& Console::GetHwnd() == NULL // && Console::GetHwnd() == NULL
#endif #endif
) )
OpenConsole(); OpenConsole();
else else
CloseConsole(); CloseConsole();
*/
} }
void CDebugger::SaveSettings() const void CDebugger::SaveSettings() const
@ -113,9 +113,6 @@ void CDebugger::LoadSettings()
file.Get("VideoWindow", "h", &h, GetSize().GetHeight()); file.Get("VideoWindow", "h", &h, GetSize().GetHeight());
SetSize(x, y, w, h); SetSize(x, y, w, h);
file.Get("VideoWindow", "WriteToFile", &LocalLogFile, m_Check[0]->IsChecked());
m_Check[0]->SetValue(LocalLogFile);
bool Console; bool Console;
file.Get("VideoWindow", "Console", &Console, m_Check[1]->IsChecked()); file.Get("VideoWindow", "Console", &Console, m_Check[1]->IsChecked());
m_Check[1]->SetValue(Console); m_Check[1]->SetValue(Console);
@ -168,9 +165,6 @@ void CDebugger::GeneralSettings(wxCommandEvent& event)
{ {
switch (event.GetId()) switch (event.GetId())
{ {
case ID_SAVETOFILE:
LocalLogFile = event.IsChecked();
break;
case ID_SHOWCONSOLE: case ID_SHOWCONSOLE:
DoShowHideConsole(); DoShowHideConsole();
break; break;

View File

@ -76,13 +76,13 @@ ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &titl
// --------------- // ---------------
ConfigDialog::~ConfigDialog() ConfigDialog::~ConfigDialog()
{ {
Console::Print("ConfigDialog Closed\n"); INFO_LOG(CONSOLE, "ConfigDialog Closed\n");
} }
void ConfigDialog::OnClose(wxCloseEvent& event) void ConfigDialog::OnClose(wxCloseEvent& event)
{ {
g_Config.Save(); g_Config.Save();
Console::Print("OnClose\n"); INFO_LOG(CONSOLE, "OnClose\n");
// notice that we don't run wxEntryCleanup(); here so the dll will still be loaded // notice that we don't run wxEntryCleanup(); here so the dll will still be loaded
/* JP: Yes, it seems like Close() does not do that. It only runs EndModal() or something /* JP: Yes, it seems like Close() does not do that. It only runs EndModal() or something
@ -98,7 +98,7 @@ void ConfigDialog::OnClose(wxCloseEvent& event)
void ConfigDialog::CloseClick(wxCommandEvent& WXUNUSED (event)) void ConfigDialog::CloseClick(wxCommandEvent& WXUNUSED (event))
{ {
Console::Print("CloseClick\n"); INFO_LOG(CONSOLE, "CloseClick\n");
// If we run wxEntryCleanup() the class will be entirely deleted, and the destructor will be run // If we run wxEntryCleanup() the class will be entirely deleted, and the destructor will be run
//g_Config.Save(); //g_Config.Save();

View File

@ -30,16 +30,17 @@
#include "main.h" #include "main.h"
#include "IniFile.h" #include "IniFile.h"
#include "ConsoleWindow.h"
#include <assert.h> #include <assert.h>
/* FIXME should be done from logmanager
// Open and close the Windows console window // Open and close the Windows console window
void OpenConsole() void OpenConsole()
{ {
Console::Open(100, 300, "OpenGL Plugin Output"); // give room for 300 rows // Console::Open(100, 300, "OpenGL Plugin Output"); // give room for 300 rows
Console::Print("OpenGL console opened\n"); INFO_LOG(CONSOLE, "OpenGL console opened\n");
#ifdef _WIN32 // #ifdef _WIN32
MoveWindow(Console::GetHwnd(), 0,400, 1280,550, true); // Move window. Todo: make this MoveWindow(Console::GetHwnd(), 0,400, 1280,550, true); // Move window. Todo: make this
// adjustable from the debugging window // adjustable from the debugging window
#endif #endif
@ -47,59 +48,7 @@ void OpenConsole()
void CloseConsole() void CloseConsole()
{ {
Console::Close(); // Console::Close();
} }
*/
//////////////////////////////////////////////////////////////////////////////////////////
// Write logs
// The log file handle
static FILE* pfLog = NULL;
// This is on by default, but can be controlled from the debugging window
bool LocalLogFile = true;
#if LOGLEVEL > 0
void __Log(const char *fmt, ...)
{
size_t len = strlen(fmt);
if (!len)
return;
char* Msg = (char*)alloca(len + 512);
va_list ap;
va_start(ap, fmt);
vsnprintf(Msg, len + 512, fmt, ap);
va_end(ap);
g_VideoInitialize.pLog(Msg, FALSE);
// If we have no file to write to, create one
if (pfLog == NULL && LocalLogFile)
pfLog = fopen(FULL_LOGS_DIR "oglgfx.txt", "w");
// Write to file
if (pfLog != NULL && LocalLogFile)
fwrite(Msg, strlen(Msg), 1, pfLog);
Console::Print(Msg);
}
void __Log(int type, const char *fmt, ...)
{
int len = (int)strlen(fmt);
if (!len)
return;
char* Msg = (char*)alloca(len + 512);
va_list ap;
va_start(ap, fmt);
vsnprintf(Msg, len + 512, fmt, ap);
va_end(ap);
g_VideoInitialize.pLog(Msg, FALSE);
Console::Print(Msg);
}
#endif

View File

@ -24,19 +24,10 @@
#include "VideoCommon.h" #include "VideoCommon.h"
#include "pluginspecs_video.h" #include "pluginspecs_video.h"
#include "ConsoleWindow.h"
// Compile without WxWidgets in Windows to, for debugging purposes
//#define HAVE_WX 0
// Turns file logging on and off
extern bool LocalLogFile;
// A global plugin specification // A global plugin specification
extern PLUGIN_GLOBALS* globals; extern PLUGIN_GLOBALS* globals;
void OpenConsole(); //void OpenConsole();
void CloseConsole(); //void CloseConsole();
#endif // _GLOBALS_H #endif // _GLOBALS_H

View File

@ -41,8 +41,8 @@
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// Declarations and definitions // Declarations and definitions
// ¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯
void OpenConsole(); //void OpenConsole();
void CloseConsole(); //void CloseConsole();
HINSTANCE g_hInstance; HINSTANCE g_hInstance;

View File

@ -972,7 +972,7 @@ void ComputeBackbufferRectangle(TRectangle *rc)
// Adjust the X and Y offset // Adjust the X and Y offset
FloatXOffset = FloatXOffset - (IncreasedWidth / 2.0 / WidthRatio / Ratio); FloatXOffset = FloatXOffset - (IncreasedWidth / 2.0 / WidthRatio / Ratio);
FloatYOffset = FloatYOffset - (IncreasedHeight / 2.0 / HeightRatio / Ratio); FloatYOffset = FloatYOffset - (IncreasedHeight / 2.0 / HeightRatio / Ratio);
//Console::Print("Crop Ratio:%1.2f IncreasedHeight:%3.0f YOffset:%3.0f\n", Ratio, IncreasedHeight, FloatYOffset); //DEBUG_LOG(CONSOLE, "Crop Ratio:%1.2f IncreasedHeight:%3.0f YOffset:%3.0f\n", Ratio, IncreasedHeight, FloatYOffset);
} }
// round(float) = floor(float + 0.5) // round(float) = floor(float + 0.5)
@ -1410,15 +1410,15 @@ void UpdateViewport()
GetWindowRect(Child, &RcChild); GetWindowRect(Child, &RcChild);
//Console::ClearScreen(); //Console::ClearScreen();
Console::Print("----------------------------------------------------------------\n"); DEBUG_LOG(CONSOLE, "----------------------------------------------------------------\n");
Console::Print("Top window: X:%03i Y:%03i Width:%03i Height:%03i\n", RcTop.left, RcTop.top, RcTop.right - RcTop.left, RcTop.bottom - RcTop.top); DEBUG_LOG(CONSOLE, "Top window: X:%03i Y:%03i Width:%03i Height:%03i\n", RcTop.left, RcTop.top, RcTop.right - RcTop.left, RcTop.bottom - RcTop.top);
Console::Print("Parent window: X:%03i Y:%03i Width:%03i Height:%03i\n", RcParent.left, RcParent.top, RcParent.right - RcParent.left, RcParent.bottom - RcParent.top); DEBUG_LOG(CONSOLE, "Parent window: X:%03i Y:%03i Width:%03i Height:%03i\n", RcParent.left, RcParent.top, RcParent.right - RcParent.left, RcParent.bottom - RcParent.top);
Console::Print("Child window: X:%03i Y:%03i Width:%03i Height:%03i\n", RcChild.left, RcChild.top, RcChild.right - RcChild.left, RcChild.bottom - RcChild.top); DEBUG_LOG(CONSOLE, "Child window: X:%03i Y:%03i Width:%03i Height:%03i\n", RcChild.left, RcChild.top, RcChild.right - RcChild.left, RcChild.bottom - RcChild.top);
Console::Print("----------------------------------------------------------------\n"); DEBUG_LOG(CONSOLE, "----------------------------------------------------------------\n");
Console::Print("Res. MValue: X:%f Y:%f XOffs:%f YOffs:%f\n", OpenGL_GetXmax(), OpenGL_GetYmax(), OpenGL_GetXoff(), OpenGL_GetYoff()); DEBUG_LOG(CONSOLE, "Res. MValue: X:%f Y:%f XOffs:%f YOffs:%f\n", OpenGL_GetXmax(), OpenGL_GetYmax(), OpenGL_GetXoff(), OpenGL_GetYoff());
Console::Print("GLViewPort: X:%03i Y:%03i Width:%03i Height:%03i\n", GLx, GLy, GLWidth, GLHeight); DEBUG_LOG(CONSOLE, "GLViewPort: X:%03i Y:%03i Width:%03i Height:%03i\n", GLx, GLy, GLWidth, GLHeight);
Console::Print("GLDepthRange: Near:%f Far:%f\n", GLNear, GLFar); DEBUG_LOG(CONSOLE, "GLDepthRange: Near:%f Far:%f\n", GLNear, GLFar);
Console::Print("GLScissor: X:%03i Y:%03i Width:%03i Height:%03i\n", GLScissorX, GLScissorY, GLScissorW, GLScissorH); DEBUG_LOG(CONSOLE, "GLScissor: X:%03i Y:%03i Width:%03i Height:%03i\n", GLScissorX, GLScissorY, GLScissorW, GLScissorH);
Console::Print("----------------------------------------------------------------\n"); DEBUG_LOG(CONSOLE, "----------------------------------------------------------------\n");
*/ */
} }

View File

@ -59,7 +59,7 @@
// Definitions // Definitions
// -------------------------- // --------------------------
SVideoInitialize g_VideoInitialize; SVideoInitialize g_VideoInitialize;
PLUGIN_GLOBALS* globals; PLUGIN_GLOBALS* globals = NULL;
// Logging // Logging
int GLScissorX, GLScissorY, GLScissorW, GLScissorH; int GLScissorX, GLScissorY, GLScissorW, GLScissorH;
@ -95,6 +95,8 @@ void GetDllInfo (PLUGIN_INFO* _PluginInfo)
void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals)
{ {
globals = _pPluginGlobals;
LogManager::SetInstance((LogManager *)globals->logManager);
} }
// This is used for the fuctions right below here, in DllConfig() // This is used for the fuctions right below here, in DllConfig()
@ -318,22 +320,6 @@ void Video_ExitLoop()
} }
///////////////////////// /////////////////////////
void DebugLog(const char* _fmt, ...)
{
#if defined(_DEBUG) || defined(DEBUGFAST)
char* Msg = (char*)alloca(strlen(_fmt)+512);
va_list ap;
va_start( ap, _fmt );
vsnprintf( Msg, strlen(_fmt)+512, _fmt, ap );
va_end( ap );
g_VideoInitialize.pLog(Msg, FALSE);
#endif
}
void Video_Screenshot(const char *_szFilename) void Video_Screenshot(const char *_szFilename)
{ {
Renderer::SetScreenshot(_szFilename); Renderer::SetScreenshot(_szFilename);

View File

@ -244,21 +244,6 @@ void Video_EnterLoop()
Fifo_EnterLoop(g_VideoInitialize); Fifo_EnterLoop(g_VideoInitialize);
} }
void DebugLog(const char* _fmt, ...)
{
#if defined(_DEBUG) || defined(DEBUGFAST)
char* Msg = (char*)alloca(strlen(_fmt)+512);
va_list ap;
va_start( ap, _fmt );
vsnprintf( Msg, strlen(_fmt)+512, _fmt, ap );
va_end( ap );
g_VideoInitialize.pLog(Msg, FALSE);
#endif
}
bool ScreenShot(TCHAR *File) bool ScreenShot(TCHAR *File)
{ {
char str[64]; char str[64];

View File

@ -214,7 +214,7 @@ void Config::Load(bool ChangePad)
// ============================= // =============================
// Logging // Logging
Console::Print("Load()\n"); INFO_LOG(CONSOLE, "Load()\n");
} }
void Config::Save(int Slot) void Config::Save(int Slot)
@ -352,5 +352,5 @@ void Config::Save(int Slot)
// ============================= // =============================
// Logging // Logging
Console::Print("Save()\n"); INFO_LOG(CONSOLE, "Save()\n");
} }

View File

@ -265,7 +265,7 @@ void ConfigDialog::OnKeyDown(wxKeyEvent& event)
// Input button clicked // Input button clicked
void ConfigDialog::OnButtonClick(wxCommandEvent& event) void ConfigDialog::OnButtonClick(wxCommandEvent& event)
{ {
//Console::Print("OnButtonClick: %i\n", g_Pressed); //INFO_LOG(CONSOLE, "OnButtonClick: %i\n", g_Pressed);
// Don't allow space to start a new Press Key option, that will interfer with setting a key to space // Don't allow space to start a new Press Key option, that will interfer with setting a key to space
if (g_Pressed == WXK_SPACE) { g_Pressed = 0; return; } if (g_Pressed == WXK_SPACE) { g_Pressed = 0; return; }
@ -391,7 +391,7 @@ void ConfigDialog::DoSave(bool ChangePad, int Slot)
// Then change it back to "" // Then change it back to ""
ToBlank(); ToBlank();
Console::Print("WiiMoteEmu::PadMapping[%i].ID = %i\n", Page, m_Joyname[Page]->GetSelection()); INFO_LOG(CONSOLE, "WiiMoteEmu::PadMapping[%i].ID = %i\n", Page, m_Joyname[Page]->GetSelection());
} }
////////////////////////////////////// //////////////////////////////////////
@ -1439,7 +1439,7 @@ void ConfigDialog::DoConnectReal()
} }
else else
{ {
Console::Print("Post Message: %i\n", g_RealWiiMoteInitialized); INFO_LOG(CONSOLE, "Post Message: %i\n", g_RealWiiMoteInitialized);
if (g_RealWiiMoteInitialized) if (g_RealWiiMoteInitialized)
{ {
WiiMoteReal::Shutdown(); WiiMoteReal::Shutdown();
@ -1471,11 +1471,11 @@ void ConfigDialog::DoUseReal()
if (g_Config.bNunchuckConnected || g_Config.bClassicControllerConnected) if (g_Config.bNunchuckConnected || g_Config.bClassicControllerConnected)
UsingExtension = true; UsingExtension = true;
Console::Print("\nDoUseReal() Connect extension: %i\n", !UsingExtension); INFO_LOG(CONSOLE, "\nDoUseReal() Connect extension: %i\n", !UsingExtension);
DoExtensionConnectedDisconnected(UsingExtension ? 0 : 1); DoExtensionConnectedDisconnected(UsingExtension ? 0 : 1);
UsingExtension = !UsingExtension; UsingExtension = !UsingExtension;
Console::Print("\nDoUseReal() Connect extension: %i\n", !UsingExtension); INFO_LOG(CONSOLE, "\nDoUseReal() Connect extension: %i\n", !UsingExtension);
DoExtensionConnectedDisconnected(UsingExtension ? 1 : 0); DoExtensionConnectedDisconnected(UsingExtension ? 1 : 0);
if(g_EmulatorRunning) if(g_EmulatorRunning)
@ -1650,7 +1650,7 @@ void ConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
if (m_RecordHotKeyNunchuck[i]->GetSelection() == m_RecordHotKeyNunchuck[CurrentChoiceBox]->GetSelection()) m_RecordHotKeyNunchuck[i]->SetSelection(10); if (m_RecordHotKeyNunchuck[i]->GetSelection() == m_RecordHotKeyNunchuck[CurrentChoiceBox]->GetSelection()) m_RecordHotKeyNunchuck[i]->SetSelection(10);
if (m_RecordHotKeyIR[i]->GetSelection() == m_RecordHotKeyIR[CurrentChoiceBox]->GetSelection()) m_RecordHotKeyIR[i]->SetSelection(10); if (m_RecordHotKeyIR[i]->GetSelection() == m_RecordHotKeyIR[CurrentChoiceBox]->GetSelection()) m_RecordHotKeyIR[i]->SetSelection(10);
//Console::Print("HotKey: %i %i\n", //INFO_LOG(CONSOLE, "HotKey: %i %i\n",
// m_RecordHotKey[i]->GetSelection(), m_RecordHotKey[CurrentChoiceBox]->GetSelection()); // m_RecordHotKey[i]->GetSelection(), m_RecordHotKey[CurrentChoiceBox]->GetSelection());
} }
break; break;
@ -1710,7 +1710,7 @@ void ConfigDialog::UpdateControls()
// ------------- // -------------
void ConfigDialog::UpdateGUI(int Slot) void ConfigDialog::UpdateGUI(int Slot)
{ {
//Console::Print("UpdateGUI: \n"); //INFO_LOG(CONSOLE, "UpdateGUI: \n");
// Update the gamepad settings // Update the gamepad settings
UpdateGUIButtonMapping(Page); UpdateGUIButtonMapping(Page);

View File

@ -61,12 +61,12 @@ void ConfigDialog::PadOpen(int Open) // Open for slot 1, 2, 3 or 4
// Check that we got a good pad // Check that we got a good pad
if (!WiiMoteEmu::joyinfo.at(WiiMoteEmu::PadMapping[Open].ID).Good) if (!WiiMoteEmu::joyinfo.at(WiiMoteEmu::PadMapping[Open].ID).Good)
{ {
Console::Print("A bad pad was selected\n"); INFO_LOG(CONSOLE, "A bad pad was selected\n");
WiiMoteEmu::PadState[Open].joy = NULL; WiiMoteEmu::PadState[Open].joy = NULL;
return; return;
} }
Console::Print("Update the Slot %i handle to Id %i\n", Page, WiiMoteEmu::PadMapping[Open].ID); INFO_LOG(CONSOLE, "Update the Slot %i handle to Id %i\n", Page, WiiMoteEmu::PadMapping[Open].ID);
WiiMoteEmu::PadState[Open].joy = SDL_JoystickOpen(WiiMoteEmu::PadMapping[Open].ID); WiiMoteEmu::PadState[Open].joy = SDL_JoystickOpen(WiiMoteEmu::PadMapping[Open].ID);
} }
void ConfigDialog::PadClose(int Close) // Close for slot 1, 2, 3 or 4 void ConfigDialog::PadClose(int Close) // Close for slot 1, 2, 3 or 4
@ -118,7 +118,7 @@ void ConfigDialog::SetButtonTextAll(int id, char text[128])
void ConfigDialog::SaveButtonMappingAll(int Slot) void ConfigDialog::SaveButtonMappingAll(int Slot)
{ {
//Console::Print("SaveButtonMappingAll()\n"); //INFO_LOG(CONSOLE, "SaveButtonMappingAll()\n");
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
@ -211,7 +211,7 @@ void ConfigDialog::UpdateGUIButtonMapping(int controller)
m_bCcRd[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.Rd).c_str())); m_bCcRd[controller]->SetLabel(wxString::FromAscii(InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Cc.Rd).c_str()));
#endif #endif
//Console::Print("m_bWmA[%i] = %i = %s\n", controller, WiiMoteEmu::PadMapping[controller].Wm.A, InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.A).c_str()); //INFO_LOG(CONSOLE, "m_bWmA[%i] = %i = %s\n", controller, WiiMoteEmu::PadMapping[controller].Wm.A, InputCommon::VKToString(WiiMoteEmu::PadMapping[controller].Wm.A).c_str());
} }
/* Populate the PadMapping array with the dialog items settings (for example /* Populate the PadMapping array with the dialog items settings (for example
@ -257,7 +257,7 @@ void ConfigDialog::SaveButtonMapping(int controller, bool DontChangeId, int From
m_AnalogTriggerL[FromSlot]->GetValue().ToLong(&value); WiiMoteEmu::PadMapping[controller].Axis.Tl = value; m_AnalogTriggerL[FromSlot]->GetValue().ToLong(&value); WiiMoteEmu::PadMapping[controller].Axis.Tl = value;
m_AnalogTriggerR[FromSlot]->GetValue().ToLong(&value); WiiMoteEmu::PadMapping[controller].Axis.Tr = value; m_AnalogTriggerR[FromSlot]->GetValue().ToLong(&value); WiiMoteEmu::PadMapping[controller].Axis.Tr = value;
//Console::Print("WiiMoteEmu::PadMapping[%i].ID = %i, m_Joyname[%i]->GetSelection() = %i\n", //INFO_LOG(CONSOLE, "WiiMoteEmu::PadMapping[%i].ID = %i, m_Joyname[%i]->GetSelection() = %i\n",
// controller, WiiMoteEmu::PadMapping[controller].ID, FromSlot, m_Joyname[FromSlot]->GetSelection()); // controller, WiiMoteEmu::PadMapping[controller].ID, FromSlot, m_Joyname[FromSlot]->GetSelection());
// Replace "-1" with "" // Replace "-1" with ""
@ -320,7 +320,7 @@ void ConfigDialog::SaveKeyboardMapping(int Controller, int Id, int Key)
case IDB_CC_RD: WiiMoteEmu::PadMapping[Controller].Cc.Rd = Key; break; case IDB_CC_RD: WiiMoteEmu::PadMapping[Controller].Cc.Rd = Key; break;
} }
//Console::Print("WiiMoteEmu::PadMapping[%i].Wm.A = %i", Controller, WiiMoteEmu::PadMapping[Controller].Wm.A); //INFO_LOG(CONSOLE, "WiiMoteEmu::PadMapping[%i].Wm.A = %i", Controller, WiiMoteEmu::PadMapping[Controller].Wm.A);
} }
// Replace the harder to understand -1 with "" for the sake of user friendliness // Replace the harder to understand -1 with "" for the sake of user friendliness
@ -421,14 +421,14 @@ void ConfigDialog::SetButtonText(int id, char text[128], int _Page)
case IDB_CC_RD: m_bCcRd[controller]->SetLabel(wxString::FromAscii(text)); break; case IDB_CC_RD: m_bCcRd[controller]->SetLabel(wxString::FromAscii(text)); break;
default: break; default: break;
} }
//Console::Print("SetButtonText: %s\n", text); //INFO_LOG(CONSOLE, "SetButtonText: %s\n", text);
} }
// Get the text in the textbox for the buttons // Get the text in the textbox for the buttons
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
wxString ConfigDialog::GetButtonText(int id, int _Page) wxString ConfigDialog::GetButtonText(int id, int _Page)
{ {
//Console::Print("GetButtonText: %i\n", id); //INFO_LOG(CONSOLE, "GetButtonText: %i\n", id);
// Set controller value // Set controller value
int controller; int controller;
@ -510,7 +510,7 @@ void ConfigDialog::DoGetButtons(int GetId)
bool Stop = false; // Stop the timer bool Stop = false; // Stop the timer
// ======================= // =======================
//Console::Print("Before (%i) Id:%i %i IsRunning:%i\n", //INFO_LOG(CONSOLE, "Before (%i) Id:%i %i IsRunning:%i\n",
// GetButtonWaitingTimer, GetButtonWaitingID, GetId, m_ButtonMappingTimer->IsRunning()); // GetButtonWaitingTimer, GetButtonWaitingID, GetId, m_ButtonMappingTimer->IsRunning());
// If the Id has changed or the timer is not running we should start one // If the Id has changed or the timer is not running we should start one
@ -539,7 +539,7 @@ void ConfigDialog::DoGetButtons(int GetId)
#if wxUSE_TIMER #if wxUSE_TIMER
m_ButtonMappingTimer->Start( floor((double)(1000 / TimesPerSecond)) ); m_ButtonMappingTimer->Start( floor((double)(1000 / TimesPerSecond)) );
#endif #endif
Console::Print("Timer Started for Pad:%i GetId:%i\n" INFO_LOG(CONSOLE, "Timer Started for Pad:%i GetId:%i\n"
"Allowed input is Axis:%i LeftRight:%i XInput:%i Button:%i Hat:%i\n", "Allowed input is Axis:%i LeftRight:%i XInput:%i Button:%i Hat:%i\n",
WiiMoteEmu::PadMapping[Controller].ID, GetId, WiiMoteEmu::PadMapping[Controller].ID, GetId,
Axis, LeftRight, XInput, Button, Hat); Axis, LeftRight, XInput, Button, Hat);
@ -578,7 +578,7 @@ void ConfigDialog::DoGetButtons(int GetId)
SetButtonText(GetId, format); SetButtonText(GetId, format);
/* Debug /* Debug
Console::Print("Keyboard: %i\n", g_Pressed);*/ INFO_LOG(CONSOLE, "Keyboard: %i\n", g_Pressed);*/
} }
// Time's up // Time's up
@ -610,7 +610,7 @@ void ConfigDialog::DoGetButtons(int GetId)
several disabled slots. */ several disabled slots. */
SaveButtonMappingAll(Controller); SaveButtonMappingAll(Controller);
Console::Print("Timer Stopped for Pad:%i GetId:%i\n", INFO_LOG(CONSOLE, "Timer Stopped for Pad:%i GetId:%i\n",
WiiMoteEmu::PadMapping[Controller].ID, GetId); WiiMoteEmu::PadMapping[Controller].ID, GetId);
} }
@ -630,7 +630,7 @@ void ConfigDialog::DoGetButtons(int GetId)
// Debugging // Debugging
/* /*
Console::Print("Change: %i %i %i %i '%s' '%s' '%s' '%s'\n", INFO_LOG(CONSOLE, "Change: %i %i %i %i '%s' '%s' '%s' '%s'\n",
WiiMoteEmu::PadMapping[0].halfpress, WiiMoteEmu::PadMapping[1].halfpress, WiiMoteEmu::PadMapping[2].halfpress, WiiMoteEmu::PadMapping[3].halfpress, WiiMoteEmu::PadMapping[0].halfpress, WiiMoteEmu::PadMapping[1].halfpress, WiiMoteEmu::PadMapping[2].halfpress, WiiMoteEmu::PadMapping[3].halfpress,
m_JoyButtonHalfpress[0]->GetValue().c_str(), m_JoyButtonHalfpress[1]->GetValue().c_str(), m_JoyButtonHalfpress[2]->GetValue().c_str(), m_JoyButtonHalfpress[3]->GetValue().c_str() m_JoyButtonHalfpress[0]->GetValue().c_str(), m_JoyButtonHalfpress[1]->GetValue().c_str(), m_JoyButtonHalfpress[2]->GetValue().c_str(), m_JoyButtonHalfpress[3]->GetValue().c_str()
);*/ );*/
@ -657,7 +657,7 @@ void ConfigDialog::Convert2Box(int &x)
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void ConfigDialog::PadGetStatus() void ConfigDialog::PadGetStatus()
{ {
//Console::Print("SDL_WasInit: %i\n", SDL_WasInit(0)); //INFO_LOG(CONSOLE, "SDL_WasInit: %i\n", SDL_WasInit(0));
/* Return if it's not detected. The ID should never be less than zero here, it can only be that /* Return if it's not detected. The ID should never be less than zero here, it can only be that
because of a manual ini file change, but we make that check anway. */ because of a manual ini file change, but we make that check anway. */

View File

@ -37,7 +37,7 @@
void ConfigDialog::LoadFile() void ConfigDialog::LoadFile()
{ {
Console::Print("LoadFile()\n"); INFO_LOG(CONSOLE, "LoadFile()\n");
IniFile file; IniFile file;
file.Load(FULL_CONFIG_DIR "WiimoteMovement.ini"); file.Load(FULL_CONFIG_DIR "WiimoteMovement.ini");
@ -79,7 +79,7 @@ void ConfigDialog::LoadFile()
} }
void ConfigDialog::SaveFile() void ConfigDialog::SaveFile()
{ {
Console::Print("SaveFile\n"); INFO_LOG(CONSOLE, "SaveFile\n");
IniFile file; IniFile file;
file.Load(FULL_CONFIG_DIR "WiimoteMovement.ini"); file.Load(FULL_CONFIG_DIR "WiimoteMovement.ini");
@ -115,7 +115,7 @@ void ConfigDialog::SaveFile()
} }
file.Save(FULL_CONFIG_DIR "WiimoteMovement.ini"); file.Save(FULL_CONFIG_DIR "WiimoteMovement.ini");
Console::Print("SaveFile()\n"); INFO_LOG(CONSOLE, "SaveFile()\n");
} }
///////////////////////////// /////////////////////////////
@ -371,7 +371,7 @@ void ConfigDialog::ConvertToString()
TmpStr += StringFromFormat("%s", m_vRecording.at(i).z >= 0 ? StringFromFormat("+%03i", m_vRecording.at(i).z).c_str() : StringFromFormat("%04i", m_vRecording.at(i).z).c_str()); TmpStr += StringFromFormat("%s", m_vRecording.at(i).z >= 0 ? StringFromFormat("+%03i", m_vRecording.at(i).z).c_str() : StringFromFormat("%04i", m_vRecording.at(i).z).c_str());
if (i < ((int)m_vRecording.size() - 1)) TmpStr += ","; if (i < ((int)m_vRecording.size() - 1)) TmpStr += ",";
//Console::Print("%s\n", TmpStr.c_str()); //INFO_LOG(CONSOLE, "%s\n", TmpStr.c_str());
// Write the IR data // Write the IR data
TmpIR += ArrayToString(m_vRecording.at(i).IR, IRBytes, 0, 30, false); TmpIR += ArrayToString(m_vRecording.at(i).IR, IRBytes, 0, 30, false);
@ -391,7 +391,7 @@ void ConfigDialog::ConvertToString()
} }
// Debug // Debug
Console::Print("Saved: [%i / %i] %03i %03i %03i\n", i, m_vRecording.size(), m_vRecording.at(i).x, m_vRecording.at(i).y, m_vRecording.at(i).z); INFO_LOG(CONSOLE, "Saved: [%i / %i] %03i %03i %03i\n", i, m_vRecording.size(), m_vRecording.at(i).x, m_vRecording.at(i).y, m_vRecording.at(i).z);
} }
// Recordings per second // Recordings per second
@ -424,7 +424,7 @@ void ConfigDialog::ConvertToString()
file.Save(FULL_CONFIG_DIR "WiimoteMovement.ini"); file.Save(FULL_CONFIG_DIR "WiimoteMovement.ini");
Console::Print("Save recording to WiimoteMovement.ini\n"); INFO_LOG(CONSOLE, "Save recording to WiimoteMovement.ini\n");
} }
// Timeout the recording // Timeout the recording
@ -493,7 +493,7 @@ void ConfigDialog::DoRecordA(bool Pressed)
else else
{ {
m_RecordButton[m_iRecordTo]->SetLabel(wxT("Done")); m_RecordButton[m_iRecordTo]->SetLabel(wxT("Done"));
Console::Print("Done: %i %i\n", m_bWaitForRecording, m_bRecording); INFO_LOG(CONSOLE, "Done: %i %i\n", m_bWaitForRecording, m_bRecording);
//m_bAllowA = true; //m_bAllowA = true;
ConvertToString(); ConvertToString();
} }
@ -504,11 +504,11 @@ void ConfigDialog::DoRecordA(bool Pressed)
void ConfigDialog::DoRecordMovement(int _x, int _y, int _z, const u8 *_IR, int _IRBytes) void ConfigDialog::DoRecordMovement(int _x, int _y, int _z, const u8 *_IR, int _IRBytes)
{ {
//std::string Tmp1 = ArrayToString(_IR, 20, 0, 30); //std::string Tmp1 = ArrayToString(_IR, 20, 0, 30);
//Console::Print("DoRecordMovement: %s\n", Tmp1.c_str()); //INFO_LOG(CONSOLE, "DoRecordMovement: %s\n", Tmp1.c_str());
if (!m_bRecording) return; if (!m_bRecording) return;
//Console::Print("DoRecordMovement: %03i %03i %03i\n", _x, _y, _z); //INFO_LOG(CONSOLE, "DoRecordMovement: %03i %03i %03i\n", _x, _y, _z);
SRecording Tmp; SRecording Tmp;
Tmp.x = _x; Tmp.x = _x;

View File

@ -95,11 +95,11 @@ void WmDataReporting(u16 _channelID, wm_data_reporting* dr)
DEBUG_LOG(WII_IPC_WIIMOTE, " Continuous: %x", dr->continuous); DEBUG_LOG(WII_IPC_WIIMOTE, " Continuous: %x", dr->continuous);
DEBUG_LOG(WII_IPC_WIIMOTE, " All The Time: %x (not only on data change)", dr->all_the_time); DEBUG_LOG(WII_IPC_WIIMOTE, " All The Time: %x (not only on data change)", dr->all_the_time);
DEBUG_LOG(WII_IPC_WIIMOTE, " Mode: 0x%02x", dr->mode); DEBUG_LOG(WII_IPC_WIIMOTE, " Mode: 0x%02x", dr->mode);
Console::Print("Data reporting:\n"); INFO_LOG(CONSOLE, "Data reporting:\n");
Console::Print(" Continuous: %x\n", dr->continuous); INFO_LOG(CONSOLE, " Continuous: %x\n", dr->continuous);
Console::Print(" All The Time: %x (not only on data change)\n", dr->all_the_time); INFO_LOG(CONSOLE, " All The Time: %x (not only on data change)\n", dr->all_the_time);
Console::Print(" Mode: 0x%02x\n", dr->mode); INFO_LOG(CONSOLE, " Mode: 0x%02x\n", dr->mode);
Console::Print(" Channel: 0x%04x\n", _channelID); INFO_LOG(CONSOLE, " Channel: 0x%04x\n", _channelID);
g_ReportingMode = dr->mode; g_ReportingMode = dr->mode;
g_ReportingChannel = _channelID; g_ReportingChannel = _channelID;

View File

@ -32,8 +32,6 @@
#include "Logging.h" // for startConsoleWin, Console::Print, GetConsoleHwnd #include "Logging.h" // for startConsoleWin, Console::Print, GetConsoleHwnd
extern SWiimoteInitialize g_WiimoteInitialize; extern SWiimoteInitialize g_WiimoteInitialize;
//extern void __Log(int log, const char *format, ...);
//extern void __Log(int log, int v, const char *format, ...);
namespace WiiMoteEmu namespace WiiMoteEmu
{ {

Some files were not shown because too many files have changed in this diff Show More