INI: add DEBUG option to disable logging to console.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
[MiSTer]
|
||||
;debug=0 ; set to 0 to disable debugging messages. Default is 1.
|
||||
key_menu_as_rgui=0 ; set to 1 to make the MENU key map to RGUI in Minimig (e.g. for Right Amiga)
|
||||
forced_scandoubler=0 ; set to 1 to run scandoubler on VGA output always (depends on core).
|
||||
;ypbpr=0 ; set to 1 for YPbPr on VGA output. (obsolete. see vga_mode)
|
||||
|
||||
10
cfg.cpp
10
cfg.cpp
@@ -16,6 +16,8 @@
|
||||
#include "support/arcade/mra_loader.h"
|
||||
|
||||
cfg_t cfg;
|
||||
static FILE *orig_stdout = NULL;
|
||||
static FILE *dev_null = NULL;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
@@ -127,6 +129,7 @@ static const ini_var_t ini_vars[] =
|
||||
{ "CONTROLLER_UNIQUE_MAPPING", (void *)(cfg.controller_unique_mapping), UINT32ARR, 0, 0xFFFFFFFF },
|
||||
{ "OSD_LOCK", (void*)(&(cfg.osd_lock)), STRING, 0, sizeof(cfg.osd_lock) - 1 },
|
||||
{ "OSD_LOCK_TIME", (void*)(&(cfg.osd_lock_time)), UINT16, 0, 60 },
|
||||
{ "DEBUG", (void *)(&(cfg.debug)), UINT8, 0, 1 },
|
||||
};
|
||||
|
||||
static const int nvars = (int)(sizeof(ini_vars) / sizeof(ini_var_t));
|
||||
@@ -390,6 +393,10 @@ static void ini_parse_var(char* buf)
|
||||
|
||||
default:
|
||||
ini_parse_numeric(var, &buf[i], var->var);
|
||||
if (!strcasecmp(var->name, "DEBUG"))
|
||||
{
|
||||
stdout = cfg.debug ? orig_stdout : dev_null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -401,6 +408,9 @@ static void ini_parse(int alt, const char *vmode)
|
||||
int section = 0;
|
||||
int eof;
|
||||
|
||||
if (!orig_stdout) orig_stdout = stdout;
|
||||
if(!dev_null) dev_null = fopen("/dev/null", "w");
|
||||
|
||||
ini_parser_debugf("Start INI parser for core \"%s\"(%s), video mode \"%s\".", user_io_get_core_name(0), user_io_get_core_name(1), vmode);
|
||||
|
||||
memset(line, 0, sizeof(line));
|
||||
|
||||
Reference in New Issue
Block a user