Allow C code to use the Dolphin log manager so that Wiiuse text output

can go to the log window like with other subsystems.

Remove a Wiiuse dependency on libm from when it was a shared library.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5885 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Soren Jorvang 2010-07-16 19:08:26 +00:00
parent 02ce753b76
commit aa998896ac
4 changed files with 46 additions and 14 deletions

View File

@ -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

View File

@ -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))

View File

@ -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_

View File

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