If errors are detected in INI settings display an info message for 5 seconds at core startup. (#696)

Added `cfg_error` function for reporting errors in the ini.
Report errors when parsing video_mode information.
Report out of bounds settings.
Report unknown settings.
Detect numeric parse failures.
This commit is contained in:
Martin Donlon
2022-09-24 13:32:39 -07:00
committed by GitHub
parent 5728bdda78
commit 801a5ea0d2
4 changed files with 133 additions and 49 deletions

View File

@@ -1851,6 +1851,8 @@ static int parse_custom_video_mode(char* vcfg, vmode_custom_t *v)
char work[1024];
char *next;
if (!vcfg[0]) return -1;
memset(v, 0, sizeof(vmode_custom_t));
v->param.rb = 1; // default reduced blanking to true
@@ -1866,7 +1868,7 @@ static int parse_custom_video_mode(char* vcfg, vmode_custom_t *v)
}
}
if (cnt == 2)
if (cnt == 2 && token_cnt > 2)
{
valf = strtod(tokens[cnt], &next);
if (!*next) cnt++;
@@ -1885,6 +1887,7 @@ static int parse_custom_video_mode(char* vcfg, vmode_custom_t *v)
else
{
printf("Error parsing video_mode parameter %d \"%s\": \"%s\"\n", i, flag, vcfg);
cfg_error("Invalid video_mode\n> %s", vcfg);
return -1;
}
}
@@ -1921,6 +1924,7 @@ static int parse_custom_video_mode(char* vcfg, vmode_custom_t *v)
else
{
printf("Error parsing video_mode parameter: ""%s""\n", vcfg);
cfg_error("Invalid video_mode\n> %s", vcfg);
return -1;
}