mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
First pass at dealing with different size_t/off_t sizes in C90 environments.
Most of the code dealing with the LogTypes namespace was C which lead to a lot of nonsensical casting, so I have dumbed LOG_TYPE and LOG_LEVEL down to plain C even though the move of wiiuse into Source means we don't currently call GenericLog from C. Set logging threshold to MAX_LOGLEVEL at startup so debug builds will also p rint debugging messages before the GUI is running. For some reason the way we use SetDefaultStyle doesn't play nice with wx 2.9 so we just get the default black text on a black background. Using a gray background works around that problem, but I found it to also be much easier on the eyes so I have switched the background color on all versions. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6528 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -70,7 +70,7 @@ public:
|
||||
case MODE_READ: memcpy(data, *ptr, size); break;
|
||||
case MODE_WRITE: memcpy(*ptr, data, size); break;
|
||||
case MODE_MEASURE: break; // MODE_MEASURE - don't need to do anything
|
||||
case MODE_VERIFY: for(int i = 0; i < size; i++) _dbg_assert_msg_(COMMON, ((u8*)data)[i] == (*ptr)[i], "Savestate verification failure: %d (0x%X) (at 0x%X) != %d (0x%X) (at 0x%X).\n", ((u8*)data)[i], ((u8*)data)[i], &((u8*)data)[i], (*ptr)[i], (*ptr)[i], &(*ptr)[i]); break;
|
||||
case MODE_VERIFY: for(int i = 0; i < size; i++) _dbg_assert_msg_(COMMON, ((u8*)data)[i] == (*ptr)[i], "Savestate verification failure: %d (0x%X) (at %p) != %d (0x%X) (at %p).\n", ((u8*)data)[i], ((u8*)data)[i], &((u8*)data)[i], (*ptr)[i], (*ptr)[i], &(*ptr)[i]); break;
|
||||
default: break; // throw an error?
|
||||
}
|
||||
(*ptr) += size;
|
||||
@ -136,7 +136,7 @@ public:
|
||||
case MODE_READ: x = (char*)*ptr; break;
|
||||
case MODE_WRITE: memcpy(*ptr, x.c_str(), stringLen); break;
|
||||
case MODE_MEASURE: break;
|
||||
case MODE_VERIFY: _dbg_assert_msg_(COMMON, !strcmp(x.c_str(), (char*)*ptr), "Savestate verification failure: \"%s\" != \"%s\" (at 0x%X).\n", x.c_str(), (char*)*ptr, ptr); break;
|
||||
case MODE_VERIFY: _dbg_assert_msg_(COMMON, !strcmp(x.c_str(), (char*)*ptr), "Savestate verification failure: \"%s\" != \"%s\" (at %p).\n", x.c_str(), (char*)*ptr, ptr); break;
|
||||
}
|
||||
(*ptr) += stringLen;
|
||||
}
|
||||
@ -150,7 +150,7 @@ public:
|
||||
case MODE_READ: delete[] *pBuffer; *pBuffer = new u8[_Size]; memcpy(*pBuffer, *ptr, _Size); break;
|
||||
case MODE_WRITE: memcpy(*ptr, *pBuffer, _Size); break;
|
||||
case MODE_MEASURE: break;
|
||||
case MODE_VERIFY: if(*pBuffer) for(u32 i = 0; i < _Size; i++) _dbg_assert_msg_(COMMON, (*pBuffer)[i] == (*ptr)[i], "Savestate verification failure: %d (0x%X) (at 0x%X) != %d (0x%X) (at 0x%X).\n", (*pBuffer)[i], (*pBuffer)[i], &(*pBuffer)[i], (*ptr)[i], (*ptr)[i], &(*ptr)[i]); break;
|
||||
case MODE_VERIFY: if(*pBuffer) for(u32 i = 0; i < _Size; i++) _dbg_assert_msg_(COMMON, (*pBuffer)[i] == (*ptr)[i], "Savestate verification failure: %d (0x%X) (at %p) != %d (0x%X) (at %p).\n", (*pBuffer)[i], (*pBuffer)[i], &(*pBuffer)[i], (*ptr)[i], (*ptr)[i], &(*ptr)[i]); break;
|
||||
}
|
||||
} else {
|
||||
*pBuffer = NULL;
|
||||
|
@ -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(LogTypes::LNOTICE, SLog.c_str());
|
||||
if (SLog.length() > 0) Log(NOTICE_LEVEL, SLog.c_str());
|
||||
|
||||
// Resize the window too
|
||||
if (Resize) MoveWindow(GetConsoleWindow(), Left,Top, (Width + 100),Height, true);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text)
|
||||
void ConsoleListener::Log(enum LOG_LEVEL Level, const char *Text)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
/*
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
#ifdef _WIN32
|
||||
COORD GetCoordinates(int BytesRead, int BufferWidth);
|
||||
#endif
|
||||
void Log(LogTypes::LOG_LEVELS, const char *Text);
|
||||
void Log(enum LOG_LEVEL level, const char *Text);
|
||||
void ClearScreen(bool Cursor = true);
|
||||
|
||||
const char *getName() const { return "Console"; }
|
||||
|
@ -337,7 +337,8 @@ u64 GetSize(const char *filename)
|
||||
// on windows it's actually _stat64 defined in commonFuncs
|
||||
struct stat64 buf;
|
||||
if (stat64(filename, &buf) == 0) {
|
||||
DEBUG_LOG(COMMON, "GetSize: %s: %lld", filename, buf.st_size);
|
||||
DEBUG_LOG(COMMON, "GetSize: %s: %lld",
|
||||
filename, (long long)buf.st_size);
|
||||
return buf.st_size;
|
||||
}
|
||||
|
||||
|
@ -18,17 +18,6 @@
|
||||
#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.
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace LogTypes
|
||||
{
|
||||
#endif
|
||||
|
||||
enum LOG_TYPE {
|
||||
ACTIONREPLAY,
|
||||
AUDIO,
|
||||
@ -48,7 +37,7 @@ enum LOG_TYPE {
|
||||
EXPANSIONINTERFACE,
|
||||
POWERPC,
|
||||
GPFIFO,
|
||||
HLE,
|
||||
OSHLE,
|
||||
MASTER_LOG,
|
||||
MEMMAP,
|
||||
MEMCARD_MANAGER,
|
||||
@ -77,37 +66,21 @@ enum LOG_TYPE {
|
||||
NUMBER_OF_LOGS // Must be last
|
||||
};
|
||||
|
||||
// FIXME: should this be removed?
|
||||
enum LOG_LEVELS {
|
||||
LNOTICE = NOTICE_LEVEL,
|
||||
LERROR = ERROR_LEVEL,
|
||||
LWARNING = WARNING_LEVEL,
|
||||
LINFO = INFO_LEVEL,
|
||||
LDEBUG = DEBUG_LEVEL,
|
||||
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
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define LOGTYPES_LEVELS LogTypes::LOG_LEVELS
|
||||
#define LOGTYPES_TYPE LogTypes::LOG_TYPE
|
||||
#else
|
||||
#define LOGTYPES_LEVELS enum LOG_LEVELS
|
||||
#define LOGTYPES_TYPE enum LOG_TYPE
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // namespace
|
||||
|
||||
extern "C" {
|
||||
#endif
|
||||
void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type,
|
||||
extern "C"
|
||||
void GenericLog(enum LOG_LEVEL level, enum LOG_TYPE type,
|
||||
const char *file, int line, const char *fmt, ...)
|
||||
#ifdef __GNUC__
|
||||
__attribute__((format(printf, 5, 6)))
|
||||
#endif
|
||||
;
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined LOGGING || defined _DEBUG || defined DEBUGFAST
|
||||
#define MAX_LOGLEVEL DEBUG_LEVEL
|
||||
@ -120,16 +93,20 @@ void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type,
|
||||
#ifdef GEKKO
|
||||
#define GENERIC_LOG(t, v, ...)
|
||||
#else
|
||||
|
||||
// Let the compiler optimize this out
|
||||
#define GENERIC_LOG(t, v, ...) {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__); \
|
||||
}
|
||||
//#define GENERIC_LOG(t, v, ...) { if (v <= MAX_LOGLEVEL)
|
||||
// GenericLog(v, t, __FILE__, __LINE__, __VA_ARGS__); }
|
||||
#endif
|
||||
|
||||
#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__) }
|
||||
#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__) }
|
||||
|
||||
#if MAX_LOGLEVEL >= DEBUG_LEVEL
|
||||
#define _dbg_assert_(_t_, _a_) \
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "Thread.h"
|
||||
#include "FileUtil.h"
|
||||
|
||||
void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
|
||||
void GenericLog(enum LOG_LEVEL level, enum 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[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::HLE] = 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_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_fileLog = new FileLogListener(File::GetUserPath(F_MAINLOG_IDX));
|
||||
m_consoleLog = new ConsoleListener();
|
||||
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) {
|
||||
for (int i = 0; i < 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 < 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) {
|
||||
m_logManager->removeListener(i, m_fileLog);
|
||||
m_logManager->removeListener(i, m_consoleLog);
|
||||
}
|
||||
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
|
||||
for (int i = 0; i < NUMBER_OF_LOGS; ++i)
|
||||
delete m_Log[i];
|
||||
|
||||
delete m_fileLog;
|
||||
@ -108,9 +108,8 @@ LogManager::~LogManager() {
|
||||
delete logMutex;
|
||||
}
|
||||
|
||||
void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
|
||||
const char *file, int line, const char *format,
|
||||
va_list args) {
|
||||
void LogManager::Log(enum LOG_LEVEL level, enum LOG_TYPE type,
|
||||
const char *file, int line, const char *format, va_list args) {
|
||||
|
||||
char temp[MAX_MSGLEN];
|
||||
char msg[MAX_MSGLEN * 2];
|
||||
@ -132,7 +131,7 @@ void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
|
||||
logMutex->Leave();
|
||||
}
|
||||
|
||||
void LogManager::removeListener(LogTypes::LOG_TYPE type, LogListener *listener) {
|
||||
void LogManager::removeListener(int type, LogListener *listener) {
|
||||
logMutex->Enter();
|
||||
m_Log[type]->removeListener(listener);
|
||||
logMutex->Leave();
|
||||
@ -153,7 +152,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 = LogTypes::LWARNING;
|
||||
m_level = MAX_LOGLEVEL;
|
||||
}
|
||||
|
||||
// LogContainer
|
||||
@ -172,7 +171,7 @@ bool LogContainer::isListener(LogListener *listener) const {
|
||||
return listeners.end() != std::find(listeners.begin(), listeners.end(), listener);
|
||||
}
|
||||
|
||||
void LogContainer::trigger(LogTypes::LOG_LEVELS level, const char *msg) {
|
||||
void LogContainer::trigger(enum LOG_LEVEL level, const char *msg) {
|
||||
std::vector<LogListener *>::const_iterator i;
|
||||
for (i = listeners.begin(); i != listeners.end(); ++i) {
|
||||
(*i)->Log(level, msg);
|
||||
@ -191,10 +190,10 @@ FileLogListener::~FileLogListener() {
|
||||
fclose(m_logfile);
|
||||
}
|
||||
|
||||
void FileLogListener::Log(LogTypes::LOG_LEVELS, const char *msg) {
|
||||
void FileLogListener::Log(enum LOG_LEVEL, 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);
|
||||
}
|
||||
|
@ -33,7 +33,7 @@
|
||||
class LogListener {
|
||||
public:
|
||||
virtual ~LogListener() {}
|
||||
virtual void Log(LogTypes::LOG_LEVELS, const char *msg) = 0;
|
||||
virtual void Log(enum LOG_LEVEL level, const char *msg) = 0;
|
||||
virtual const char *getName() const = 0;
|
||||
};
|
||||
|
||||
@ -42,7 +42,7 @@ public:
|
||||
FileLogListener(const char *filename);
|
||||
~FileLogListener();
|
||||
|
||||
void Log(LogTypes::LOG_LEVELS, const char *msg);
|
||||
void Log(enum LOG_LEVEL level, const char *msg);
|
||||
|
||||
bool isValid() {
|
||||
return (m_logfile != NULL);
|
||||
@ -75,18 +75,18 @@ public:
|
||||
void addListener(LogListener *listener);
|
||||
void removeListener(LogListener *listener);
|
||||
|
||||
void trigger(LogTypes::LOG_LEVELS, const char *msg);
|
||||
void trigger(enum LOG_LEVEL level, const char *msg);
|
||||
|
||||
bool isEnable() const { return m_enable; }
|
||||
void setEnable(bool enable) {
|
||||
m_enable = enable;
|
||||
}
|
||||
|
||||
LogTypes::LOG_LEVELS getLevel() const {
|
||||
enum LOG_LEVEL getLevel() const {
|
||||
return m_level;
|
||||
}
|
||||
|
||||
void setLevel(LogTypes::LOG_LEVELS level) {
|
||||
void setLevel(enum LOG_LEVEL level) {
|
||||
m_level = level;
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ private:
|
||||
char m_fullName[128];
|
||||
char m_shortName[32];
|
||||
bool m_enable;
|
||||
LogTypes::LOG_LEVELS m_level;
|
||||
enum LOG_LEVEL m_level;
|
||||
|
||||
std::vector<LogListener *> listeners;
|
||||
};
|
||||
@ -109,7 +109,7 @@ namespace Common {
|
||||
class LogManager : NonCopyable
|
||||
{
|
||||
private:
|
||||
LogContainer* m_Log[LogTypes::NUMBER_OF_LOGS];
|
||||
LogContainer *m_Log[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(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
|
||||
void Log(enum LOG_LEVEL level, enum LOG_TYPE type,
|
||||
const char *file, int line, const char *fmt, va_list args);
|
||||
|
||||
void setLogLevel(LogTypes::LOG_TYPE type, LogTypes::LOG_LEVELS level) {
|
||||
void setLogLevel(int type, LOG_LEVEL level) {
|
||||
m_Log[type]->setLevel(level);
|
||||
}
|
||||
|
||||
void setEnable(LogTypes::LOG_TYPE type, bool enable) {
|
||||
void setEnable(int type, bool enable) {
|
||||
m_Log[type]->setEnable(enable);
|
||||
}
|
||||
|
||||
bool isEnable(LogTypes::LOG_TYPE type) {
|
||||
bool isEnable(int type) {
|
||||
return m_Log[type]->isEnable();
|
||||
}
|
||||
|
||||
const char *getShortName(LogTypes::LOG_TYPE type) const {
|
||||
const char *getShortName(int type) const {
|
||||
return m_Log[type]->getShortName();
|
||||
}
|
||||
|
||||
const char *getFullName(LogTypes::LOG_TYPE type) const {
|
||||
const char *getFullName(int type) const {
|
||||
return m_Log[type]->getFullName();
|
||||
}
|
||||
|
||||
bool isListener(LogTypes::LOG_TYPE type, LogListener *listener) const {
|
||||
bool isListener(int type, LogListener *listener) const {
|
||||
return m_Log[type]->isListener(listener);
|
||||
}
|
||||
|
||||
void addListener(LogTypes::LOG_TYPE type, LogListener *listener) {
|
||||
void addListener(int type, LogListener *listener) {
|
||||
m_Log[type]->addListener(listener);
|
||||
}
|
||||
|
||||
void removeListener(LogTypes::LOG_TYPE type, LogListener *listener);
|
||||
void removeListener(int type, LogListener *listener);
|
||||
|
||||
FileLogListener *getFileListener() {
|
||||
return m_fileLog;
|
||||
|
@ -22,9 +22,13 @@ void SymbolDB::List()
|
||||
{
|
||||
for (XFuncMap::iterator iter = functions.begin(); iter != functions.end(); ++iter)
|
||||
{
|
||||
DEBUG_LOG(HLE,"%s @ %08x: %i bytes (hash %08x) : %i calls", iter->second.name.c_str(), iter->second.address, iter->second.size, iter->second.hash,iter->second.numCalls);
|
||||
DEBUG_LOG(OSHLE, "%s @ %08x: %i bytes (hash %08x) : %i calls",
|
||||
iter->second.name.c_str(), iter->second.address,
|
||||
iter->second.size, iter->second.hash,
|
||||
iter->second.numCalls);
|
||||
}
|
||||
INFO_LOG(HLE,"%i functions known in this program above.", functions.size());
|
||||
INFO_LOG(OSHLE, "%lu functions known in this program above.",
|
||||
functions.size());
|
||||
}
|
||||
|
||||
void SymbolDB::Clear(const char *prefix)
|
||||
|
@ -356,7 +356,8 @@ namespace Common
|
||||
if (ret) ERROR_LOG(COMMON, "%s: pthread_create(%p, %p, %p, %p) failed: %s\n",
|
||||
__FUNCTION__, &thread_id, &attr, function, arg, strerror(ret));
|
||||
|
||||
INFO_LOG(COMMON, "created new thread %lu (func=%p, arg=%p)\n", thread_id, function, arg);
|
||||
INFO_LOG(COMMON, "created new thread %lu (func=%p, arg=%p)\n",
|
||||
(unsigned long)thread_id, function, arg);
|
||||
}
|
||||
|
||||
|
||||
@ -372,9 +373,13 @@ namespace Common
|
||||
{
|
||||
void* exit_status;
|
||||
int ret = pthread_join(thread_id, &exit_status);
|
||||
if (ret) ERROR_LOG(COMMON, "error joining thread %lu: %s\n", thread_id, strerror(ret));
|
||||
if (ret) ERROR_LOG(COMMON,
|
||||
"error joining thread %lu: %s\n",
|
||||
(unsigned long)thread_id, strerror(ret));
|
||||
if (exit_status)
|
||||
ERROR_LOG(COMMON, "thread %lu exited with status %d\n", thread_id, *(int *)exit_status);
|
||||
ERROR_LOG(COMMON,
|
||||
"thread %lu exited with status %d\n",
|
||||
(unsigned long)thread_id, *(int *)exit_status);
|
||||
thread_id = 0;
|
||||
}
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ void OpArg::WriteRest(XEmitter *emit, int extraBytes, X64Reg _operandReg) const
|
||||
s64 distance = (s64)offset - (s64)ripAddr;
|
||||
if (distance >= 0x0000000080000000LL
|
||||
|| distance < -0x0000000080000000LL) {
|
||||
PanicAlert("WriteRest: op out of range (%p uses %p)", ripAddr, offset);
|
||||
PanicAlert("WriteRest: op out of range (0x%llx uses 0x%llx)", ripAddr, offset);
|
||||
}
|
||||
s32 offs = (s32)distance;
|
||||
emit->Write32((u32)offs);
|
||||
|
Reference in New Issue
Block a user