mirror of
https://github.com/libretro/libretro-prboom.git
synced 2024-11-23 16:09:41 +00:00
Route Doom logging functions through libretro log
This commit is contained in:
parent
0d92eaafdc
commit
f09c368af0
@ -5,6 +5,7 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <libretro.h>
|
||||
#include <file/file_path.h>
|
||||
@ -1430,3 +1431,38 @@ void R_InitInterpolation(void)
|
||||
}
|
||||
tic_vars.frac = FRACUNIT;
|
||||
}
|
||||
|
||||
int lprintf(OutputLevels pri, const char *s, ...)
|
||||
{
|
||||
int r=0;
|
||||
char msg[MAX_LOG_MESSAGE_SIZE];
|
||||
|
||||
va_list v;
|
||||
va_start(v,s);
|
||||
#ifdef HAVE_VSNPRINTF
|
||||
r = vsnprintf(msg,sizeof(msg),s,v); /* print message in buffer */
|
||||
#else
|
||||
r = vsprintf(msg,s,v);
|
||||
#endif
|
||||
va_end(v);
|
||||
|
||||
if (log_cb) {
|
||||
enum retro_log_level lvl;
|
||||
switch(pri) {
|
||||
case LO_DEBUG: lvl = RETRO_LOG_DEBUG; break;
|
||||
case LO_CONFIRM:
|
||||
case LO_INFO: lvl = RETRO_LOG_INFO; break;
|
||||
case LO_WARN: lvl = RETRO_LOG_WARN; break;
|
||||
case LO_ERROR:
|
||||
case LO_FATAL:
|
||||
default: lvl = RETRO_LOG_ERROR; break;
|
||||
}
|
||||
log_cb(lvl, "%s", msg);
|
||||
}
|
||||
else
|
||||
r=fprintf(stderr,"%s",msg); /* select output at console */
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,12 +47,12 @@
|
||||
/* cphipps - enlarged message buffer and made non-static
|
||||
* We still have to be careful here, this function can be called after exit
|
||||
*/
|
||||
#define MAX_MESSAGE_SIZE 2048
|
||||
|
||||
#ifndef __LIBRETRO__
|
||||
int lprintf(OutputLevels pri, const char *s, ...)
|
||||
{
|
||||
int r=0;
|
||||
char msg[MAX_MESSAGE_SIZE];
|
||||
char msg[MAX_LOG_MESSAGE_SIZE];
|
||||
|
||||
va_list v;
|
||||
va_start(v,s);
|
||||
@ -67,6 +67,7 @@ int lprintf(OutputLevels pri, const char *s, ...)
|
||||
|
||||
return r;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* I_Error
|
||||
@ -79,7 +80,7 @@ int lprintf(OutputLevels pri, const char *s, ...)
|
||||
|
||||
bool I_Error(const char *error, ...)
|
||||
{
|
||||
char errmsg[MAX_MESSAGE_SIZE];
|
||||
char errmsg[MAX_LOG_MESSAGE_SIZE];
|
||||
va_list argptr;
|
||||
va_start(argptr,error);
|
||||
#ifdef HAVE_VSNPRINTF
|
||||
|
@ -36,6 +36,11 @@
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
/* cphipps - enlarged message buffer and made non-static
|
||||
* We still have to be careful here, this function can be called after exit
|
||||
*/
|
||||
#define MAX_LOG_MESSAGE_SIZE 2048
|
||||
|
||||
typedef enum /* Logical output levels */
|
||||
{
|
||||
LO_INFO=1, /* One of these is used in each physical output */
|
||||
|
Loading…
Reference in New Issue
Block a user