Revert back to LogTypes. Fixes issue 3668.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6580 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice 2010-12-14 17:52:01 +00:00
parent 7c0e08b0e7
commit 35fef1f173
21 changed files with 172 additions and 159 deletions

View File

@ -245,14 +245,14 @@ void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool
COORD Coo = GetCoordinates(OldCursor, LBufWidth);
SetConsoleCursorPosition(hConsole, Coo);
if (SLog.length() > 0) Log(NOTICE_LEVEL, SLog.c_str());
if (SLog.length() > 0) Log(LogTypes::LNOTICE, SLog.c_str());
// Resize the window too
if (Resize) MoveWindow(GetConsoleWindow(), Left,Top, (Width + 100),Height, true);
#endif
}
void ConsoleListener::Log(enum LOG_LEVEL Level, const char *Text)
void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text)
{
#if defined(_WIN32)
/*

View File

@ -40,7 +40,7 @@ public:
#ifdef _WIN32
COORD GetCoordinates(int BytesRead, int BufferWidth);
#endif
void Log(enum LOG_LEVEL level, const char *Text);
void Log(LogTypes::LOG_LEVELS, const char *Text);
void ClearScreen(bool Cursor = true);
const char *getName() const { return "Console"; }

View File

@ -18,6 +18,15 @@
#ifndef _LOG_H_
#define _LOG_H_
#define NOTICE_LEVEL 1 // VERY important information that is NOT errors. Like startup and OSReports.
#define ERROR_LEVEL 2 // Critical errors
#define WARNING_LEVEL 3 // Something is suspicious.
#define INFO_LEVEL 4 // General information.
#define DEBUG_LEVEL 5 // Detailed debugging - might make things slow.
namespace LogTypes
{
enum LOG_TYPE {
ACTIONREPLAY,
AUDIO,
@ -66,16 +75,21 @@ enum LOG_TYPE {
NUMBER_OF_LOGS // Must be last
};
enum LOG_LEVEL {
NOTICE_LEVEL = 1, // VERY important information that is NOT errors. Like startup and OSReports
ERROR_LEVEL = 2, // Critical errors
WARNING_LEVEL = 3, // Something is suspicious
INFO_LEVEL = 4, // General information
DEBUG_LEVEL = 5, // Detailed debugging - might make things slow
// FIXME: should this be removed?
enum LOG_LEVELS {
LNOTICE = NOTICE_LEVEL,
LERROR = ERROR_LEVEL,
LWARNING = WARNING_LEVEL,
LINFO = INFO_LEVEL,
LDEBUG = DEBUG_LEVEL,
};
extern "C"
void GenericLog(enum LOG_LEVEL level, enum LOG_TYPE type,
#define LOGTYPES_LEVELS LogTypes::LOG_LEVELS
#define LOGTYPES_TYPE LogTypes::LOG_TYPE
} // namespace
void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type,
const char *file, int line, const char *fmt, ...)
#ifdef __GNUC__
__attribute__((format(printf, 5, 6)))
@ -98,15 +112,13 @@ void GenericLog(enum LOG_LEVEL level, enum LOG_TYPE type,
if (v <= MAX_LOGLEVEL) \
GenericLog(v, t, __FILE__, __LINE__, __VA_ARGS__); \
}
//#define GENERIC_LOG(t, v, ...) { if (v <= MAX_LOGLEVEL)
// GenericLog(v, t, __FILE__, __LINE__, __VA_ARGS__); }
#endif
#define ERROR_LOG(t,...) { GENERIC_LOG(t, ERROR_LEVEL, __VA_ARGS__) }
#define WARN_LOG(t,...) { GENERIC_LOG(t, WARNING_LEVEL, __VA_ARGS__) }
#define NOTICE_LOG(t,...) { GENERIC_LOG(t, NOTICE_LEVEL, __VA_ARGS__) }
#define INFO_LOG(t,...) { GENERIC_LOG(t, INFO_LEVEL, __VA_ARGS__) }
#define DEBUG_LOG(t,...) { GENERIC_LOG(t, DEBUG_LEVEL, __VA_ARGS__) }
#define ERROR_LOG(t,...) { GENERIC_LOG(LogTypes::t, LogTypes::LERROR, __VA_ARGS__) }
#define WARN_LOG(t,...) { GENERIC_LOG(LogTypes::t, LogTypes::LWARNING, __VA_ARGS__) }
#define NOTICE_LOG(t,...) { GENERIC_LOG(LogTypes::t, LogTypes::LNOTICE, __VA_ARGS__) }
#define INFO_LOG(t,...) { GENERIC_LOG(LogTypes::t, LogTypes::LINFO, __VA_ARGS__) }
#define DEBUG_LOG(t,...) { GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, __VA_ARGS__) }
#if MAX_LOGLEVEL >= DEBUG_LEVEL
#define _dbg_assert_(_t_, _a_) \

View File

@ -23,7 +23,7 @@
#include "Thread.h"
#include "FileUtil.h"
void GenericLog(enum LOG_LEVEL level, enum LOG_TYPE type,
void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
const char *file, int line, const char* fmt, ...)
{
va_list args;
@ -40,54 +40,54 @@ LogManager::LogManager() {
logMutex = new Common::CriticalSection(1);
// create log files
m_Log[MASTER_LOG] = new LogContainer("*", "Master Log");
m_Log[BOOT] = new LogContainer("BOOT", "Boot");
m_Log[COMMON] = new LogContainer("COMMON", "Common");
m_Log[DISCIO] = new LogContainer("DIO", "Disc IO");
m_Log[FILEMON] = new LogContainer("FileMon", "File Monitor");
m_Log[PAD] = new LogContainer("PAD", "Pad");
m_Log[PIXELENGINE] = new LogContainer("PE", "PixelEngine");
m_Log[COMMANDPROCESSOR] = new LogContainer("CP", "CommandProc");
m_Log[VIDEOINTERFACE] = new LogContainer("VI", "VideoInt");
m_Log[SERIALINTERFACE] = new LogContainer("SI", "SerialInt");
m_Log[PROCESSORINTERFACE] = new LogContainer("PI", "ProcessorInt");
m_Log[MEMMAP] = new LogContainer("MI", "MI & memmap");
m_Log[SP1] = new LogContainer("SP1", "Serial Port 1");
m_Log[STREAMINGINTERFACE] = new LogContainer("Stream", "StreamingInt");
m_Log[DSPINTERFACE] = new LogContainer("DSP", "DSPInterface");
m_Log[DVDINTERFACE] = new LogContainer("DVD", "DVDInterface");
m_Log[GPFIFO] = new LogContainer("GP", "GPFifo");
m_Log[EXPANSIONINTERFACE] = new LogContainer("EXI", "ExpansionInt");
m_Log[AUDIO_INTERFACE] = new LogContainer("AI", "AudioInt");
m_Log[POWERPC] = new LogContainer("PowerPC", "IBM CPU");
m_Log[OSHLE] = new LogContainer("HLE", "HLE");
m_Log[DSPHLE] = new LogContainer("DSPHLE", "DSP HLE");
m_Log[DSPLLE] = new LogContainer("DSPLLE", "DSP LLE");
m_Log[DSP_MAIL] = new LogContainer("DSPMails", "DSP Mails");
m_Log[VIDEO] = new LogContainer("Video", "Video Plugin");
m_Log[AUDIO] = new LogContainer("Audio", "Audio Plugin");
m_Log[DYNA_REC] = new LogContainer("JIT", "Dynamic Recompiler");
m_Log[CONSOLE] = new LogContainer("CONSOLE", "Dolphin Console");
m_Log[OSREPORT] = new LogContainer("OSREPORT", "OSReport");
m_Log[WIIMOTE] = new LogContainer("Wiimote", "Wiimote Plugin");
m_Log[WII_IOB] = new LogContainer("WII_IOB", "WII IO Bridge");
m_Log[WII_IPC] = new LogContainer("WII_IPC", "WII IPC");
m_Log[WII_IPC_HLE] = new LogContainer("WII_IPC_HLE", "WII IPC HLE");
m_Log[WII_IPC_DVD] = new LogContainer("WII_IPC_DVD", "WII IPC DVD");
m_Log[WII_IPC_ES] = new LogContainer("WII_IPC_ES", "WII IPC ES");
m_Log[WII_IPC_FILEIO] = new LogContainer("WII_IPC_FILEIO", "WII IPC FILEIO");
m_Log[WII_IPC_SD] = new LogContainer("WII_IPC_SD", "WII IPC SD");
m_Log[WII_IPC_STM] = new LogContainer("WII_IPC_STM", "WII IPC STM");
m_Log[WII_IPC_NET] = new LogContainer("WII_IPC_NET", "WII IPC NET");
m_Log[WII_IPC_WIIMOTE] = new LogContainer("WII_IPC_WIIMOTE", "WII IPC WIIMOTE");
m_Log[ACTIONREPLAY] = new LogContainer("ActionReplay", "ActionReplay");
m_Log[MEMCARD_MANAGER] = new LogContainer("MemCard Manager", "MemCard Manager");
m_Log[NETPLAY] = new LogContainer("NETPLAY", "Netplay");
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::FILEMON] = new LogContainer("FileMon", "File Monitor");
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::PROCESSORINTERFACE] = new LogContainer("PI", "ProcessorInt");
m_Log[LogTypes::MEMMAP] = new LogContainer("MI", "MI & memmap");
m_Log[LogTypes::SP1] = new LogContainer("SP1", "Serial Port 1");
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::POWERPC] = new LogContainer("PowerPC", "IBM CPU");
m_Log[LogTypes::OSHLE] = new LogContainer("HLE", "HLE");
m_Log[LogTypes::DSPHLE] = new LogContainer("DSPHLE", "DSP HLE");
m_Log[LogTypes::DSPLLE] = new LogContainer("DSPLLE", "DSP LLE");
m_Log[LogTypes::DSP_MAIL] = new LogContainer("DSPMails", "DSP Mails");
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 Plugin");
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_STM] = new LogContainer("WII_IPC_STM", "WII IPC STM");
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");
m_Log[LogTypes::MEMCARD_MANAGER] = new LogContainer("MemCard Manager", "MemCard Manager");
m_Log[LogTypes::NETPLAY] = new LogContainer("NETPLAY", "Netplay");
m_fileLog = new FileLogListener(File::GetUserPath(F_MAINLOG_IDX));
m_consoleLog = new ConsoleListener();
for (int i = 0; i < NUMBER_OF_LOGS; ++i) {
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);
@ -95,12 +95,12 @@ LogManager::LogManager() {
}
LogManager::~LogManager() {
for (int i = 0; i < NUMBER_OF_LOGS; ++i) {
m_logManager->removeListener(i, m_fileLog);
m_logManager->removeListener(i, m_consoleLog);
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);
}
for (int i = 0; i < NUMBER_OF_LOGS; ++i)
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
delete m_Log[i];
delete m_fileLog;
@ -108,8 +108,9 @@ LogManager::~LogManager() {
delete logMutex;
}
void LogManager::Log(enum LOG_LEVEL level, enum LOG_TYPE type,
const char *file, int line, const char *format, va_list args) {
void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
const char *file, int line, const char *format,
va_list args) {
char temp[MAX_MSGLEN];
char msg[MAX_MSGLEN * 2];
@ -131,7 +132,7 @@ void LogManager::Log(enum LOG_LEVEL level, enum LOG_TYPE type,
logMutex->Leave();
}
void LogManager::removeListener(int type, LogListener *listener) {
void LogManager::removeListener(LogTypes::LOG_TYPE type, LogListener *listener) {
logMutex->Enter();
m_Log[type]->removeListener(listener);
logMutex->Leave();
@ -152,7 +153,7 @@ LogContainer::LogContainer(const char* shortName, const char* fullName, bool ena
: m_enable(enable) {
strncpy(m_fullName, fullName, 128);
strncpy(m_shortName, shortName, 32);
m_level = MAX_LOGLEVEL;
m_level = LogTypes::LWARNING;
}
// LogContainer
@ -171,7 +172,7 @@ bool LogContainer::isListener(LogListener *listener) const {
return listeners.end() != std::find(listeners.begin(), listeners.end(), listener);
}
void LogContainer::trigger(enum LOG_LEVEL level, const char *msg) {
void LogContainer::trigger(LogTypes::LOG_LEVELS level, const char *msg) {
std::vector<LogListener *>::const_iterator i;
for (i = listeners.begin(); i != listeners.end(); ++i) {
(*i)->Log(level, msg);
@ -190,10 +191,10 @@ FileLogListener::~FileLogListener() {
fclose(m_logfile);
}
void FileLogListener::Log(enum LOG_LEVEL, const char *msg) {
void FileLogListener::Log(LogTypes::LOG_LEVELS, const char *msg) {
if (!m_enable || !isValid())
return;
fwrite(msg, strlen(msg) * sizeof(char), 1, m_logfile);
fwrite(msg, strlen(msg) * sizeof(char), 1, m_logfile);
fflush(m_logfile);
}

View File

@ -33,7 +33,7 @@
class LogListener {
public:
virtual ~LogListener() {}
virtual void Log(enum LOG_LEVEL level, const char *msg) = 0;
virtual void Log(LogTypes::LOG_LEVELS, const char *msg) = 0;
virtual const char *getName() const = 0;
};
@ -42,7 +42,7 @@ public:
FileLogListener(const char *filename);
~FileLogListener();
void Log(enum LOG_LEVEL level, const char *msg);
void Log(LogTypes::LOG_LEVELS, const char *msg);
bool isValid() {
return (m_logfile != NULL);
@ -75,18 +75,18 @@ public:
void addListener(LogListener *listener);
void removeListener(LogListener *listener);
void trigger(enum LOG_LEVEL level, const char *msg);
void trigger(LogTypes::LOG_LEVELS, const char *msg);
bool isEnable() const { return m_enable; }
void setEnable(bool enable) {
m_enable = enable;
}
enum LOG_LEVEL getLevel() const {
LogTypes::LOG_LEVELS getLevel() const {
return m_level;
}
void setLevel(enum LOG_LEVEL level) {
void setLevel(LogTypes::LOG_LEVELS level) {
m_level = level;
}
@ -94,7 +94,7 @@ private:
char m_fullName[128];
char m_shortName[32];
bool m_enable;
enum LOG_LEVEL m_level;
LogTypes::LOG_LEVELS m_level;
std::vector<LogListener *> listeners;
};
@ -109,7 +109,7 @@ namespace Common {
class LogManager : NonCopyable
{
private:
LogContainer *m_Log[NUMBER_OF_LOGS];
LogContainer* m_Log[LogTypes::NUMBER_OF_LOGS];
Common::CriticalSection *logMutex;
FileLogListener *m_fileLog;
ConsoleListener *m_consoleLog;
@ -121,38 +121,38 @@ public:
static u32 GetMaxLevel() { return MAX_LOGLEVEL; }
void Log(enum LOG_LEVEL level, enum LOG_TYPE type,
void Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
const char *file, int line, const char *fmt, va_list args);
void setLogLevel(int type, LOG_LEVEL level) {
void setLogLevel(LogTypes::LOG_TYPE type, LogTypes::LOG_LEVELS level) {
m_Log[type]->setLevel(level);
}
void setEnable(int type, bool enable) {
void setEnable(LogTypes::LOG_TYPE type, bool enable) {
m_Log[type]->setEnable(enable);
}
bool isEnable(int type) {
bool isEnable(LogTypes::LOG_TYPE type) {
return m_Log[type]->isEnable();
}
const char *getShortName(int type) const {
const char *getShortName(LogTypes::LOG_TYPE type) const {
return m_Log[type]->getShortName();
}
const char *getFullName(int type) const {
const char *getFullName(LogTypes::LOG_TYPE type) const {
return m_Log[type]->getFullName();
}
bool isListener(int type, LogListener *listener) const {
bool isListener(LogTypes::LOG_TYPE type, LogListener *listener) const {
return m_Log[type]->isListener(listener);
}
void addListener(int type, LogListener *listener) {
void addListener(LogTypes::LOG_TYPE type, LogListener *listener) {
m_Log[type]->addListener(listener);
}
void removeListener(int type, LogListener *listener);
void removeListener(LogTypes::LOG_TYPE type, LogListener *listener);
FileLogListener *getFileListener() {
return m_fileLog;

View File

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

View File

@ -716,7 +716,7 @@ void Callback_VideoRequestWindowSize(int& x, int& y, int& width, int& height)
// WARNING - THIS MAY BE EXECUTED FROM DSP THREAD
void Callback_DSPLog(const TCHAR* _szMessage, int _v)
{
GENERIC_LOG(AUDIO, (enum LOG_LEVEL)_v, "%s", _szMessage);
GENERIC_LOG(LogTypes::AUDIO, (LogTypes::LOG_LEVELS)_v, "%s", _szMessage);
}

View File

@ -127,7 +127,7 @@ void PrintCallstack()
}
}
void PrintCallstack(enum LOG_TYPE type, enum LOG_LEVEL level)
void PrintCallstack(LogTypes::LOG_TYPE type, LogTypes::LOG_LEVELS level)
{
u32 addr = Memory::ReadUnchecked_U32(PowerPC::ppcState.gpr[1]); // SP
@ -157,9 +157,9 @@ void PrintCallstack(enum LOG_TYPE type, enum LOG_LEVEL level)
}
}
void PrintDataBuffer(enum LOG_TYPE type, u8* _pData, size_t _Size, const char* _title)
void PrintDataBuffer(LogTypes::LOG_TYPE type, u8* _pData, size_t _Size, const char* _title)
{
DEBUG_LOG(type, "%s", _title);
GENERIC_LOG(type, LogTypes::LDEBUG, "%s", _title);
for (u32 j = 0; j < _Size;)
{
std::string Temp;
@ -172,7 +172,7 @@ void PrintDataBuffer(enum LOG_TYPE type, u8* _pData, size_t _Size, const char* _
if (j >= _Size)
break;
}
DEBUG_LOG(type, " Data: %s", Temp.c_str());
GENERIC_LOG(type, LogTypes::LDEBUG, " Data: %s", Temp.c_str());
}
}

View File

@ -34,8 +34,8 @@ struct CallstackEntry
bool GetCallstack(std::vector<CallstackEntry> &output);
void PrintCallstack();
void PrintCallstack(enum LOG_TYPE type, enum LOG_LEVEL level);
void PrintDataBuffer(enum LOG_TYPE _Log, u8* _pData, size_t _Size, const char* _title);
void PrintCallstack(LogTypes::LOG_TYPE type, LogTypes::LOG_LEVELS level);
void PrintDataBuffer(LogTypes::LOG_TYPE _Log, u8* _pData, size_t _Size, const char* _title);
void AddAutoBreakpoints();

View File

@ -42,7 +42,7 @@ void SetCardFlashID(u8* buffer, u8 card_index)
for(int i = 0; i < 12; i++)
{
rand = (((rand * (u64)0x0000000041c64e6dULL) + (u64)0x0000000000003039ULL) >> 16);
csum += g_SRAM.flash_id[card_index][i] = buffer[i] -(u8)rand&0xff;
csum += g_SRAM.flash_id[card_index][i] = buffer[i] - ((u8)rand&0xff);
rand = (((rand * (u64)0x0000000041c64e6dULL) + (u64)0x0000000000003039ULL) >> 16);
rand &= (u64)0x0000000000007fffULL;
}

View File

@ -458,7 +458,7 @@ void Update()
request_queue.pop();
#if MAX_LOGLEVEL >= DEBUG_LEVEL
Dolphin_Debugger::PrintCallstack(WII_IPC_HLE, DEBUG_LEVEL);
Dolphin_Debugger::PrintCallstack(LogTypes::WII_IPC_HLE, LogTypes::LDEBUG);
#endif
}

View File

@ -162,8 +162,8 @@ protected:
// Write out the IPC struct from _CommandAddress to _NumberOfCommands numbers
// of 4 byte commands.
void DumpCommands(u32 _CommandAddress, size_t _NumberOfCommands = 8,
enum LOG_TYPE LogType = WII_IPC_HLE,
enum LOG_LEVEL Verbosity = DEBUG_LEVEL)
LogTypes::LOG_TYPE LogType = LogTypes::WII_IPC_HLE,
LogTypes::LOG_LEVELS Verbosity = LogTypes::LDEBUG)
{
GENERIC_LOG(LogType, Verbosity, "CommandDump of %s",
GetDeviceName().c_str());
@ -175,8 +175,8 @@ protected:
}
void DumpAsync(u32 BufferVector, u32 NumberInBuffer, u32 NumberOutBuffer,
enum LOG_TYPE LogType = WII_IPC_HLE,
enum LOG_LEVEL Verbosity = DEBUG_LEVEL)
LogTypes::LOG_TYPE LogType = LogTypes::WII_IPC_HLE,
LogTypes::LOG_LEVELS Verbosity = LogTypes::LDEBUG)
{
GENERIC_LOG(LogType, Verbosity, "======= DumpAsync ======");
@ -186,7 +186,7 @@ protected:
u32 InBuffer = Memory::Read_U32(BufferOffset); BufferOffset += 4;
u32 InBufferSize = Memory::Read_U32(BufferOffset); BufferOffset += 4;
INFO_LOG(LogType, "%s - IOCtlV InBuffer[%i]:",
GENERIC_LOG(LogType, LogTypes::LINFO, "%s - IOCtlV InBuffer[%i]:",
GetDeviceName().c_str(), i);
std::string Temp;
@ -197,7 +197,7 @@ protected:
Temp.append(Buffer);
}
DEBUG_LOG(LogType, " Buffer: %s", Temp.c_str());
GENERIC_LOG(LogType, LogTypes::LDEBUG, " Buffer: %s", Temp.c_str());
}
for (u32 i = 0; i < NumberOutBuffer; i++)
@ -205,9 +205,9 @@ protected:
u32 OutBuffer = Memory::Read_U32(BufferOffset); BufferOffset += 4;
u32 OutBufferSize = Memory::Read_U32(BufferOffset); BufferOffset += 4;
INFO_LOG(LogType, "%s - IOCtlV OutBuffer[%i]:",
GENERIC_LOG(LogType, LogTypes::LINFO, "%s - IOCtlV OutBuffer[%i]:",
GetDeviceName().c_str(), i);
INFO_LOG(LogType, " OutBuffer: 0x%08x (0x%x):",
GENERIC_LOG(LogType, LogTypes::LINFO, " OutBuffer: 0x%08x (0x%x):",
OutBuffer, OutBufferSize);
#if defined(MAX_LOGLEVEL) && MAX_LOGLEVEL >= INFO_LEVEL

View File

@ -756,7 +756,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
default:
WARN_LOG(WII_IPC_ES, "CWII_IPC_HLE_Device_es: 0x%x", Buffer.Parameter);
DumpCommands(_CommandAddress, 8, WII_IPC_ES);
DumpCommands(_CommandAddress, 8, LogTypes::WII_IPC_ES);
INFO_LOG(WII_IPC_ES, "command.Parameter: 0x%08x", Buffer.Parameter);
break;
}

View File

@ -188,9 +188,9 @@ bool CWII_IPC_HLE_Device_sdio_slot0::IOCtl(u32 _CommandAddress)
}
// INFO_LOG(WII_IPC_SD, "InBuffer");
// DumpCommands(BufferIn, BufferInSize / 4, WII_IPC_SD);
// DumpCommands(BufferIn, BufferInSize / 4, LogTypes::WII_IPC_SD);
// INFO_LOG(WII_IPC_SD, "OutBuffer");
// DumpCommands(BufferOut, BufferOutSize/4, WII_IPC_SD);
// DumpCommands(BufferOut, BufferOutSize/4, LogTypes::WII_IPC_SD);
Memory::Write_U32(ReturnValue, _CommandAddress + 0x4);
@ -226,7 +226,7 @@ bool CWII_IPC_HLE_Device_sdio_slot0::IOCtlV(u32 _CommandAddress)
break;
}
//DumpAsync(CommandBuffer.BufferVector, CommandBuffer.NumberInBuffer, CommandBuffer.NumberPayloadBuffer, WII_IPC_SD);
//DumpAsync(CommandBuffer.BufferVector, CommandBuffer.NumberInBuffer, CommandBuffer.NumberPayloadBuffer, LogTypes::WII_IPC_SD);
Memory::Write_U32(ReturnValue, _CommandAddress + 0x4);

View File

@ -94,7 +94,7 @@ public:
case IOCTL_STM_VIDIMMING: // (Input: 20 bytes, Output: 20 bytes)
INFO_LOG(WII_IPC_STM, "%s - IOCtl:", GetDeviceName().c_str());
INFO_LOG(WII_IPC_STM, " IOCTL_STM_VIDIMMING");
//DumpCommands(BufferIn, BufferInSize / 4, WII_IPC_STM);
//DumpCommands(BufferIn, BufferInSize / 4, LogTypes::WII_IPC_STM);
//Memory::Write_U32(1, BufferOut);
//ReturnValue = 1;
break;
@ -182,7 +182,7 @@ public:
DEBUG_LOG(WII_IPC_STM, "BufferOut: 0x%08x", BufferOut);
DEBUG_LOG(WII_IPC_STM, "BufferOutSize: 0x%08x", BufferOutSize);
DumpCommands(BufferIn, BufferInSize/4, WII_IPC_STM);
DumpCommands(BufferIn, BufferInSize/4, LogTypes::WII_IPC_STM);
}
break;

View File

@ -1739,7 +1739,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandVendorSpecific_FC4F(u8* _Input,
INFO_LOG(WII_IPC_WIIMOTE, "Command: CommandVendorSpecific_FC4F: (callstack WUDiRemovePatch)");
INFO_LOG(WII_IPC_WIIMOTE, "input (size 0x%x):", _Size);
Dolphin_Debugger::PrintDataBuffer(WII_IPC_WIIMOTE, _Input, _Size, "Data: ");
Dolphin_Debugger::PrintDataBuffer(LogTypes::WII_IPC_WIIMOTE, _Input, _Size, "Data: ");
SendEventCommandComplete(0xFC4F, &Reply, sizeof(hci_status_rp));
}
@ -1751,7 +1751,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandVendorSpecific_FC4C(u8* _Input,
INFO_LOG(WII_IPC_WIIMOTE, "Command: CommandVendorSpecific_FC4C:");
INFO_LOG(WII_IPC_WIIMOTE, "input (size 0x%x):", _Size);
Dolphin_Debugger::PrintDataBuffer(WII_IPC_WIIMOTE, _Input, _Size, "Data: ");
Dolphin_Debugger::PrintDataBuffer(LogTypes::WII_IPC_WIIMOTE, _Input, _Size, "Data: ");
SendEventCommandComplete(0xFC4C, &Reply, sizeof(hci_status_rp));
}

View File

@ -64,7 +64,7 @@ bool CWII_IPC_HLE_Device_usb_kbd::Write(u32 _CommandAddress)
{
INFO_LOG(WII_IPC_STM, "Ignoring write to CWII_IPC_HLE_Device_usb_kbd");
#if defined(_DEBUG) || defined(DEBUGFAST)
DumpCommands(_CommandAddress, 10, WII_IPC_STM, DEBUG_LEVEL);
DumpCommands(_CommandAddress, 10, LogTypes::WII_IPC_STM, LogTypes::LDEBUG);
#endif
return true;
}

View File

@ -756,12 +756,12 @@ void CWII_IPC_HLE_WiiMote::SDPSendServiceAttributeResponse(u16 cid, u16 Transact
pHeader->length = (u16)(Offset - sizeof(l2cap_hdr_t));
m_pHost->SendACLPacket(GetConnectionHandle(), DataFrame, pHeader->length + sizeof(l2cap_hdr_t));
// Debugger::PrintDataBuffer(WIIMOTE, DataFrame, pHeader->length + sizeof(l2cap_hdr_t), "test response: ");
// Debugger::PrintDataBuffer(LogTypes::WIIMOTE, DataFrame, pHeader->length + sizeof(l2cap_hdr_t), "test response: ");
}
void CWII_IPC_HLE_WiiMote::HandleSDP(u16 cid, u8* _pData, u32 _Size)
{
// Debugger::PrintDataBuffer(WIIMOTE, _pData, _Size, "HandleSDP: ");
// Debugger::PrintDataBuffer(LogTypes::WIIMOTE, _pData, _Size, "HandleSDP: ");
CBigEndianBuffer buffer(_pData);
@ -847,7 +847,7 @@ void CWII_IPC_HLE_WiiMote::SendCommandToACL(u8 _Ident, u8 _Code, u8 _CommandLeng
// send ....
m_pHost->SendACLPacket(GetConnectionHandle(), DataFrame, pHeader->length + sizeof(l2cap_hdr_t));
//Debugger::PrintDataBuffer(WIIMOTE, DataFrame, pHeader->length + sizeof(l2cap_hdr_t), "m_pHost->SendACLPacket: ");
//Debugger::PrintDataBuffer(LogTypes::WIIMOTE, DataFrame, pHeader->length + sizeof(l2cap_hdr_t), "m_pHost->SendACLPacket: ");
}
void CWII_IPC_HLE_WiiMote::ReceiveL2capData(u16 scid, const void* _pData, u32 _Size)

View File

@ -98,7 +98,7 @@ void ReadGC(std::string FileName)
void CheckFile(std::string File, u64 Size)
{
// Don't do anything if the log is unselected
if (!LogManager::GetInstance()->isEnable(FILEMON)) return;
if (!LogManager::GetInstance()->isEnable(LogTypes::FILEMON)) return;
// Do nothing if we found the same file again
if (CurrentFile == File) return;
@ -124,7 +124,7 @@ void FindFilename(u64 offset)
// Don't do anything if a game is not running
if (Core::GetState() != Core::CORE_RUN) return;
// Or if the log is unselected
if (!LogManager::GetInstance()->isEnable(FILEMON)) return;
if (!LogManager::GetInstance()->isEnable(LogTypes::FILEMON)) return;
if (!FileAccess) return;
if (!pFileSystem || ISOFile != SConfig::GetInstance().m_LastFilename)

View File

@ -55,8 +55,8 @@ CLogWindow::CLogWindow(CFrame *parent, wxWindowID id, const wxPoint& pos,
#endif
{
m_LogManager = LogManager::GetInstance();
for (int i = 0; i < NUMBER_OF_LOGS; ++i)
m_LogManager->addListener(i, this);
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();
@ -151,9 +151,9 @@ void CLogWindow::CreateGUIControls()
CLogWindow::~CLogWindow()
{
for (int i = 0; i < NUMBER_OF_LOGS; ++i)
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
{
m_LogManager->removeListener(i, this);
m_LogManager->removeListener((LogTypes::LOG_TYPE)i, this);
}
m_LogTimer->Stop();
delete m_LogTimer;
@ -193,8 +193,8 @@ void CLogWindow::SaveSettings()
ini.Set("Options", "WriteToFile", m_writeFile);
ini.Set("Options", "WriteToConsole", m_writeConsole);
ini.Set("Options", "WriteToWindow", m_writeWindow);
for (int i = 0; i < NUMBER_OF_LOGS; ++i)
ini.Set("Logs", m_LogManager->getShortName(i), m_checks->IsChecked(i));
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(File::GetUserPath(F_LOGGERCONFIG_IDX));
}
@ -222,26 +222,26 @@ void CLogWindow::LoadSettings()
m_writeConsoleCB->SetValue(m_writeConsole);
ini.Get("Options", "WriteToWindow", &m_writeWindow, true);
m_writeWindowCB->SetValue(m_writeWindow);
for (int i = 0; i < NUMBER_OF_LOGS; ++i)
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
{
bool enable;
ini.Get("Logs", m_LogManager->getShortName(i), &enable, true);
ini.Get("Logs", m_LogManager->getShortName((LogTypes::LOG_TYPE)i), &enable, true);
if (m_writeWindow && enable)
m_LogManager->addListener(i, this);
m_LogManager->addListener((LogTypes::LOG_TYPE)i, this);
else
m_LogManager->removeListener(i, this);
m_LogManager->removeListener((LogTypes::LOG_TYPE)i, this);
if (m_writeFile && enable)
m_LogManager->addListener(i, m_fileLog);
m_LogManager->addListener((LogTypes::LOG_TYPE)i, m_fileLog);
else
m_LogManager->removeListener(i, m_fileLog);
m_LogManager->removeListener((LogTypes::LOG_TYPE)i, m_fileLog);
if (m_writeConsole && enable)
m_LogManager->addListener(i, m_console);
m_LogManager->addListener((LogTypes::LOG_TYPE)i, m_console);
else
m_LogManager->removeListener(i, m_console);
m_LogManager->setLogLevel(i, (enum LOG_LEVEL)verbosity);
m_LogManager->removeListener((LogTypes::LOG_TYPE)i, m_console);
m_LogManager->setLogLevel((LogTypes::LOG_TYPE)i, (LogTypes::LOG_LEVELS)(verbosity));
}
UpdateChecks();
}
@ -270,7 +270,7 @@ void CLogWindow::OnClear(wxCommandEvent& WXUNUSED (event))
void CLogWindow::OnToggleAll(wxCommandEvent& WXUNUSED (event))
{
static bool enableAll = false;
for (int i = 0; i < NUMBER_OF_LOGS; ++i)
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
{
ToggleLog(i, enableAll);
}
@ -289,20 +289,20 @@ void CLogWindow::UpdateChecks()
// if you don't do it (at least the win version)
m_checks->Freeze();
for (int i = 0; i < NUMBER_OF_LOGS; i++)
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
{
m_checks->Append(wxString::FromAscii(m_LogManager->getFullName(i)));
m_checks->Append(wxString::FromAscii(m_LogManager->getFullName( (LogTypes::LOG_TYPE)i )));
}
m_checks->Thaw();
}
m_checks->Freeze();
for (int i = 0; i < NUMBER_OF_LOGS; i++)
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
{
m_checks->Check(i,
m_LogManager->isListener(i, this) ||
m_LogManager->isListener(i, m_console) ||
m_LogManager->isListener(i, m_fileLog));
m_LogManager->isListener((LogTypes::LOG_TYPE)i, this) ||
m_LogManager->isListener((LogTypes::LOG_TYPE)i, m_console) ||
m_LogManager->isListener((LogTypes::LOG_TYPE)i, m_fileLog));
}
m_checks->Thaw();
}
@ -348,9 +348,9 @@ void CLogWindow::OnOptionsCheck(wxCommandEvent& event)
{
// get selection
int v = m_verbosity->GetSelection() + 1;
for (int i = 0; i < NUMBER_OF_LOGS; i++)
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
{
m_LogManager->setLogLevel(i, (enum LOG_LEVEL)v);
m_LogManager->setLogLevel((LogTypes::LOG_TYPE)i, (LogTypes::LOG_LEVELS)v);
}
}
break;
@ -389,43 +389,43 @@ void CLogWindow::OnOptionsCheck(wxCommandEvent& event)
break;
case IDM_WRITEFILE:
for (int i = 0; i < NUMBER_OF_LOGS; ++i)
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(i, m_fileLog);
m_LogManager->addListener((LogTypes::LOG_TYPE)i, m_fileLog);
else
m_LogManager->removeListener(i, m_fileLog);
m_LogManager->removeListener((LogTypes::LOG_TYPE)i, m_fileLog);
}
}
break;
case IDM_WRITEWINDOW:
for (int i = 0; i < NUMBER_OF_LOGS; ++i)
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
{
m_writeWindow = event.IsChecked();
if (m_checks->IsChecked(i))
{
if (m_writeWindow)
m_LogManager->addListener(i, this);
m_LogManager->addListener((LogTypes::LOG_TYPE)i, this);
else
m_LogManager->removeListener(i, this);
m_LogManager->removeListener((LogTypes::LOG_TYPE)i, this);
}
}
break;
case IDM_WRITECONSOLE:
for (int i = 0; i < NUMBER_OF_LOGS; ++i)
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(i, m_console);
m_LogManager->addListener((LogTypes::LOG_TYPE)i, m_console);
else
m_LogManager->removeListener(i, m_console);
m_LogManager->removeListener((LogTypes::LOG_TYPE)i, m_console);
}
}
break;
@ -444,7 +444,7 @@ void CLogWindow::OnLogCheck(wxCommandEvent& event)
void CLogWindow::ToggleLog(int _logType, bool enable)
{
enum LOG_TYPE logType = (enum LOG_TYPE)_logType;
LogTypes::LOG_TYPE logType = (LogTypes::LOG_TYPE)_logType;
m_checks->Check(_logType, enable);
@ -493,7 +493,7 @@ void CLogWindow::UpdateLog()
{
switch (msgQueue.front().first)
{
// red
// red
case ERROR_LEVEL:
m_Log->SetDefaultStyle(wxTextAttr(*wxRED));
break;
@ -532,7 +532,7 @@ void CLogWindow::UpdateLog()
m_LogTimer->Start(UPDATETIME);
}
void CLogWindow::Log(enum LOG_LEVEL level, const char *text)
void CLogWindow::Log(LogTypes::LOG_LEVELS level, const char *text)
{
m_LogSection.Enter();
if (msgQueue.size() >= 100)

View File

@ -60,7 +60,7 @@ public:
void SaveSettings();
void LoadSettings();
void Log(enum LOG_LEVEL level, const char *text);
void Log(LogTypes::LOG_LEVELS, const char *text);
int x, y, winpos;