RetroArch/logger/xdk1_logger_override.h

102 lines
2.8 KiB
C
Raw Normal View History

/* RetroArch - A frontend for libretro.
2013-01-01 00:37:37 +00:00
* Copyright (C) 2010-2013 - Hans-Kristian Arntzen
* Copyright (C) 2011-2013 - 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>
#include "msvc/msvc_compat.h"
// FIXME: Using arbitrary string as fmt argument is unsafe.
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
snprintf(msg_new, sizeof(msg_new), "RetroArch Salamander: %s%s", tag ? tag : "", fmt);
2012-11-10 12:46:24 +00:00
#else
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);
}
static inline void RARCH_LOG(const char *msg, ...)
{
va_list ap;
va_start(ap, msg);
RARCH_LOG_V(NULL, msg, ap);
2012-11-10 12:46:24 +00:00
va_end(ap);
}
static inline void RARCH_LOG_OUTPUT_V(const char *tag, const char *msg, va_list ap)
{
RARCH_LOG_V(tag, msg, ap);
}
2012-11-10 12:46:24 +00:00
static inline void RARCH_LOG_OUTPUT(const char *msg, ...)
{
va_list ap;
va_start(ap, msg);
RARCH_LOG_V(NULL, msg, ap);
va_end(ap);
}
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
snprintf(msg_new, sizeof(msg_new), "RetroArch Salamander [WARN] :: %s%s", tag ? tag : "", fmt);
#else
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);
}
static inline void RARCH_WARN(const char *msg, ...)
{
va_list ap;
va_start(ap, msg);
RARCH_WARN_V(NULL, msg, ap);
va_end(ap);
}
static inline void RARCH_ERR_V(const char *tag, const char *fmt, ...)
{
2012-07-08 13:43:50 +00:00
char msg_new[1024], buffer[1024];
#ifdef IS_SALAMANDER
snprintf(msg_new, sizeof(msg_new), "RetroArch Salamander [ERR] :: %s%s", tag ? tag : "", fmt);
#else
snprintf(msg_new, sizeof(msg_new), "RetroArch [ERR] :: %s%s", tag ? tag : "", fmt);
#endif
2012-07-08 13:43:50 +00:00
wvsprintf(buffer, msg_new, ap);
OutputDebugStringA(buffer);
}
static inline void RARCH_ERR(const char *msg, ...)
{
va_list ap;
va_start(ap, msg);
RARCH_ERR_V(NULL, msg, ap);
va_end(ap);
}
#endif