Override configuration based on video mode (#567)

* Override configuration based on video mode

Configuration options can now be overridden based on the core's video
mode.

The config parser now supports sections with names in the format
"video=WIDTHxHEIGHT[@VREFRESH]".  When a core changes video mode, MiSTer
reloads the config file and checks for a section matching the new mode.
If one is found, the options in the section override options in the
MiSTer/core sections.

MiSTer will look for a section matching the width, height, and vertical
refresh rate first.  If none is found, it will fall back to a section
matching the width and height but not specifying a refresh rate.  If
there is still no match, no overrides will be used.

Also, VREFRESH must match exactly the output from video_info or the
logs.  To match 720x400 31.48KHz 70.1Hz, the section title would need to
be [video=720x400@70.1].

* Move video section variables out of cfg_t
This commit is contained in:
Thomas Sowell
2022-03-16 22:46:57 -08:00
committed by GitHub
parent 062891cf9a
commit f5fd16c26e
5 changed files with 79 additions and 8 deletions

View File

@@ -1145,6 +1145,25 @@ void video_scaler_description(char *str, size_t len)
video_scaler_description(&current_video_info, &v_cur, str, len);
}
char* video_get_core_mode_name(int with_vrefresh)
{
static char tmp[256] = {};
if (with_vrefresh)
{
float vrate = 100000000;
if (current_video_info.vtime) vrate /= current_video_info.vtime; else vrate = 0;
snprintf(tmp, sizeof(tmp), "%dx%d@%.1f", current_video_info.width, current_video_info.height, vrate);
}
else
{
snprintf(tmp, sizeof(tmp), "%dx%d", current_video_info.width, current_video_info.height);
}
return tmp;
}
static void show_video_info(const VideoInfo *vi, const vmode_custom_t *vm)
{
float vrate = 100000000;
@@ -1230,10 +1249,17 @@ void video_mode_adjust()
if (vid_changed || force)
{
current_video_info = video_info;
if (cfg_has_video_sections())
{
cfg_parse();
video_mode_load();
user_io_send_buttons(1);
}
show_video_info(&video_info, &v_cur);
video_scaling_adjust(&video_info);
current_video_info = video_info;
}
force = false;