1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-08 20:25:47 +00:00
RetroArch/deps/switchres/log.cpp
Ben Templeman 197203d09b Fixed monitor index corruption on Windows and added correct fractal scalling. only used when required.
Updated log defines to match SR upstream.

Added new SR_CONFIG_PATHS for non Winddows and Linux systems.
Not that SR works on them but to fix RA compile issues

Updated SR2 code base to latest. Added supprt for windows monitor indexing.
Fixed monitor index bug where index 1 was not being used corretly
and "auto" was not being sent.

Updated swithres for x86 windows fix
fixed SR2 auto issue

Fixed auto monitor bug

Fixed monitor index corruption on Windows

Fixxed buffer size bug

Added correct fractal scalling. only used when required.
2021-07-07 18:06:47 +01:00

78 lines
1.9 KiB
C++

/**************************************************************
log.cpp - Simple logging for Switchres
---------------------------------------------------------
Switchres Modeline generation engine for emulation
License GPL-2.0+
Copyright 2010-2021 Chris Kennedy, Antonio Giner,
Alexandre Wodarczyk, Gil Delescluse
**************************************************************/
#include "log.h"
enum log_verbosity { NONE, SR_ERROR, SR_INFO, SR_DEBUG };
static log_verbosity log_level = SR_INFO;
void log_dummy(const char *, ...) {}
LOG_VERBOSE log_verbose = &log_dummy;
LOG_INFO log_info = &log_dummy;
LOG_ERROR log_error = &log_dummy;
/*
* These bakup pointers are here to let the user modify the log level at runtime
* We can't sadly unify a log function and test the log level to test if it should
* output a log, because it would imply frewriting log_ functions with va_args
* and wouldn't work with emulators log functions anymore
*/
LOG_VERBOSE log_verbose_bak = &log_dummy;
LOG_INFO log_info_bak = &log_dummy;
LOG_ERROR log_error_bak = &log_dummy;
void set_log_verbose(void *func_ptr)
{
if (log_level >= SR_DEBUG)
log_verbose = (LOG_VERBOSE)func_ptr;
log_verbose_bak = (LOG_VERBOSE)func_ptr;
}
void set_log_info(void *func_ptr)
{
if (log_level >= SR_INFO)
log_info = (LOG_INFO)func_ptr;
log_info_bak = (LOG_INFO)func_ptr;
}
void set_log_error(void *func_ptr)
{
if (log_level >= SR_ERROR)
log_error = (LOG_ERROR)func_ptr;
log_error_bak = (LOG_ERROR)func_ptr;
}
void set_log_verbosity(int level)
{
// Keep the log in the enum bounds
if (level < NONE)
level = NONE;
if(level > SR_DEBUG)
level = SR_DEBUG;
log_error = &log_dummy;
log_info = &log_dummy;
log_verbose = &log_dummy;
if (level >= SR_ERROR)
log_error = log_error_bak;
if (level >= SR_INFO)
log_info = log_info_bak;
if (level >= SR_DEBUG)
log_verbose = log_verbose_bak;
}