diff --git a/Externals/WiiUseSrc/Src/SConscript b/Externals/WiiUseSrc/Src/SConscript index 4402f86dc1..8bff77956c 100644 --- a/Externals/WiiUseSrc/Src/SConscript +++ b/Externals/WiiUseSrc/Src/SConscript @@ -19,6 +19,6 @@ if sys.platform == 'linux2' and env['HAVE_BLUEZ']: if sys.platform == 'darwin': files += [ "io_osx.m", ] -env.StaticLibrary(env['local_libs'] + "wiiuse", files, LIBS='m') +env.StaticLibrary(env['local_libs'] + "wiiuse", files) env['HAVE_WIIUSE'] = 1 diff --git a/Externals/WiiUseSrc/Src/definitions.h b/Externals/WiiUseSrc/Src/definitions.h index 13ca132581..b34a67117f 100644 --- a/Externals/WiiUseSrc/Src/definitions.h +++ b/Externals/WiiUseSrc/Src/definitions.h @@ -34,11 +34,21 @@ #ifndef DEFINITIONS_H_INCLUDED #define DEFINITIONS_H_INCLUDED +#if 1 // Use Dolphin logging + +#include "Log.h" +// NOTICE_LEVEL is more appropriate for the uses of WIIUSE_INFO than INFO_LEVEL +// as long as we don't provide adequate GUI feedback for bluetooth events. +#define WIIUSE_INFO(...) { GENERIC_LOG(WIIMOTE, NOTICE_LEVEL, __VA_ARGS__) } +#define WIIUSE_ERROR(...) { GENERIC_LOG(WIIMOTE, ERROR_LEVEL, __VA_ARGS__) } +#define WIIUSE_WARNING(...) { GENERIC_LOG(WIIMOTE, WARNING_LEVEL, __VA_ARGS__) } +#define WIIUSE_DEBUG(...) { GENERIC_LOG(WIIMOTE, DEBUG_LEVEL, __VA_ARGS__) } + +#else + /* this is wiiuse - used to distinguish from third party programs using wiiuse.h */ #include "os.h" -#define WIIMOTE_PI 3.14159265f - //#define WITH_WIIUSE_DEBUG /* Error output macros */ @@ -65,6 +75,10 @@ #define WIIUSE_DEBUG(fmt, ...) #endif +#endif // Use Dolphin logging + +#define WIIMOTE_PI 3.14159265f + /* Convert between radians and degrees */ #define RAD_TO_DEGREE(r) ((r * 180.0f) / WIIMOTE_PI) #define DEGREE_TO_RAD(d) (d * (WIIMOTE_PI / 180.0f)) diff --git a/Source/Core/Common/Src/Log.h b/Source/Core/Common/Src/Log.h index 9734f6fe20..7a859448a3 100644 --- a/Source/Core/Common/Src/Log.h +++ b/Source/Core/Common/Src/Log.h @@ -24,8 +24,10 @@ #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, @@ -84,13 +86,20 @@ enum LOG_LEVELS { LDEBUG = DEBUG_LEVEL, }; +#ifdef __cplusplus } // namespace +void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, + const char *file, int line, const char *fmt, ...); +extern "C" { +#endif +void GenericLogC(int level, int type, + const char *file, int line, const char *fmt, ...); +#define GenericLog GenericLogC +#ifdef __cplusplus +}; +#endif -/* - FIXME: - - Debug_run() - run only in debug time -*/ #if defined LOGGING || defined _DEBUG || defined DEBUGFAST #define MAX_LOGLEVEL DEBUG_LEVEL #else @@ -99,9 +108,6 @@ enum LOG_LEVELS { #endif // loglevel #endif // logging -void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, - const char *file, int line, const char *fmt, ...); - #ifdef GEKKO #define GENERIC_LOG(t, v, ...) #else @@ -131,7 +137,6 @@ void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, #define _dbg_update_() Host_UpdateLogDisplay(); #else // not debug -#define _dbg_clear_() #define _dbg_update_() ; #ifndef _dbg_assert_ diff --git a/Source/Core/Common/Src/LogManager.cpp b/Source/Core/Common/Src/LogManager.cpp index d60dda56e4..a51a3fae48 100644 --- a/Source/Core/Common/Src/LogManager.cpp +++ b/Source/Core/Common/Src/LogManager.cpp @@ -23,13 +23,26 @@ #include "Thread.h" #include "FileUtil.h" -void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, - const char *file, int line, const char* fmt, ...) +void GenericLogC(int level, int type, + const char *file, int line, const char* fmt, ...) { va_list args; va_start(args, fmt); if (LogManager::GetInstance()) - LogManager::GetInstance()->Log(level, type, file, line, fmt, args); + LogManager::GetInstance()->Log( + (LogTypes::LOG_LEVELS)level, (LogTypes::LOG_TYPE)type, + file, line, fmt, args); + va_end(args); +} + +void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, + const char *file, int line, const char* fmt, ...) +{ + va_list args; + va_start(args, fmt); + if (LogManager::GetInstance()) + LogManager::GetInstance()->Log(level, type, + file, line, fmt, args); va_end(args); }