RetroArch/logger/xdk1_logger_override.h

115 lines
3.0 KiB
C
Raw Normal View History

/* RetroArch - A frontend for libretro.
2014-01-01 00:50:59 +00:00
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
2015-01-07 16:46:50 +00:00
* Copyright (C) 2011-2015 - Daniel De Matteis
*
* RetroArch 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 Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch 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 for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __MSVC_71_H
#define __MSVC_71_H
2013-11-11 02:36:30 +00:00
#ifdef _XBOX1
#include <xtl.h>
#endif
#include <stdarg.h>
2014-10-21 23:59:46 +00:00
#include <retro_inline.h>
2014-10-21 05:58:58 +00:00
#include <compat/posix_string.h>
// FIXME: Using arbitrary string as fmt argument is unsafe.
2014-10-21 23:59:46 +00:00
static INLINE void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap)
{
2012-07-08 13:43:50 +00:00
char msg_new[1024], buffer[1024];
#ifdef IS_SALAMANDER
2014-09-15 05:03:54 +00:00
snprintf(msg_new, sizeof(msg_new),
"RetroArch Salamander: %s%s", tag ? tag : "", fmt);
2012-11-10 12:46:24 +00:00
#else
2014-09-15 05:03:54 +00:00
snprintf(msg_new, sizeof(msg_new),
"RetroArch: %s%s", tag ? tag : "", fmt);
2012-11-10 12:46:24 +00:00
#endif
wvsprintf(buffer, msg_new, ap);
OutputDebugStringA(buffer);
}
2014-10-21 23:59:46 +00:00
static INLINE void RARCH_LOG(const char *fmt, ...)
{
char buffer[1024];
va_list ap;
va_start(ap, fmt);
wvsprintf(buffer, fmt, ap);
OutputDebugStringA(buffer);
2012-11-10 12:46:24 +00:00
va_end(ap);
}
2014-10-21 23:59:46 +00:00
static INLINE void RARCH_LOG_OUTPUT_V(const char *tag,
2014-09-15 05:03:54 +00:00
const char *msg, va_list ap)
{
RARCH_LOG_V(tag, msg, ap);
}
2014-10-21 23:59:46 +00:00
static INLINE void RARCH_LOG_OUTPUT(const char *msg, ...)
2012-11-10 12:46:24 +00:00
{
va_list ap;
va_start(ap, msg);
RARCH_LOG_V(NULL, msg, ap);
va_end(ap);
}
2014-10-21 23:59:46 +00:00
static INLINE void RARCH_WARN_V(const char *tag, const char *fmt, va_list ap)
{
2012-07-08 13:43:50 +00:00
char msg_new[1024], buffer[1024];
#ifdef IS_SALAMANDER
2014-09-15 05:03:54 +00:00
snprintf(msg_new, sizeof(msg_new),
"RetroArch Salamander [WARN] :: %s%s", tag ? tag : "", fmt);
#else
2014-09-15 05:03:54 +00:00
snprintf(msg_new, sizeof(msg_new),
"RetroArch [WARN] :: %s%s", tag ? tag : "", fmt);
#endif
2012-07-08 13:43:50 +00:00
wvsprintf(buffer, msg_new, ap);
OutputDebugStringA(buffer);
}
2014-10-21 23:59:46 +00:00
static INLINE void RARCH_WARN(const char *fmt, ...)
{
char buffer[1024];
va_list ap;
va_start(ap, fmt);
wvsprintf(buffer, fmt, ap);
OutputDebugStringA(buffer);
va_end(ap);
}
2014-10-21 23:59:46 +00:00
static INLINE void RARCH_ERR_V(const char *tag, const char *fmt, ...)
{
2013-12-26 20:27:41 +00:00
char msg_new[1024];
#ifdef IS_SALAMANDER
2014-09-15 05:03:54 +00:00
snprintf(msg_new, sizeof(msg_new),
"RetroArch Salamander [ERR] :: %s%s", tag ? tag : "", fmt);
#else
2014-09-15 05:03:54 +00:00
snprintf(msg_new, sizeof(msg_new),
"RetroArch [ERR] :: %s%s", tag ? tag : "", fmt);
#endif
2013-12-26 20:27:41 +00:00
OutputDebugStringA(fmt);
}
2014-10-21 23:59:46 +00:00
static INLINE void RARCH_ERR(const char *fmt, ...)
{
char buffer[1024];
va_list ap;
va_start(ap, fmt);
wvsprintf(buffer, fmt, ap);
OutputDebugStringA(buffer);
va_end(ap);
}
#endif